Fix SMS CMT for ril v2.
Change-Id: I95a289df6ab4d14dd23f3a7ebaa8183862d44de0
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index a17e3d7..438c748 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -78,6 +78,8 @@
ril_band_info_t band_info;
ril_info_t ril_info;
static mbtk_ril_call_state_info_t call_list[RIL_CALL_NUM_MAX];
+static bool cmt_found = FALSE;
+
extern mbtk_cell_pack_info_t cell_info;
extern ril_cgact_wait_t cgact_wait;
extern int ril_cid_start;
@@ -684,7 +686,29 @@
// 0891683108200855F6240D91688189911196F10000221130717445230331D90C
static void urc_sms_state_change_process(const char *s, const char *sms_pdu)
{
+ mbtk_ril_sms_state_info_t sms_info;
+ memset(&sms_info, 0, sizeof(mbtk_ril_sms_state_info_t));
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char *line = tmp_s;
+ char *tmp_str;
+ if (at_tok_start(&line) < 0)
+ {
+ goto CMT_EXIT;
+ }
+ if (at_tok_nextstr(&line, &tmp_str) < 0)
+ {
+ goto CMT_EXIT;
+ }
+ if (at_tok_nextstr(&line, &tmp_str) < 0)
+ {
+ goto CMT_EXIT;
+ }
+ sms_info.pdu_len = (uint16)atoi(tmp_str);
+ memcpy(sms_info.pdu, sms_pdu, strlen(sms_pdu));
+ urc_msg_distribute(false, RIL_MSG_ID_IND_SMS_STATE_CHANGE, &sms_info, sizeof(mbtk_ril_sms_state_info_t));
+CMT_EXIT:
+ free(tmp_s);
}
// +CREG: 1, "8010", "000060a5", 0, 2, 0
@@ -1697,8 +1721,13 @@
{
LOGV("URC : %s", s);
// MBTK_AT_READY
- if (strStartsWith(s, "MBTK_AT_READY")) // AT ready.
- {
+ // +CMT: ,23
+ // 0891683108200855F6240D91688189911196F10000221130717445230331D90C
+ // Get PDU data.
+ if(cmt_found) {
+ cmt_found = FALSE;
+ urc_sms_state_change_process(s, sms_pdu);
+ } else if (strStartsWith(s, "MBTK_AT_READY")) { // AT ready.
} else if(strStartsWith(s, "CONNECT") || strStartsWith(s, "+CGEV:")) {
urc_pdp_state_change_process(s, sms_pdu);
@@ -1754,6 +1783,7 @@
}
else if(strStartsWith(s, "+CMT:"))
{
+ cmt_found = TRUE;
urc_sms_state_change_process(s, sms_pdu);
}
else if(strStartsWith(s, "*ECALLDATA:"))
@@ -2540,7 +2570,7 @@
band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
} else {
band_info.band_area = info_modem.band_area;
-#ifdef MBTK_DEV_INFO_VERSION_2
+#ifdef MBTK_DEV_INFO_VERSION_2
if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
band_info.band_support.net_pref = info_modem.net_pref;
} else {