Enable TON/NPI with Get SCA 40/19940/1
authorDongchul Lim <dc7.lim@samsung.com>
Wed, 23 Apr 2014 07:44:00 +0000 (16:44 +0900)
committerDongchul Lim <dc7.lim@samsung.com>
Wed, 23 Apr 2014 08:45:58 +0000 (17:45 +0900)
Change-Id: Ib3fa950e1af0762a623e87ea5aae80a4944cbfa7

src/imc_sms.c

index 0d91cf1..005f08f 100644 (file)
@@ -994,6 +994,7 @@ static void on_response_imc_sms_get_sca(TcorePending *p,
                        GSList *tokens = NULL;
                        const char *sca_tok_addr;
                        gchar *line = NULL, *sca_addr = NULL, *sca_toa = NULL;
+                       gint hexa_toa = 0;
 
                        line = (char *)at_resp->lines->data;
                        tokens = tcore_at_tok_new(line);
@@ -1005,14 +1006,10 @@ static void on_response_imc_sms_get_sca(TcorePending *p,
                        if ((NULL != sca_addr) && (NULL != sca_toa)) {
                                memcpy(sca_resp.number, sca_addr, strlen(sca_addr));
 
-                               /* Type-of-Address */
-                               if (145 == atoi(sca_toa)) {
-                                       sca_resp.ton = IMC_SIM_TON_INTERNATIONAL;
-                               }
-                               else {
-                                       sca_resp.ton = IMC_SIM_TON_NATIONAL;
-                               }
-                               sca_resp.npi = 0;/* TODO */
+                               hexa_toa = atoi(sca_toa);
+                               dbg("SCA-TOA: [0x%x]", hexa_toa);
+                               sca_resp.npi = hexa_toa & 0x0F;
+                               sca_resp.ton = (hexa_toa & 0x70) >> 4;
                                result = TEL_SMS_RESULT_SUCCESS;
                        }
                        else {