Fix net state ind.
Change-Id: Ifecc16e565a5d8dabee58f2e131319514c09c522
diff --git a/mbtk/mbtk_ril/src/main.c b/mbtk/mbtk_ril/src/main.c
index abb575e..4ed52ce 100755
--- a/mbtk/mbtk_ril/src/main.c
+++ b/mbtk/mbtk_ril/src/main.c
@@ -389,7 +389,7 @@
{
}
-
+
data_pdp = data[1] + 200;
urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
}
@@ -412,9 +412,16 @@
char* tmp_s = s + 7;
while(*tmp_s && *tmp_s == ' ')
tmp_s++;
- uint8 data = (uint8)atoi(tmp_s); // Reg State.
+ uint8 data[2];
+ data[0] = (uint8)atoi(tmp_s); // Reg State.
- urc_msg_distribute(true, INFO_URC_MSG_NET_PS_REG_STATE, &data, sizeof(uint8));
+ if(strStartsWith(s, "+CGREG:")) {
+ data[1] = 0; // GMS/WCDMA
+ } else {
+ data[1] = 1; // LTE
+ }
+
+ urc_msg_distribute(true, INFO_URC_MSG_NET_PS_REG_STATE, data, sizeof(data));
}
// +CREG: 1, "8010", "000060a5", 0, 2, 0
// +CREG: 1, "8330", "06447347", 7, 2, 0
diff --git a/mbtk/mbtk_ril/src/mbtk_info_server.c b/mbtk/mbtk_ril/src/mbtk_info_server.c
index 2e06e3d..f731309 100755
--- a/mbtk/mbtk_ril/src/mbtk_info_server.c
+++ b/mbtk/mbtk_ril/src/mbtk_info_server.c
@@ -170,7 +170,7 @@
req->mode = 1;
req->oosPhase[0] = (uint8)tmp_str;
-
+
err = at_tok_nextstr(&line, &tmp_str);
if (err < 0)
{
@@ -4887,19 +4887,19 @@
int boot_conn = pack->data[3];
int timeout = pack->data[4];
data_call_bootconn_save(cid, boot_conn);
-
+
if(net_info.net_type != MBTK_RADIO_TECH_E_UTRAN)
{
err = MBTK_INFO_ERR_NET_NO_INIT;
break;
}
-
+
if(cid_active[cid] == 1)
{
err = MBTK_INFO_ERR_CID_EXIST;
break;
}
-
+
data_call_reconn:
//mbtk wyq for data_call_ex add end
cgact_wait.waitting = true;
@@ -5074,7 +5074,7 @@
char dev[20] = {0};
uint8 pdp_data = cid + 100;
pack_rsp_send(cli_info->fd , MBTK_INFO_ID_IND_PDP_STATE_CHANGE, &pdp_data, sizeof(uint8));
-
+
sprintf(dev, "ccinet%d", cid - 1);
// Config network.
@@ -5256,7 +5256,7 @@
pack_rsp_send(cli_info->fd, MBTK_INFO_ID_OOS_STA_RSP, &oos_t, sizeof(mbtk_oos_info));
}
}
- else // Set OOS
+ else // Set OOS
{
char* state = pack->data;
if(req_oos_set(state, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
@@ -5659,7 +5659,7 @@
int i = 0;
int send_sum = 0;
int bootconn = 0;
-
+
while(1)
{
if(server_ready_get() && send_sum == 0)
@@ -5667,13 +5667,13 @@
server_state_send();
send_sum = 1;
}
-
+
if(net_info.sim_state == MBTK_SIM_READY && net_info.net_type == MBTK_RADIO_TECH_E_UTRAN && bootconn == 0)
{
//data_call_bootconn_exec();
property_get("persist.mbtk.datacall.bootconn", cid_bootconn, "00000000");
LOG("data_call_bootconn_exec cid_bootconn = %s", cid_bootconn);
-
+
for(i = MBTK_APN_CID_MIN; i < MBTK_APN_CID_MAX + 1; i++)
{
if(cid_bootconn[i] == '1')
@@ -5686,7 +5686,7 @@
}
memset(info, 0, sizeof(sock_client_info_t));
info->fd = DATA_CALL_BOOTCONN_FD;
-
+
mbtk_info_pack_t* pack = mbtk_info_pack_creat(MBTK_INFO_ID_NET_DATA_CALL_REQ);
if(pack == NULL)
{
@@ -6057,9 +6057,10 @@
}
case INFO_URC_MSG_NET_PS_REG_STATE:
{
- uint8 net_data[3];
+ uint8 net_data[4];
net_data[0] = (uint8)MBTK_NET_PS_STATE;
- net_data[1] = data[0];
+ net_data[1] = data[0]; // act
+ net_data[3] = data[1]; // 0 - GSM/WCDMA; 1 - LTE
mbtk_net_reg_state_enum state = (mbtk_net_reg_state_enum)data[0];
if(state == MBTK_NET_REG_STATE_HOME
|| state == MBTK_NET_REG_STATE_ROAMING) { // Registered, home network or roaming.
diff --git a/mbtk/test/mbtk_info_test.c b/mbtk/test/mbtk_info_test.c
index 7be5f8f..0c60df3 100755
--- a/mbtk/test/mbtk_info_test.c
+++ b/mbtk/test/mbtk_info_test.c
@@ -21,7 +21,15 @@
void net_state_change_cb(const void* data, int data_len)
{
-
+ if(data && data_len > 0) {
+ const uint8 *ptr = (const uint8*)data;
+ if(*ptr == 0) { // CS
+ printf("CS:act=%d, mode=%d\n", *(ptr + 1), *(ptr + 2));
+ } else { // PS
+ printf("PS[%s]:act=%d, mode=%d\n", *(ptr + 3) == 0 ? "GSM/WCDMA" : "LTE", *(ptr + 1), *(ptr + 2));
+ }
+ } else
+ LOGD("NET_CB : NULL");
}
void call_state_change_cb(const void* data, int data_len)
@@ -242,7 +250,7 @@
//signal(SIGTSTP, sig_process);
//signal(SIGSEGV, sig_process);
- mbtk_log_init(NULL,"INFO_CLI");
+ mbtk_log_init("radio","INFO_CLI");
//test2(0, "192.168.1.198");
//test2(1, "2409:8162:140:cd3c:1:2:1494:72ba");