gnss: update qser gnss api
Change-Id: I3f754993719361033a128ff357492ec46aaccb48
diff --git a/mbtk/mbtk_gnssd/gnss_hd8122.c b/mbtk/mbtk_gnssd/gnss_hd8122.c
index ec7b515..5a328de 100755
--- a/mbtk/mbtk_gnssd/gnss_hd8122.c
+++ b/mbtk/mbtk_gnssd/gnss_hd8122.c
@@ -360,6 +360,26 @@
return GNSS_ERR_OK;
}
+static gnss_err_enum gnss_8122_freqcfg(int fd, uint8 mode)
+{
+ uint8 buff[GNSS_PACK_BUFF_SIZE];
+ LOGD("FREQCFG");
+ uint8 data[20];
+ memset(data, 0x00, 20);
+ data[1] = mode;
+ data[2] = 0x66;
+ int len = pack_create(HD8122_ID_TYPE_CFG, HD8122_ID_CFG_PWRCTL, 20, data, buff, sizeof(buff));
+ if(len <= 0)
+ {
+ LOGE("pack_create() fail.");
+ return GNSS_ERR_ARG;
+ }
+ log_hex("PACK", buff, len);
+ gnss_write(fd, buff, len);
+ msg_insert(HD8122_ID_TYPE_CFG, HD8122_ID_CFG_PWRCTL);
+ return GNSS_ERR_OK;
+}
+
static gnss_err_enum gnss_8122_msgcfg(int fd, uint8 type, uint8 id, uint8 period)
{
uint8 buff[GNSS_PACK_BUFF_SIZE];
@@ -571,6 +591,23 @@
}
should_wait_rsp = TRUE;
}
+ else if(memcmp(cmd, "$FREQCFG", 8) == 0) //$FREQCFG,<freq>
+ {
+ uint32 freq = 0;
+ freq = (uint32)atoi(cmd + 9);
+ LOGD("set freq: %d", freq);
+ if((GNSS_SET_FREQCFG_1 != freq) && (GNSS_SET_FREQCFG_2 != freq) && (GNSS_SET_FREQCFG_5 != freq))
+ {
+ gnss_set_result = GNSS_ERR_ARG;
+ goto set_fail;
+ }
+ gnss_set_result = gnss_8122_freqcfg(fd, (uint8)freq);
+ if(gnss_set_result != GNSS_ERR_OK)
+ {
+ goto set_fail;
+ }
+ should_wait_rsp = TRUE;
+ }
else if(memcmp(cmd, "$MSGCFG", 7) == 0) // $MSGCFG,<mode>,<rate>
{
uint32 mode;