Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/mbtk_gnssd/gnss_hd8122.c b/mbtk/mbtk_gnssd/gnss_hd8122.c
index e61bfe6..531bbcc 100755
--- a/mbtk/mbtk_gnssd/gnss_hd8122.c
+++ b/mbtk/mbtk_gnssd/gnss_hd8122.c
@@ -29,6 +29,9 @@
#include "hd8122_dl/hd8040_upgrade.h"
#include "agps/agnss_http_download.h"
#include "agps/8122_agnss.h"
+#include "mbtk_utils.h"
+// #include "hd8122_dl/port.h"
+
#define UART_BITRATE_NMEA_DEF_FW 115200 // Default bitrate.
#define GNSS_POWER_GPIO 43
@@ -64,7 +67,7 @@
static int gnss_cmd_rsp_len = 0;
int gnss_write(int fd, const void *data, int data_len);
-int OpenUart(char* UART_DEV);
+int OpenUart(const char* UART_DEV);
int uart_close(int fd);
int fw_update_boot(int uart_fd, uint8_t *data, uint32_t len);
@@ -150,6 +153,7 @@
}
}
+#if 0
static int msg_remove(uint8 gid, uint8 sid)
{
int i = msg_find(gid, sid);
@@ -165,6 +169,7 @@
return -1;
}
}
+#endif
static int msg_count()
{
@@ -382,7 +387,7 @@
static void gnss_cmd_rsp_process(const void *data, int data_len)
{
- const char *ptr = (const char*)data;
+// const char *ptr = (const char*)data;
log_hex("RSP", data, data_len);
hd8122_id_ack_enum ack_nak = HD8122_ID_ACK_ACK;
@@ -406,7 +411,7 @@
pthread_mutex_unlock(&read_mutex);
setting_waitting = FALSE;
}
-
+
}
else
{
@@ -557,7 +562,7 @@
return GNSS_ERR_OK;
}
-
+#if 0
static gnss_err_enum gnss_8122_nmeaver(int fd, uint8 ver)
{
uint8 buff[GNSS_PACK_BUFF_SIZE];
@@ -572,18 +577,19 @@
gnss_write(fd, buff, len);
return GNSS_ERR_OK;
}
+#endif
int gnss_8122_dev_open()
{
//return mbtk_gpio_value_set(GNSS_POWER_GPIO, MBTK_GPIO_DIRECT_OUT, 1);
- system("i2cset -y -f 2 0x31 0x15 0x86");
+ mbtk_system("i2cset -y -f 2 0x31 0x15 0x86");
return 0;
}
int gnss_8122_dev_close(int fd)
{
//return mbtk_gpio_value_set(GNSS_POWER_GPIO, MBTK_GPIO_DIRECT_OUT, 0);
- system("i2cset -y -f 2 0x31 0x15 0x00");
+ mbtk_system("i2cset -y -f 2 0x31 0x15 0x00");
return 0;
}
@@ -649,7 +655,7 @@
LOGE("gnss_fwdl_enable fail");
goto error;
}
-
+
int ret = fw_update_boot(uart_fd, g_bin_buff, len);
if (ret < 0)
{
@@ -665,7 +671,7 @@
LOGD("upgrade FAIL, fail style:%d", ret);
goto error;
}
-
+
if(gnss_8122_dev_close(0))
{
LOGE("close gnss device fail:%d", errno);
@@ -700,32 +706,32 @@
int eph_type = 0;
int alam_flag = 0;
int ret = -1;
- char url[256] = {0};
+ char url[1024] = {0};
if(2 == sscanf(param, "%d,%d", &eph_type, &alam_flag))
{
if((gnss_eph_data_enum)eph_type == GNSS_EPH_GPS)
{
- snprintf(url, 256,AGNSS_URL, AGNSS_EPH_GPS);
+ snprintf(url, sizeof(url),AGNSS_URL, AGNSS_EPH_GPS);
}
else if((gnss_eph_data_enum)eph_type == GNSS_EPH_BDS)
{
- snprintf(url, 256,AGNSS_URL, AGNSS_EPH_BDS);
+ snprintf(url, sizeof(url),AGNSS_URL, AGNSS_EPH_BDS);
}
else if((gnss_eph_data_enum)eph_type == GNSS_EPH_GLO)
{
- snprintf(url, 256,AGNSS_URL, AGNSS_EPH_GLO);
+ snprintf(url, sizeof(url),AGNSS_URL, AGNSS_EPH_GLO);
}
else if((gnss_eph_data_enum)eph_type == GNSS_EPH_GPS_BDS)
{
- snprintf(url, 256,AGNSS_URL, AGNSS_EPH_GPS_BDS);
+ snprintf(url, sizeof(url),AGNSS_URL, AGNSS_EPH_GPS_BDS);
}
else if((gnss_eph_data_enum)eph_type == GNSS_EPH_GPS_GLO)
{
- snprintf(url, 256,AGNSS_URL, AGNSS_EPH_GPS_GLO);
+ snprintf(url, sizeof(url),AGNSS_URL, AGNSS_EPH_GPS_GLO);
}
else if((gnss_eph_data_enum)eph_type == GNSS_EPH_CFG)
{
- snprintf(url, 256,"%s?compid=%s&token=%s", strlen(agps_info.host) > 0 ? agps_info.host : "http://uagnss.allystar.com:80/ephemeris/HD_GPS.hdb",
+ snprintf(url, sizeof(url),"%s?compid=%s&token=%s", strlen(agps_info.host) > 0 ? agps_info.host : "http://uagnss.allystar.com:80/ephemeris/HD_GPS.hdb",
strlen(agps_info.id) > 0 ? agps_info.id : "yikecs1",
strlen(agps_info.passwd) > 0 ? agps_info.passwd : "Z38w5urAuawubTxi");
}
@@ -767,7 +773,7 @@
void gnss_8122_set_cb(const void *data, int data_len)
{
- const char *buff = (const char*)data;
+// const char *buff = (const char*)data;
if(setting_busy) // Has setting cmd process.
{
gnss_cmd_rsp_process(data, data_len);
@@ -1098,12 +1104,12 @@
0x00, 0x00, 0x00, 0x00, 0x30, 0x62, 0x9F, 0x37,
0x28, 0x29, 0x30, 0xB8, 0xBD, 0x37, 0x06, 0x36,
0x00, 0x00, 0x00, 0x00};
-
+
if(2 == sscanf(cmd, "$PZ90CONV,%d,%d", &local, &ref))
{
LOGD("set pz90conv: %d, %d", local, ref);
-
+
if(local == 1 && ref == 0) //PZ90
{
//
@@ -1168,7 +1174,7 @@
goto set_fail;
}
- set_success:
+// set_success:
if(should_wait_rsp)
{
setting_waitting = TRUE;