[Bugfix][T108-GSW][bug-view-1671] gsw get signal, no sinr
Only Configure: No
Affected branch: unknown
Affected module: network
Is it affected on both ZXIC and ASR: only ASR
Self-test: yes
Doc Update: no
Change-Id: Ic2abd478a26300d86b648adef8c922c7da94e3d2
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 3ebaf1a..14926fc 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -2852,27 +2852,27 @@
printf("cmgl:%s\n", cmgl);
ATResponse *response = NULL;
char cmd[500] = {0};
- char data[218] = {0};
+ char data[218] = {0};
int err = 0;
- memcpy(data, cmgl, len);
+ memcpy(data, cmgl, len);
- sprintf(cmd, "at*cell=%s", data);
- printf("cmd:%s\n", cmd);
+ sprintf(cmd, "at*cell=%s", data);
+ printf("cmd:%s\n", cmd);
- if(strlen(cmd) > 0)
- {
+ if(strlen(cmd) > 0)
+ {
err = at_send_command_multiline(cmd, "", &response);
- if (err < 0 || response->success == 0 || !response->p_intermediates){
- *cme_err = at_get_cme_error(response);
+ if (err < 0 || response->success == 0 || !response->p_intermediates){
+ *cme_err = at_get_cme_error(response);
// printf("at_send_command_multiline() is err-----------------\n");
- goto exit;
- }
+ goto exit;
+ }
ATLine* lines_ptr = response->p_intermediates;
char *line = NULL;
// int reg_len = 0;
-// bool flag = false;
+// bool flag = false;
while(lines_ptr)
{
line = lines_ptr->line;
@@ -2884,9 +2884,9 @@
lines_ptr = lines_ptr->p_next;
}
- }
+ }
err = 0;
- memcpy(reg, "req_cell_info_set succss", strlen("req_cell_info_set succss"));
+ memcpy(reg, "req_cell_info_set succss", strlen("req_cell_info_set succss"));
exit:
at_response_free(response);
printf("req_cell_info_set()-----------------end\n");
@@ -2918,6 +2918,7 @@
int tmp_int;
char *tmp_ptr = NULL;
// AT+EEMOPT=1 in the first.
+#if 0
int err = at_send_command_singleline("AT+CSQ", "+CSQ:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err != NULL)
@@ -2939,8 +2940,8 @@
}
signal->rssi = (uint8)tmp_int;
at_response_free(response);
-
- err = at_send_command_singleline("AT+CESQ", "+CESQ:", &response);
+#endif
+ int err = at_send_command_singleline("AT*CESQ", "*CESQ:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
if(cme_err != NULL)
*cme_err = at_get_cme_error(response);
@@ -2948,7 +2949,7 @@
goto exit;
}
- line = response->p_intermediates->line;
+ char* line = response->p_intermediates->line;
err = at_tok_start(&line);
if (err < 0)
{
@@ -2996,6 +2997,14 @@
}
signal->rsrp = (uint8)tmp_int;
+
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ signal->sinr = (int8)tmp_int;
+
at_response_free(response);
err = at_send_command_singleline("AT+COPS?", "+COPS:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -5191,30 +5200,30 @@
}
else // Lock cell
{
- char *mem = (char*)(pack->data);
- int len = pack->data_len;
- char reg[100] = {0};
- printf("mem:%s, len:%d", pack->data, pack->data_len);
+ char *mem = (char*)(pack->data);
+ int len = pack->data_len;
+ char reg[100] = {0};
+ printf("mem:%s, len:%d", pack->data, pack->data_len);
- if(req_cell_info_set(mem, reg, len, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
- {
- // printf("cpms_set fail\n");
- if(cme_err != MBTK_INFO_ERR_CME_NON) {
- err = MBTK_INFO_ERR_CME + cme_err;
- } else {
- err = MBTK_INFO_ERR_UNKNOWN;
- }
- // LOG("Set req_cell_info_set fail.");
- }
- else
- {
+ if(req_cell_info_set(mem, reg, len, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
+ {
+ // printf("cpms_set fail\n");
+ if(cme_err != MBTK_INFO_ERR_CME_NON) {
+ err = MBTK_INFO_ERR_CME + cme_err;
+ } else {
+ err = MBTK_INFO_ERR_UNKNOWN;
+ }
+ // LOG("Set req_cell_info_set fail.");
+ }
+ else
+ {
- printf("req_cell_info_set success, reg:%s\n", reg);
- pack_rsp_send(cli_info->fd, MBTK_INFO_ID_NET_CELL_RSP, reg, strlen(reg));
+ printf("req_cell_info_set success, reg:%s\n", reg);
+ pack_rsp_send(cli_info->fd, MBTK_INFO_ID_NET_CELL_RSP, reg, strlen(reg));
- // Restart is required to take effect.
- LOG("Will reboot system...");
- }
+ // Restart is required to take effect.
+ LOG("Will reboot system...");
+ }
}
break;
}
@@ -5714,18 +5723,18 @@
mbtk_net_led_set(MBTK_NET_LED_DATA_CONNECT);
pack_rsp_send(cli_info->fd, MBTK_INFO_ID_NET_DATA_CALL_RSP, NULL, 0);
#ifdef MBTK_ALL_CID_SUPPORT
- if(cid == 1) //cid 1 as a special treatment
- {
- mbtk_pdp_cb_info_s pdp_cb_info;
- memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
- pdp_cb_info.cid = cid;
- pdp_cb_info.auto_urc = false;
- pdp_cb_info.connect_state = true;
- memcpy(&(pdp_cb_info.ipv4), &ipv4, sizeof(mbtk_ipv4_info_t));
- memcpy(&(pdp_cb_info.ipv6), &ipv6, sizeof(mbtk_ipv6_info_t));
- usleep(1000);
- pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
- }
+ if(cid == 1) //cid 1 as a special treatment
+ {
+ mbtk_pdp_cb_info_s pdp_cb_info;
+ memset(&pdp_cb_info, 0x00, sizeof(mbtk_pdp_cb_info_s));
+ pdp_cb_info.cid = cid;
+ pdp_cb_info.auto_urc = false;
+ pdp_cb_info.connect_state = true;
+ memcpy(&(pdp_cb_info.ipv4), &ipv4, sizeof(mbtk_ipv4_info_t));
+ memcpy(&(pdp_cb_info.ipv6), &ipv6, sizeof(mbtk_ipv6_info_t));
+ usleep(1000);
+ pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_cb_info, sizeof(mbtk_pdp_cb_info_s));
+ }
#endif
}
else
@@ -6085,7 +6094,7 @@
}
break;
}
- case MBTK_INFO_ID_LED_REQ:
+ case MBTK_INFO_ID_LED_REQ:
{
if(pack->data_len == 0 || pack->data == NULL)
{
@@ -7060,7 +7069,7 @@
{
// Get network state and signal.
char buff[256] = {0};
- uint8 data_signal[8];
+ uint8 data_signal[9];
mbtk_signal_info_t signal;
memset(&signal, 0xFF, sizeof(mbtk_signal_info_t));
if(!req_net_signal_get(&signal, NULL)) {
@@ -7069,24 +7078,24 @@
gettimeofday(&log_time, NULL);
struct tm* tm_t = localtime(&(log_time.tv_sec));
strftime(tmp, 50, "%F %T", tm_t);
- snprintf(buff, sizeof(buff), "%s:%d,%d,%d,%d,%d,%d,%d,%d", tmp, signal.type, signal.rssi, signal.rxlev, signal.ber, signal.rscp, signal.ecno,
- signal.rsrq, signal.rsrp);
+ snprintf(buff, sizeof(buff), "%s:%d,%d,%d,%d,%d,%d,%d,%d,%d", tmp, signal.type, signal.rssi, signal.rxlev, signal.ber, signal.rscp, signal.ecno,
+ signal.rsrq, signal.rsrp,signal.sinr);
mbtk_signal_log(buff);
- }
-
- if(signal_globe.type != signal.type)
- {
- data_signal[0] = signal.type;
- data_signal[1] = signal.rssi;
- data_signal[2] = signal.rxlev;
- data_signal[3] = signal.ber;
- data_signal[4] = signal.rscp;
- data_signal[5] = signal.ecno;
- data_signal[6] = signal.rsrq;
- data_signal[7] = signal.rsrp;
- signal_globe.type = signal.type;
- signal_state_change(data_signal, sizeof(data_signal));
- }
+ if(signal_globe.type != signal.type)
+ {
+ data_signal[0] = signal.type;
+ data_signal[1] = signal.rssi;
+ data_signal[2] = signal.rxlev;
+ data_signal[3] = signal.ber;
+ data_signal[4] = signal.rscp;
+ data_signal[5] = signal.ecno;
+ data_signal[6] = signal.rsrq;
+ data_signal[7] = signal.rsrp;
+ data_signal[8] = signal.sinr;
+ signal_globe.type = signal.type;
+ signal_state_change(data_signal, sizeof(data_signal));
+ }
+ }
break;
}
case INFO_URC_MSG_CALL_STATE:
@@ -7267,24 +7276,24 @@
static int partition_name_2_dev(const char *name, char *dev) {
if(name == NULL || dev == NULL) {
LOGE("ARG error.");
- return -1;
+ return -1;
}
FILE* fp = fopen("/proc/mtd", "r");
- if (fp == NULL) {
- LOGE("Open MTD failed!");
- return -1;
- }
+ if (fp == NULL) {
+ LOGE("Open MTD failed!");
+ return -1;
+ }
char buf[1024];
- while (fgets(buf, 1024, fp) != NULL) {
- if(strstr(buf, name)) {
+ while (fgets(buf, 1024, fp) != NULL) {
+ if(strstr(buf, name)) {
int index = atoi(buf + 3);
sprintf(dev, "/dev/mtdblock%d", index);
LOGD("%s -> %s", name, dev);
return 0;
- }
- }
+ }
+ }
return -1;
}