Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 27d08d4..f935a65 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <signal.h>
#include <cutils/properties.h>
+#include <sys/time.h>
#include "mbtk_type.h"
#include "mbtk_info.h"
@@ -38,9 +39,9 @@
static mbtk_queue_node_t info_queue;
static pthread_cond_t info_cond;
static pthread_mutex_t info_mutex;
-static mbtk_queue_node_t urc_queue;
-static pthread_cond_t urc_cond;
-static pthread_mutex_t urc_mutex;
+//static mbtk_queue_node_t urc_queue;
+//static pthread_cond_t urc_cond;
+//static pthread_mutex_t urc_mutex;
static band_set_info_t band_set_info;
static bool band_set_success = FALSE;
static mbtk_modem_band_area_enum band_area;
@@ -66,6 +67,9 @@
static mbtk_signal_info_t signal_globe;
mbtk_info_err_enum ecall_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
+void apn_prop_get();
+int mbtk_signal_log(char *data);
+
/*
AT*POWERIND=0"
@@ -130,6 +134,7 @@
{
ATResponse *response = NULL;
char cmd[100] = {0};
+ int err = 0;
if ((state->mode == 1 && state->oosPhase[0] == 0 && state->oosPhase[1] == 0 && state->oosPhase[2] == 0) \
|| state->mode == 0)
@@ -158,7 +163,7 @@
}
LOG("Set the oos command is = [%s]\n", cmd);
- int err = at_send_command(cmd, &response);
+ err = at_send_command(cmd, &response);
if (err < 0 || response->success == 0){
*cme_err = at_get_cme_error(response);
goto exit;
@@ -289,7 +294,7 @@
{
//mbtk_info_pack_data_set(pack, data, data_len);
pack->data_len = (uint16)data_len;
- pack->data = (const uint8*)data;
+ pack->data = (uint8*)data;
}
mbtk_info_pack_send(fd, pack);
mbtk_info_pack_free(&pack);
@@ -303,12 +308,12 @@
static int apn_prop_set(mbtk_apn_info_t *apn)
{
char prop_name[20] = {0};
- char prop_data[300] = {0};
+ char prop_data[1024] = {0};
sprintf(prop_name, "%s_%d",MBTK_APN_PROP,apn->cid);
- snprintf(prop_data, 300, "%d,%s,%s,%s,%s", apn->ip_type, apn->apn,
- str_empty(apn->user) ? "NULL" : apn->user,
- str_empty(apn->pass) ? "NULL" : apn->pass,
- str_empty(apn->auth) ? "NULL" : apn->auth);
+ snprintf(prop_data, sizeof(prop_data), "%d,%s,%s,%s,%s", apn->ip_type, apn->apn,
+ str_empty(apn->user) ? "NULL" : (char*)apn->user,
+ str_empty(apn->pass) ? "NULL" : (char*)apn->pass,
+ str_empty(apn->auth) ? "NULL" : (char*)apn->auth);
return property_set(prop_name, prop_data);
}
@@ -394,6 +399,7 @@
#endif
}
+#if 0
static int parseRegistrationState(char *str, int *items, int **response)
{
int err;
@@ -518,7 +524,7 @@
free(resp);
return -1;
}
-
+#endif
/*
0: minimum functionality
1: full functionality
@@ -586,7 +592,7 @@
break;
case CME_SIM_NOT_INSERTED:
- case 13: //sim fail,as "sim absent"
+ case CME_SIM_ABSENT: //sim fail,as "sim absent"
ret = MBTK_SIM_ABSENT;
goto done;
@@ -709,7 +715,7 @@
memcpy(apn_name, ptr_1, ptr_2 - ptr_1); // apn
// Check ip_type and apn_name
- if(ip_type != apn->ip_type || strcmp(apn_name, apn->apn)) {
+ if(ip_type != apn->ip_type || strcmp(apn_name, (char*)apn->apn)) {
LOGD("APN Changed, not get user/pass/auth.");
return -1;
}
@@ -752,7 +758,7 @@
static int req_plmn_get(mbtk_plmn_info *type, int *cme_err)
{
ATResponse *response = NULL;
- char *tmp_ptr = NULL;
+// char *tmp_ptr = NULL;
int err = at_send_command_multiline("AT+CPOL?", "+CPOL:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -815,7 +821,7 @@
static int req_sim_card_type_get(uint8 *type, int *cme_err)
{
ATResponse *response = NULL;
- char *tmp_ptr = NULL;
+// char *tmp_ptr = NULL;
int err = at_send_command_singleline("AT*EUICC?", "*EUICC:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -852,7 +858,8 @@
static int req_pin_puk_last_times_get(mbtk_pin_puk_last_times *times, int *cme_err)
{
ATResponse *response = NULL;
- char *tmp_ptr = NULL;
+// char *tmp_ptr = NULL;
+ int tmp_int;
int err = at_send_command_singleline("AT+EPIN?", "+EPIN:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -867,29 +874,33 @@
goto exit;
}
mbtk_pin_puk_last_times last_times={0};
- err = at_tok_nextint(&line, &(last_times.p1_retry));
+ err = at_tok_nextint(&line, &tmp_int);
if (err < 0)
{
goto exit;
}
+ last_times.p1_retry = (uint8_t)tmp_int;
times->p1_retry = last_times.p1_retry;
- err = at_tok_nextint(&line, &(last_times.p2_retry));
+ err = at_tok_nextint(&line, &tmp_int);
if (err < 0)
{
goto exit;
}
+ last_times.p2_retry = (uint8_t)tmp_int;
times->p2_retry = last_times.p2_retry;
- err = at_tok_nextint(&line, &(last_times.puk1_retry));
+ err = at_tok_nextint(&line, &tmp_int);
if (err < 0)
{
goto exit;
}
+ last_times.puk1_retry = (uint8_t)tmp_int;
times->puk1_retry = last_times.puk1_retry;
- err = at_tok_nextint(&line, &(last_times.puk2_retry));
+ err = at_tok_nextint(&line, &tmp_int);
if (err < 0)
{
goto exit;
}
+ last_times.puk2_retry = (uint8_t)tmp_int;
times->puk2_retry = last_times.puk2_retry;
exit:
@@ -1139,7 +1150,7 @@
static int req_time_set(int type, char *time, int *cme_err)
{
ATResponse *response = NULL;
- int tmp_int;
+// int tmp_int;
char cmd[200] = {0};
if(str_empty(time)){
sprintf(cmd, "AT+SYSTIME=%d", type);
@@ -1343,7 +1354,7 @@
static int req_volte_get(int *state, int *cme_err)
{
ATResponse *response = NULL;
- char *tmp_ptr = NULL;
+// char *tmp_ptr = NULL;
int err = at_send_command_singleline("AT+ACONFIG?", "", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -1859,10 +1870,10 @@
OK
*/
-static int req_get_pin_state(mbtk_enable_pin_info *state, int *cme_err)
+static int req_get_pin_state(mbtk_pin_state_enum *state, int *cme_err)
{
ATResponse *response = NULL;
- char cmd[64]={0};
+// char cmd[64]={0};
int err = at_send_command_singleline("AT+CLCK=SC,2", "+CLCK:", &response);
if (err < 0 || response == NULL || response->success == 0 || !response->p_intermediates)
@@ -1898,11 +1909,11 @@
if(clck == 1)
{
- state = MBTK_PIN_ENABLE;
+ *state = MBTK_PIN_ENABLE;
}
else
{
- state = MBTK_PIN_DISABLE;
+ *state = MBTK_PIN_DISABLE;
}
exit:
at_response_free(response);
@@ -2213,8 +2224,8 @@
static int req_available_net_get(void* buff, int *cme_err)
{
ATResponse *response = NULL;
- char *tmp_ptr = NULL;
- int tmp_int;
+// char *tmp_ptr = NULL;
+// int tmp_int;
int buff_size = 0;
int err = at_send_command_singleline("AT+COPS=?", "+COPS:", &response);
@@ -2728,7 +2739,7 @@
printf("req_cmgl_set(2)-----------------start\n");
printf("cmgl:%s\n", cmgl);
ATResponse *response = NULL;
- char cmd[30] = {0};
+ char cmd[500] = {0};
char data[218] = {0};
int err = 0;
@@ -2748,8 +2759,8 @@
ATLine* lines_ptr = response->p_intermediates;
char *line = NULL;
- int reg_len = 0;
- bool flag = false;
+// int reg_len = 0;
+// bool flag = false;
while(lines_ptr)
{
line = lines_ptr->line;
@@ -3116,9 +3127,9 @@
static int net_ims_get(int *reg, int *cme_err)
{
ATResponse *response = NULL;
- int tmp_int, tmp_reg = 0;
+ int tmp_reg = 0;
int err;
- char *tmp_str = NULL;
+// char *tmp_str = NULL;
err = at_send_command_singleline("AT+ACONFIG?", "", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -3146,7 +3157,7 @@
ATResponse *response = NULL;
int tmp_int, tmp_reg = -1;
int err;
- char *tmp_str = NULL;
+// char *tmp_str = NULL;
err = at_send_command_multiline("AT+CIREG?", "+CIREG:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -3301,10 +3312,10 @@
uint16_2_byte((uint16)0, data_ptr, false);
data_ptr += sizeof(uint16);
} else {
- uint16_2_byte((uint16)strlen(apn.user), data_ptr, false);
+ uint16_2_byte((uint16)strlen((char*)apn.user), data_ptr, false);
data_ptr += sizeof(uint16);
- memcpy(data_ptr, apn.user, strlen(apn.user));
- data_ptr += strlen(apn.user);
+ memcpy(data_ptr, apn.user, strlen((char*)apn.user));
+ data_ptr += strlen((char*)apn.user);
}
// pass
@@ -3312,10 +3323,10 @@
uint16_2_byte((uint16)0, data_ptr, false);
data_ptr += sizeof(uint16);
} else {
- uint16_2_byte((uint16)strlen(apn.pass), data_ptr, false);
+ uint16_2_byte((uint16)strlen((char*)apn.pass), data_ptr, false);
data_ptr += sizeof(uint16);
- memcpy(data_ptr, apn.pass, strlen(apn.pass));
- data_ptr += strlen(apn.pass);
+ memcpy(data_ptr, apn.pass, strlen((char*)apn.pass));
+ data_ptr += strlen((char*)apn.pass);
}
// auth
@@ -3323,10 +3334,10 @@
uint16_2_byte((uint16)0, data_ptr, false);
data_ptr += sizeof(uint16);
} else {
- uint16_2_byte((uint16)strlen(apn.auth), data_ptr, false);
+ uint16_2_byte((uint16)strlen((char*)apn.auth), data_ptr, false);
data_ptr += sizeof(uint16);
- memcpy(data_ptr, apn.auth, strlen(apn.auth));
- data_ptr += strlen(apn.auth);
+ memcpy(data_ptr, apn.auth, strlen((char*)apn.auth));
+ data_ptr += strlen((char*)apn.auth);
}
}
@@ -3565,7 +3576,7 @@
break;
}
}
- if(strlen(apn->apn) > 0) {
+ if(strlen((char*)apn->apn) > 0) {
index += sprintf(cmd + index,"\"%s\"", apn->apn);
}
@@ -3582,11 +3593,11 @@
memset(cmd,0,400);
int cmd_auth=0;
- if(strstr(apn->auth,"NONE"))
+ if(strstr((char*)apn->auth,"NONE"))
cmd_auth = 0;
- else if(strstr(apn->auth,"PAP"))
+ else if(strstr((char*)apn->auth,"PAP"))
cmd_auth = 1;
- else if(strstr(apn->auth,"CHAP"))
+ else if(strstr((char*)apn->auth,"CHAP"))
cmd_auth = 2;
#if 0
else if(strstr(apn->auth,"PAP AND CHAP"))
@@ -3644,6 +3655,7 @@
}
}
+#if 0
/*
AT+CGDATA="",6
CONNECT
@@ -3659,7 +3671,7 @@
{
ATResponse *response = NULL;
char cmd[400] = {0};
- int index = 0;
+// int index = 0;
int err = 0;
err = at_send_command_singleline("AT+COPS?", "+COPS:", &response);
@@ -3671,7 +3683,7 @@
}
int tmp_int;
- char cmd_buf[64];
+ char *cmd_buf = NULL;
char *line = response->p_intermediates->line;
err = at_tok_start(&line);
if (err < 0)
@@ -3703,7 +3715,7 @@
if(tmp_int == 7 && cid == 1) //LTE && cid = 1
{
ATResponse *response = NULL;
- char cmd[400] = {0};
+// char cmd[400] = {0};
int err = 0;
err = at_send_command("AT+CFUN=1", &response);
@@ -3717,7 +3729,8 @@
else
{
ATResponse *response = NULL;
- char cmd[400] = {0};
+// char cmd[400] = {0};
+ memset(cmd, 0, sizeof(cmd));
int err = 0;
sprintf(cmd, "AT+CGDATA=\"\",%d", cid);
err = at_send_command(cmd, &response);
@@ -3733,6 +3746,7 @@
at_response_free(response);
return err;
}
+#endif
/*
AT+CGACT?
@@ -4064,6 +4078,7 @@
return err;
}
+#if 0
/*
AT+CGCONTRDP
+CGCONTRDP: 1,5,"cmnet.MNC000.MCC460.GPRS","10.156.238.86","","223.87.253.100","223.87.253.253","","",0,0
@@ -4148,7 +4163,7 @@
goto exit;
}
- if(inet_ntop(AF_INET6, tmp_ipv6, apn->ipv6, 50) == NULL) {
+ if(inet_ntop(AF_INET6, tmp_ipv6, (char*)apn->ipv6, 50) == NULL) {
err = -1;
LOGE("inet_ntop ipv6 ip fail.");
goto exit;
@@ -4163,6 +4178,7 @@
at_response_free(response);
return err;
}
+#endif
mbtk_info_err_enum call_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
mbtk_info_err_enum sms_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
@@ -5187,8 +5203,8 @@
ptr += len;
}
- LOGD("APN : %d, %d, %s, %s, %s, %s", apn.cid, apn.ip_type, str_empty(apn.apn) ? "NULL" : apn.apn,
- str_empty(apn.user) ? "NULL" : apn.user, str_empty(apn.pass) ? "NULL" : apn.pass, str_empty(apn.auth) ? "NULL" : apn.auth);
+ LOGD("APN : %d, %d, %s, %s, %s, %s", apn.cid, apn.ip_type, str_empty(apn.apn) ? "NULL" : (char*)apn.apn,
+ str_empty(apn.user) ? "NULL" : (char*)apn.user, str_empty(apn.pass) ? "NULL" : (char*)apn.pass, str_empty(apn.auth) ? "NULL" : (char*)apn.auth);
if(req_apn_set(&apn, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
if(cme_err != MBTK_INFO_ERR_CME_NON) {
@@ -5237,7 +5253,7 @@
}
else
{
- const uint8* ptr = pack->data;
+// const uint8* ptr = pack->data;
mbtk_apn_info_t apn;
mbtk_apn_req_type_enum req_type = MBTK_APN_REQ_TYPE_SET;
uint8 apn_type[MBTK_QSER_APN_NAME_SIZE] = {0};
@@ -5801,7 +5817,6 @@
}
else // Set OOS
{
- mbtk_oos_info *state = (mbtk_oos_info *)pack->data;
if(pack->data_len != sizeof(mbtk_oos_info))
{
err = MBTK_INFO_ERR_REQ_PARAMETER;
@@ -5809,6 +5824,7 @@
break;
}
+ mbtk_oos_info *state = (mbtk_oos_info *)pack->data;
if(req_oos_set(state, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
{
if(cme_err != MBTK_INFO_ERR_CME_NON) {
@@ -5910,7 +5926,7 @@
return 0;
}
-static void radio_state_change(void *data, int data_len)
+static void radio_state_change(const void *data, int data_len)
{
uint8 *data_ptr = (uint8*)data;
if(data_ptr[0]) {
@@ -5936,7 +5952,7 @@
}
}
-static void pdp_state_change(void *data, int data_len)
+static void pdp_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -5954,7 +5970,7 @@
}
}
-static void net_state_change(void *data, int data_len)
+static void net_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -5973,7 +5989,7 @@
}
}
-static void call_state_change(void *data, int data_len)
+static void call_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -5992,7 +6008,7 @@
}
}
-static void sim_state_change(void *data, int data_len)
+static void sim_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -6011,7 +6027,7 @@
}
}
-static void sms_state_change(void *data, int data_len)
+static void sms_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -6030,7 +6046,7 @@
}
}
-static void signal_state_change(void *data, int data_len)
+static void signal_state_change(const void *data, int data_len)
{
sock_client_info_t *cli = NULL;
list_first(sock_client_list);
@@ -6050,7 +6066,7 @@
}
-int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, void *data, int data_len)
+int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, const void *data, int data_len)
{
#if 0
if(urc_queue.count >= PACK_PROCESS_QUEUE_MAX)
@@ -6309,7 +6325,7 @@
// "data_len"
pack->data_len = 5;
- char *p = (char *)malloc(5);
+ uint8 *p = (uint8 *)malloc(5);
p[0] = MBTK_DATA_CALL_START;
p[1] = i;
p[2] = 0;
@@ -6926,6 +6942,7 @@
}
}
+#if 0
/*
root@OpenWrt:/usrdata# cat /proc/mtd
dev: size erasesize name
@@ -6954,7 +6971,7 @@
return -1;
}
- int fp = fopen("/proc/mtd", "r");
+ FILE* fp = fopen("/proc/mtd", "r");
if (fp == NULL) {
LOGE("Open MTD failed!");
return -1;
@@ -6972,11 +6989,12 @@
return -1;
}
-
+#endif
+#if 0
static int custom_partition_read(const char *name, mbtk_cust_info_t *cust_info)
{
- int fd = 0, ret = 0;
- unsigned int step = 0, offset = 0, flaglen = 0;
+ int fd = 0;
+ unsigned int flaglen = 0;
flaglen = sizeof(mbtk_cust_info_t);
char mtd_path[50] = {0};
@@ -7012,6 +7030,7 @@
close(fd);
return -1;
}
+#endif
/*
AT*BAND=15,78,147,482,134742231
@@ -7067,11 +7086,12 @@
return NULL;
}
+#if 0
static void* net_monitor_thread(void* arg)
{
UNUSED(arg);
// Start network monitor
- int cid;
+// int cid;
while(1) {
#if 0
// Config IP
@@ -7157,7 +7177,9 @@
LOGD("monitor_thread exit.");
return NULL;
}
+#endif
+#if 0
static void* urc_process_thread(void* arg)
{
UNUSED(arg);
@@ -7215,6 +7237,7 @@
return NULL;
}
+#endif
static void ril_at_ready_process()
{
@@ -7232,7 +7255,7 @@
at_send_command("AT+CEREG=2", NULL);
}
- int count = 0;
+// int count = 0;
#endif
net_info.sim_state = getSIMStatus();
#if 0
@@ -7342,7 +7365,7 @@
goto error;
}
- pthread_t info_pid, pack_pid, monitor_pid, urc_pid, bootconn_pid;
+ pthread_t info_pid, pack_pid/*, monitor_pid, urc_pid*/, bootconn_pid;
pthread_attr_t thread_attr;
pthread_attr_init(&thread_attr);
if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))