2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "MsgCppTypes.h"
22 #include "MsgException.h"
23 #include "SmsPluginEventHandler.h"
24 #include "SmsPluginCbMsgHandler.h"
25 #include "SmsPluginConcatHandler.h"
26 #include "SmsPluginWapPushHandler.h"
27 #include "SmsPluginSatHandler.h"
28 #include "SmsPluginParamCodec.h"
29 #include "SmsPluginTpduCodec.h"
30 #include "SmsPluginTransport.h"
31 #include "SmsPluginSimMsg.h"
32 #include "SmsPluginSetting.h"
33 #include "MsgGconfWrapper.h"
34 #include "MsgDevicedWrapper.h"
35 #include "SmsPluginCallback.h"
36 #include "SmsPluginDSHandler.h"
38 extern bool isMemAvailable;
41 /*==================================================================================================
42 FUNCTION IMPLEMENTATION
43 ==================================================================================================*/
44 void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
46 MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
49 /* Call Event Handler */
50 SmsPluginEventHandler::instance()->setDeviceStatus(handle);
51 } catch (MsgException& e) {
52 MSG_FATAL("%s", e.what());
57 SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result)
59 SMS_NETWORK_STATUS_T sentStatus;
61 /* Convert TAPI status -> SMS network status */
62 switch ((TelSmsResponse_t)result) {
63 case TAPI_NETTEXT_SENDSMS_SUCCESS :
64 sentStatus = SMS_NETWORK_SEND_SUCCESS;
67 case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
68 sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
71 case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
72 case TAPI_NETTEXT_TEMPORARY_FAILURE :
73 case TAPI_NETTEXT_CONGESTION :
74 case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
75 case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
76 case TAPI_NETTEXT_NETWORK_OUTOFORDER:
77 sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
80 case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
81 sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
84 case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
85 case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
86 sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
88 case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
89 sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
92 sentStatus = SMS_NETWORK_SEND_FAIL;
99 void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_data)
101 MSG_DEBUG("TapiEventSentStatus is called. : result = [0x%x]", result);
103 SMS_NETWORK_STATUS_T sentStatus;
105 TelSatMoSmCtrlIndData_t *moCtrlStatus = (TelSatMoSmCtrlIndData_t *)user_data;
107 sentStatus = convertTapiRespToSmsPlugin(result);
109 if (moCtrlStatus && sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED) {
110 if (moCtrlStatus->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
111 sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD;
114 if (result != TAPI_NETTEXT_SENDSMS_SUCCESS)
115 MSG_INFO("sentStatus:[%d], tapi_result:[0x%x]", sentStatus, result);
117 MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
119 /* only temporary errors should be returned without calling handleSentStatus() in order to resend sms */
120 if (sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
121 sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD ||
122 sentStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
123 SmsPluginTransport::instance()->setNetStatus(sentStatus);
127 if (sentStatus == SMS_NETWORK_SEND_FAIL) {
129 tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
130 if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
131 sentStatus = SMS_NETWORK_SEND_PENDING;
134 /* Convert SMS status -> Messaging network status */
135 msg_network_status_t netStatus;
137 if (sentStatus == SMS_NETWORK_SEND_SUCCESS) {
138 netStatus = MSG_NETWORK_SEND_SUCCESS;
139 } else if (sentStatus == SMS_NETWORK_SENDING) {
140 netStatus = MSG_NETWORK_SENDING;
141 } else if (sentStatus == SMS_NETWORK_SEND_PENDING) {
142 netStatus = MSG_NETWORK_SEND_PENDING;
144 netStatus = MSG_NETWORK_SEND_FAIL;
148 SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
150 SmsPluginTransport::instance()->setNetStatus(sentStatus);
151 } catch (MsgException& e) {
152 MSG_FATAL("%s", e.what());
157 void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void *user_data)
159 MSG_INFO("TapiEventSatSmsSentStatus is called. : result = [%d]", result);
161 SMS_NETWORK_STATUS_T sentStatus;
163 sentStatus = convertTapiRespToSmsPlugin(result);
165 MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
167 if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE) {
169 tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
170 if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
171 sentStatus = SMS_NETWORK_SEND_PENDING;
175 SmsPluginSatHandler::instance()->ctrlSms(handle, sentStatus);
176 } catch (MsgException& e) {
177 MSG_FATAL("%s", e.what());
182 void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
184 MSG_SEC_DEBUG("TapiEventMsgIncoming is called. noti_id [%s]", noti_id);
187 MSG_ERR("Error. data is NULL.");
191 SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, NULL);
194 /* make a margin timeout(500ms) till suspending status */
197 TelSmsDatapackageInfo_t* pDataPackage = (TelSmsDatapackageInfo_t*)data;
200 memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
202 /* Decode Incoming Message */
203 SmsPluginTpduCodec::decodeTpdu(pDataPackage->szData, pDataPackage->MsgLength, &tpdu);
206 if (tpdu.tpduType == SMS_TPDU_DELIVER) {
207 MSG_DEBUG("############# SMS_TPDU_DELIVER Incoming decoded tpdu values ####################");
208 MSG_DEBUG("tpdu.data.deliver.bMoreMsg : %d", tpdu.data.deliver.bMoreMsg);
209 MSG_DEBUG("tpdu.data.deliver.bStatusReport : %d", tpdu.data.deliver.bStatusReport);
210 MSG_DEBUG("tpdu.data.deliver.bHeaderInd : %d", tpdu.data.deliver.bHeaderInd);
211 MSG_DEBUG("tpdu.data.deliver.bReplyPath : %d", tpdu.data.deliver.bReplyPath);
212 MSG_DEBUG("tpdu.data.deliver.pid : %d", tpdu.data.deliver.pid);
213 MSG_DEBUG("tpdu.data.deliver.dcs.bCompressed : %d", tpdu.data.deliver.dcs.bCompressed);
214 MSG_DEBUG("tpdu.data.deliver.dcs.msgClass : %d", tpdu.data.deliver.dcs.msgClass);
215 MSG_DEBUG("tpdu.data.deliver.dcs.codingScheme : %d", tpdu.data.deliver.dcs.codingScheme);
216 MSG_DEBUG("tpdu.data.deliver.dcs.codingGroup : %d", tpdu.data.deliver.dcs.codingGroup);
217 MSG_DEBUG("tpdu.data.deliver.dcs.bIndActive : %d", tpdu.data.deliver.dcs.bIndActive);
218 MSG_SEC_DEBUG("tpdu.data.deliver.originAddress.address : %s", tpdu.data.deliver.originAddress.address);
219 MSG_DEBUG("tpdu.data.deliver.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.deliver.timeStamp.time.absolute.year, tpdu.data.deliver.timeStamp.time.absolute.month, tpdu.data.deliver.timeStamp.time.absolute.day,
220 tpdu.data.deliver.timeStamp.time.absolute.hour, tpdu.data.deliver.timeStamp.time.absolute.minute, tpdu.data.deliver.timeStamp.time.absolute.second);
221 MSG_DEBUG("tpdu.data.deliver.userData.headerCnt : %d", tpdu.data.deliver.userData.headerCnt);
222 MSG_DEBUG("tpdu.data.deliver.userData.length : %d", tpdu.data.deliver.userData.length);
223 MSG_DEBUG("tpdu.data.deliver.userData.data : %s", tpdu.data.deliver.userData.data);
224 MSG_DEBUG("#####################################################");
225 } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
226 MSG_DEBUG("############# SMS_TPDU_STATUS_REP Incoming decoded tpdu values ####################");
227 MSG_DEBUG("tpdu.data.statusRep.msgRef : %d", tpdu.data.statusRep.msgRef);
228 MSG_DEBUG("tpdu.data.statusRep.bMoreMsg : %d", tpdu.data.statusRep.bMoreMsg);
229 MSG_DEBUG("tpdu.data.statusRep.bStatusReport : %d", tpdu.data.statusRep.bStatusReport);
230 MSG_DEBUG("tpdu.data.statusRep.statusRep : %d", tpdu.data.statusRep.bHeaderInd);
231 MSG_DEBUG("tpdu.data.statusRep.status : %02x", tpdu.data.statusRep.status);
232 MSG_DEBUG("tpdu.data.statusRep.pid : %d", tpdu.data.statusRep.pid);
233 MSG_DEBUG("tpdu.data.statusRep.dcs.bCompressed : %d", tpdu.data.statusRep.dcs.bCompressed);
234 MSG_DEBUG("tpdu.data.statusRep.dcs.msgClass : %d", tpdu.data.statusRep.dcs.msgClass);
235 MSG_DEBUG("tpdu.data.statusRep.dcs.codingScheme : %d", tpdu.data.statusRep.dcs.codingScheme);
236 MSG_DEBUG("tpdu.data.statusRep.dcs.codingGroup : %d", tpdu.data.statusRep.dcs.codingGroup);
237 MSG_SEC_DEBUG("tpdu.data.statusRep.recipAddress.address : %s", tpdu.data.statusRep.recipAddress.address);
238 MSG_DEBUG("tpdu.data.statusRep.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.statusRep.timeStamp.time.absolute.year, tpdu.data.statusRep.timeStamp.time.absolute.month, tpdu.data.statusRep.timeStamp.time.absolute.day,
239 tpdu.data.statusRep.timeStamp.time.absolute.hour, tpdu.data.statusRep.timeStamp.time.absolute.minute, tpdu.data.statusRep.timeStamp.time.absolute.second);
240 MSG_DEBUG("tpdu.data.statusRep.dischargeTime.time : %d/%d/%d %d:%d:%d ", tpdu.data.statusRep.dischargeTime.time.absolute.year, tpdu.data.statusRep.dischargeTime.time.absolute.month, tpdu.data.statusRep.dischargeTime.time.absolute.day,
241 tpdu.data.statusRep.dischargeTime.time.absolute.hour, tpdu.data.statusRep.dischargeTime.time.absolute.minute, tpdu.data.statusRep.dischargeTime.time.absolute.second);
242 MSG_DEBUG("tpdu.data.statusRep.userData.headerCnt : %d", tpdu.data.statusRep.userData.headerCnt);
243 MSG_DEBUG("tpdu.data.statusRep.userData.length : %d", tpdu.data.statusRep.userData.length);
244 MSG_DEBUG("tpdu.data.statusRep.userData.data : %s", tpdu.data.statusRep.userData.data);
245 MSG_DEBUG("#####################################################");
251 if (tpdu.tpduType == SMS_TPDU_DELIVER) {
252 if (tpdu.data.deliver.dcs.msgClass == SMS_MSG_CLASS_2) {
253 /* For GCF test, 34.2.5.3 */
254 SmsPluginSimMsg::instance()->setSmsData((const char*)pDataPackage->Sca, (const char *)pDataPackage->szData, pDataPackage->MsgLength);
257 if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
258 SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true) {
259 /* Call Concat Msg Handler */
260 SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu);
262 /* Call Event Handler */
263 SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
265 } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
266 /* Call Event Handler */
267 SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
269 } catch (MsgException& e) {
270 MSG_FATAL("%s", e.what());
276 void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
278 MSG_SEC_DEBUG("TapiEventCbMsgIncoming is called. noti_id [%s]", noti_id);
281 MSG_ERR("Error. data is NULL.");
285 TelSmsCbMsg_t *pCbMsg = (TelSmsCbMsg_t*)data;
288 SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, pCbMsg);
289 } catch (MsgException& e) {
290 MSG_FATAL("%s", e.what());
296 void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
298 MSG_SEC_DEBUG("TapiEventEtwsMsgIncoming is called. noti_id [%s]", noti_id);
301 MSG_ERR("Error. data is NULL.");
305 TelSmsEtwsMsg_t *pEtwsMsg = (TelSmsEtwsMsg_t*)data;
308 SmsPluginCbMsgHandler::instance()->handleEtwsMsg(handle, pEtwsMsg);
309 } catch (MsgException& e) {
310 MSG_FATAL("%s", e.what());
316 void TapiEventDeliveryReportCNF(TapiHandle *handle, int result, void *data, void *user_data)
318 MSG_DEBUG("TapiEventDeliveryReportCNF is called. : result = [%d]", result);
324 void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *user_data)
326 MSG_DEBUG("TapiEventGetSimMsgCnt is called.");
328 if (result != TAPI_API_SUCCESS || data == NULL) {
329 MSG_ERR("Error. data is NULL. result:[0x%x]", result);
330 MSG_SIM_COUNT_S simCnt;
331 memset(&simCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
332 SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, &simCnt);
336 SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, (MSG_SIM_COUNT_S *)data);
340 void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_data)
342 MSG_DEBUG("TapiEventGetSimMsg is called.");
344 if (result != TAPI_API_SUCCESS || data == NULL) {
345 MSG_ERR("Error!! result [0x%x]", result);
347 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
353 TelSmsData_t* pSmsTpdu = (TelSmsData_t*)data;
355 int *simIdList = (int *)user_data;
357 /* Reading TelSmsData_t */
358 MSG_DEBUG("sim index %d", pSmsTpdu->SimIndex);
359 MSG_DEBUG("status %d", pSmsTpdu->MsgStatus);
360 MSG_DEBUG("sim msg [%s]", pSmsTpdu->SmsData.szData);
362 /* Reading TelSmsDatapackageInfo_t */
363 if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN) {
364 MSG_DEBUG("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength);
366 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
374 SmsPluginTpduCodec::decodeTpdu(pSmsTpdu->SmsData.szData, pSmsTpdu->SmsData.MsgLength, &tpdu);
376 MSG_DEBUG("Sim Message Type [%d]", tpdu.tpduType);
380 /* set read status */
381 if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_READ)
383 else if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_UNREAD)
386 if (tpdu.tpduType == SMS_TPDU_DELIVER) {
387 if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
388 MSG_DEBUG("Unsupported message!!");
389 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
393 MSG_DEBUG("headerCnt [%d]", tpdu.data.deliver.userData.headerCnt);
394 for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++) {
395 /* Handler Concatenated Message */
396 if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
397 tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
398 SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
402 if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_SPECIAL_SMS) {
403 MSG_DEBUG("Unsupported Special SMS!!");
404 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
408 } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
409 if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
410 MSG_DEBUG("Unsupported message!!");
411 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
414 MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
416 for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++) {
417 /* Handler Concatenated Message */
418 if (tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
419 tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
420 SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
426 /* Make MSG_MESSAGE_INFO_S */
427 MSG_MESSAGE_INFO_S msgInfo;
428 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
431 msgInfo.storageId = MSG_STORAGE_SIM;
433 msgInfo.addressList = NULL;
434 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
436 SmsPluginEventHandler::instance()->convertTpduToMsginfo(&tpdu, &msgInfo);
438 msgInfo.sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
440 if (tpdu.tpduType == SMS_TPDU_DELIVER && tpdu.data.deliver.dcs.bMWI == true) {
441 if (tpdu.data.deliver.pid == 0x20 && tpdu.data.deliver.originAddress.ton == SMS_TON_ALPHANUMERIC) {
442 char keyName[MAX_VCONFKEY_NAME_LEN];
443 char *voiceNumber = NULL;
444 char *voiceAlphaId = NULL;
446 memset(keyName, 0x00, sizeof(keyName));
447 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msgInfo.sim_idx);
448 if (MsgSettingGetString(keyName, &voiceNumber) != MSG_SUCCESS) {
449 MSG_INFO("MsgSettingGetString() is failed");
452 memset(keyName, 0x00, sizeof(keyName));
453 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msgInfo.sim_idx);
454 if (MsgSettingGetString(keyName, &voiceAlphaId) != MSG_SUCCESS) {
455 MSG_INFO("MsgSettingGetString() is failed");
458 memset(msgInfo.addressList[0].addressVal, 0x00, sizeof(msgInfo.addressList[0].addressVal));
459 memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
462 snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), "%s", voiceNumber);
468 snprintf(msgInfo.addressList[0].displayName, sizeof(msgInfo.addressList[0].displayName), "%s", voiceAlphaId);
473 memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
474 snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "Voice message");
476 } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
477 msgInfo.displayTime = time(NULL);
480 /* set read status */
481 msgInfo.bRead = bRead;
483 simIdList[0] = pSmsTpdu->SimIndex + 1;
484 /* Print MSG_MESSAGE_INFO_S */
485 MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
486 MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
487 MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
488 MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
489 MSG_SEC_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
490 MSG_SEC_DEBUG("msgInfo.addressList[0].displayName : %s", msgInfo.addressList[0].displayName);
491 MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
492 MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
493 MSG_DEBUG("msgInfo.bRead : %d", msgInfo.bRead);
494 MSG_DEBUG("msgInfo.bTextSms : %d", msgInfo.bTextSms);
495 MSG_DEBUG("msgInfo.direction : %d", msgInfo.direction);
496 MSG_DEBUG("msgInfo.msgType.mainType : %d", msgInfo.msgType.mainType);
497 MSG_DEBUG("msgInfo.msgType.subType : %d", msgInfo.msgType.subType);
498 MSG_DEBUG("msgInfo.msgType.classType : %d", msgInfo.msgType.classType);
499 MSG_DEBUG("msgInfo.displayTime : %d", msgInfo.displayTime);
500 MSG_DEBUG("msgInfo.dataSize : %d", msgInfo.dataSize);
501 if (msgInfo.bTextSms == true)
502 MSG_SEC_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
504 MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
505 MSG_DEBUG("msgInfo.sim_idx : %d", msgInfo.sim_idx);
506 MSG_DEBUG("###############################################################");
508 /* Call Event Handler */
509 SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
513 void TapiEventSaveSimMsg(TapiHandle *handle, int result, void *data, void *user_data)
515 MSG_DEBUG("TapiEventSaveSimMsg is called. result [%d]", result);
520 simId = *((int*)data);
522 MSG_ERR("Data(SIM Msg ID) is NULL");
524 SmsPluginSimMsg::instance()->setSaveSimMsgEvent(handle, simId, result);
528 void TapiEventSaveClass2Msg(TapiHandle *handle, int result, void *data, void *user_data)
530 MSG_DEBUG("TapiEventSaveClass2Msg is called. result [%d]", result);
535 simId = *((int*)data);
536 MSG_DEBUG("SIM Msg ID : %d", simId);
538 MSG_ERR("Data(SIM Msg ID) is NULL");
541 MSG_MESSAGE_INFO_S *pMsgInfo = (MSG_MESSAGE_INFO_S *)user_data;
543 SmsPluginSimMsg::instance()->setSaveClass2MsgEvent(handle, simId, result, pMsgInfo);
545 if (result == TAPI_NETTEXT_SENDSMS_SUCCESS)
546 SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)simId, true);
548 SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
551 if (pMsgInfo->addressList) {
552 delete[] pMsgInfo->addressList;
553 pMsgInfo->addressList = NULL;
561 void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *user_data)
563 MSG_DEBUG("TapiEventDeleteSimMsg is called. result [%d]", result);
565 if (result != TAPI_API_SUCCESS || data == NULL) {
566 MSG_ERR("Error. data is NULL. result:0x%x", result);
567 SmsPluginSimMsg::instance()->setDelSimEvent(-1, false);
571 int sim_id = *((int*)data);
573 SmsPluginSimMsg::instance()->setDelSimEvent(sim_id, true);
577 void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *user_data)
579 MSG_DEBUG("TapiEventSetConfigData is called.");
582 MSG_ERR("Error. data is NULL. result:%d", result);
583 SmsPluginSetting::instance()->setResultFromSim(false);
587 TelSmsSetResponse* responseType = (TelSmsSetResponse*)data;
589 MSG_DEBUG("responseType : [%d]", *responseType);
591 switch (*responseType) {
592 case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
593 MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
596 case TAPI_NETTEXT_SETPARAMETERS_RSP :
597 MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
600 case TAPI_NETTEXT_CBSETCONFIG_RSP :
601 MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
604 case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
605 MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
608 case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
609 MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
613 MSG_DEBUG("Unknown Response is called [%d]", *responseType);
619 MSG_DEBUG("status : [%d]", (TelSmsCause_t)result);
621 if ((TelSmsCause_t)result != TAPI_NETTEXT_SUCCESS) bRet = false;
623 if (*responseType == TAPI_NETTEXT_SETMESSAGESTATUS_RSP)
624 SmsPluginSimMsg::instance()->setSimEvent(0, bRet);
626 SmsPluginSetting::instance()->setResultFromSim(bRet);
630 void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user_data)
632 MSG_DEBUG("TapiEventGetParamCnt is called.");
634 if (result != TAPI_API_SUCCESS || data == NULL) {
635 MSG_ERR("Error. data is NULL. result:0x%x", result);
636 SmsPluginSetting::instance()->setParamCntEvent(0);
641 paramCnt = *((int*)data);
643 SmsPluginSetting::instance()->setParamCntEvent(paramCnt);
647 void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_data)
649 MSG_DEBUG("TapiEventGetConfigData is called.");
651 if (result != TAPI_API_SUCCESS || data == NULL) {
652 MSG_ERR("Error. data is NULL. result:0x%x", result);
653 SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
657 TelSmsParams_t* smsParam = (TelSmsParams_t*)data;
661 MSG_SMSC_DATA_S smscData = {0, };
663 /*Check Alpha ID value*/
664 alphaIdLen = smsParam->AlphaIdLen;
665 MSG_DEBUG("alphaId_len[%d]", alphaIdLen);
667 if (alphaIdLen < 0 || alphaIdLen > SMSC_NAME_MAX) {
668 MSG_DEBUG("Wrong Alpha ID Length[%d]", alphaIdLen);
670 SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
676 /*Check Address value*/
677 addrLen = smsParam->TpSvcCntrAddr.DialNumLen;
679 if (addrLen > SMSC_ADDR_MAX) {
680 MSG_DEBUG("addrLen is too long: %d", addrLen);
681 SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
683 } else if (addrLen < 2) {
684 MSG_DEBUG("addrLen is too short: %d", addrLen);
685 SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
689 MSG_DEBUG("addrLen : %d", addrLen);
691 /*SMSP Parameter Indicator value*/
692 MSG_DEBUG("ParamIndicator[%02x]", smsParam->ParamIndicator);
695 if (0x00 == (0x02 & smsParam->ParamIndicator)) {
696 MSG_DEBUG("record index[%d]", (int)smsParam->RecordIndex);
698 MSG_DEBUG("TON : %d", smsParam->TpSvcCntrAddr.Ton);
699 MSG_DEBUG("NPI : %d", smsParam->TpSvcCntrAddr.Npi);
701 smscData.smscAddr.ton = smsParam->TpSvcCntrAddr.Ton;
702 smscData.smscAddr.npi = smsParam->TpSvcCntrAddr.Npi;
704 SmsPluginParamCodec paramCodec;
706 memset(smscData.smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
707 paramCodec.decodeSMSC(smsParam->TpSvcCntrAddr.szDiallingNum, addrLen, smscData.smscAddr.ton, smscData.smscAddr.address);
709 MSG_SEC_DEBUG("SMSC Address : [%s]", smscData.smscAddr.address);
711 memset(smscData.name, 0x00, SMSC_NAME_MAX+1);
712 memcpy(smscData.name, smsParam->szAlphaId, alphaIdLen);
713 smscData.name[alphaIdLen] = '\0';
715 MSG_SEC_DEBUG("SMSC Name : [%s]", smscData.name);
717 MSG_DEBUG("SMSC Address is not present");
719 SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
724 /*Get the PID value*/
725 if (0x00 == (0x04 & smsParam->ParamIndicator)) {
726 SMS_PID_T pid = (SMS_PID_T)smsParam->TpProtocolId;
728 MSG_DEBUG("smsParam->TpProtocolId : %d", smsParam->TpProtocolId);
732 smscData.pid = MSG_PID_TEXT;
735 smscData.pid = MSG_PID_VOICE;
738 smscData.pid = MSG_PID_FAX;
741 smscData.pid = MSG_PID_X400;
744 smscData.pid = MSG_PID_ERMES;
747 smscData.pid = MSG_PID_EMAIL;
750 smscData.pid = MSG_PID_TEXT;
754 MSG_DEBUG("smscData.pid : %d", smscData.pid);
756 MSG_DEBUG("PID is not present");
757 smscData.pid = MSG_PID_TEXT;
758 MSG_DEBUG("MSG_PID_TEXT is inserted to PID");
762 /*Get the DCS value*/
763 if (0x00 == (0x08 & smsParam->ParamIndicator)) {
764 smscList.smscData[index].dcs = smsParam->TpDataCodingScheme;
765 MSG_DEBUG("dcs : %d", smscList.smscData[index].dcs);
767 smscList.smscData[index].dcs = MSG_ENCODE_GSM7BIT;
768 MSG_DEBUG("DCS is not present");
772 /*Get the ValidityPeriod value*/
773 if (0x00 == (0x10 & smsParam->ParamIndicator)) {
774 smscData.valPeriod = smsParam->TpValidityPeriod;
775 MSG_DEBUG("valPeriod : %d", smscData.valPeriod);
777 smscData.valPeriod = 0;
779 MSG_DEBUG("Validity Period is not present");
782 SmsPluginSetting::instance()->setParamEvent(handle, &smscData, (int)smsParam->RecordIndex, true);
786 void TapiEventSetSmscInfo(TapiHandle *handle, int result, void *data, void *user_data)
788 MSG_DEBUG("TapiEventSetSmscInfo is called. result=[%d]", result);
790 if (result != TAPI_API_SUCCESS)
791 SmsPluginSetting::instance()->setResultFromSim(false);
793 SmsPluginSetting::instance()->setResultFromSim(true);
797 void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user_data)
799 MSG_DEBUG("TapiEventGetCBConfig is called.");
801 MSG_CBMSG_OPT_S cbOpt = {0};
803 int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
805 if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0) {
806 MSG_ERR("Error. data is NULL. result:0x%x, simIndex:%d", result, simIndex);
808 SmsPluginSetting::instance()->setCbConfigEvent(handle, NULL, false);
813 TelSmsCbConfig_t* pCBConfig = (TelSmsCbConfig_t*)data;
815 cbOpt.bReceive = (bool)pCBConfig->CBEnabled;
817 cbOpt.maxSimCnt = TAPI_NETTEXT_SMS_CBMI_LIST_SIZE_MAX;
819 cbOpt.simIndex = simIndex;
821 MSG_DEBUG("Sim Index [%d], Receive [%d], Max SIM Count [%d]", simIndex, cbOpt.bReceive, cbOpt.maxSimCnt);
823 cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
825 if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX) {
826 MSG_DEBUG("Channel Count [%d] from TAPI is over MAX", cbOpt.channelData.channelCnt);
827 cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
830 MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
832 for (int i = 0; i < cbOpt.channelData.channelCnt; i++) {
833 cbOpt.channelData.channelInfo[i].bActivate = pCBConfig->MsgIDs[i].Net3gpp.Selected;
834 cbOpt.channelData.channelInfo[i].from = pCBConfig->MsgIDs[i].Net3gpp.FromMsgId;
835 cbOpt.channelData.channelInfo[i].to = pCBConfig->MsgIDs[i].Net3gpp.ToMsgId;
836 memset(cbOpt.channelData.channelInfo[i].name, 0x00, CB_CHANNEL_NAME_MAX+1);
838 MSG_DEBUG("Channel FROM [%d], Channel TO [%d] ", cbOpt.channelData.channelInfo[i].from, cbOpt.channelData.channelInfo[i].to);
841 SmsPluginSetting::instance()->setCbConfigEvent(handle, &cbOpt, true);
844 void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
846 MSG_DEBUG("TapiEventSetMailboxInfo is called. result = [%d]", result);
849 bool *bShowError = (bool*)user_data;
851 if (result != TAPI_SIM_ACCESS_SUCCESS && *bShowError == true)
854 SmsPluginSetting::instance()->setResultFromSim(bRet);
857 void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
859 MSG_DEBUG("TapiEventGetMailboxInfo is called. result=[%d]", result);
861 if (result == TAPI_API_SIM_SERVICE_IS_DISABLED) {
862 MSG_INFO("result is TAPI_API_SIM_SERVICE_IS_DISABLED");
863 char keyName[MAX_VCONFKEY_NAME_LEN];
864 int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
865 char *voiceNum = NULL;
866 memset(keyName, 0x00, sizeof(keyName));
867 snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
868 if (MsgSettingGetString(keyName, &voiceNum) != MSG_SUCCESS) {
869 MSG_INFO("MsgSettingGetString() is failed");
872 if (voiceNum && strlen(voiceNum)) {
873 MSG_DEBUG("Voice mailbox number exist in vconf");
874 SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, true, false);
879 SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, false);
886 } else if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
887 MSG_ERR("Error. data is NULL.");
888 /*If result is not TAPI_SIM_ACCESS_SUCCESS, set bMbdnEnable to false*/
889 SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, false);
893 TelSimMailboxList_t *list = (TelSimMailboxList_t *)data;
894 SMS_SIM_MAILBOX_LIST_S mbList = {0, };
896 if (list->count <= 0) {
897 MSG_INFO("Mailbox list is empty");
898 SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, true);
902 mbList.count = list->count;
904 for (int i = 0; i < mbList.count; i++) {
905 mbList.list[i].b_cphs = list->list[i].b_cphs;
906 mbList.list[i].alpha_id_max_len = list->list[i].alpha_id_max_len;
907 mbList.list[i].mb_type = list->list[i].mb_type;
908 mbList.list[i].profile_num = list->list[i].profile_num;
909 mbList.list[i].rec_index = list->list[i].rec_index;
910 mbList.list[i].ton = list->list[i].ton;
911 mbList.list[i].npi = list->list[i].npi;
912 snprintf(mbList.list[i].alpha_id, sizeof(mbList.list[i].alpha_id), "%s", list->list[i].alpha_id);
913 snprintf(mbList.list[i].num, sizeof(mbList.list[i].num), "%s", list->list[i].num);
914 mbList.list[i].cc_id = list->list[i].cc_id;
915 mbList.list[i].ext1_id = list->list[i].ext1_id;
916 mbList.list[i].num_len = strlen(mbList.list[i].num);
919 SmsPluginSetting::instance()->setMailboxInfoEvent(handle, &mbList, true, true);
922 void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
924 MSG_DEBUG("TapiEventSetMwiInfo is called. result = [%d]", result);
927 void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
929 MSG_DEBUG("TapiEventGetMwiInfo is called.");
931 if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
932 MSG_ERR("Error. data is NULL. result:0x%x", result);
933 SmsPluginSetting::instance()->setMwiInfoEvent(handle, NULL, false);
938 TelSimMessageWaitingResp_t *MwiInfo = (TelSimMessageWaitingResp_t *)data;
939 SMS_SIM_MWI_INFO_S simMwiInfo = {0, };
941 memcpy(&simMwiInfo, MwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
943 SmsPluginSetting::instance()->setMwiInfoEvent(handle, &simMwiInfo, true);
946 void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *user_data)
948 MSG_DEBUG("TapiEventGetMsisdnInfo is called.");
952 if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
953 MSG_ERR("Error. data is NULL. result:0x%x", result);
954 SmsPluginSetting::instance()->setResultFromSim(bRet);
958 TelSimMsisdnList_t *list = (TelSimMsisdnList_t *)data;
960 for (int i = 0; i < list->count; i++) {
961 if (list->list[i].num[0] != '\0') {
962 char keyName[MAX_VCONFKEY_NAME_LEN];
963 int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
965 memset(keyName, 0x00, sizeof(keyName));
966 snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, simIndex);
968 if (MsgSettingSetString(keyName, list->list[i].num) == MSG_SUCCESS) {
969 MSG_SEC_INFO("Get MSISDN from SIM : [%s]", list->list[i].num);
972 MSG_DEBUG("Getting MSISDN is failed!");
978 SmsPluginSetting::instance()->setResultFromSim(bRet);
981 void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, void *user_data)
983 MSG_DEBUG("TapiEventGetSimServiceTable is called.");
985 TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
986 TelSimServiceTable_t *svct = (TelSimServiceTable_t *)data;
990 if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL) {
991 MSG_ERR("Error. data is NULL and access_rt [%d] failed", access_rt);
992 SmsPluginSetting::instance()->setResultFromSim(false);
996 msg_error_t err = MSG_SUCCESS;
1001 int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
1003 memset(sstKey, 0x00, sizeof(sstKey));
1004 snprintf(sstKey, sizeof(sstKey), "%s/%d", MSG_SIM_SERVICE_TABLE, simIndex);
1006 memset(moCtrlKey, 0x00, sizeof(moCtrlKey));
1007 snprintf(moCtrlKey, sizeof(moCtrlKey), "%s/%d", MSG_SIM_MO_CONTROL, simIndex);
1009 if (svct->sim_type == TAPI_SIM_CARD_TYPE_GSM) {
1010 if (svct->table.sst.service[TAPI_SIM_SST_SMS] == 1) {
1011 err = MsgSettingSetBool(sstKey, true);
1013 err = MsgSettingSetBool(sstKey, false);
1015 MSG_DEBUG("Setting result = [%d]", err);
1017 if (svct->table.sst.service[TAPI_SIM_SST_MO_SMS_CTRL_BY_SIM] == 1) {
1018 err = MsgSettingSetBool(moCtrlKey, true);
1020 err = MsgSettingSetBool(moCtrlKey, false);
1022 MSG_DEBUG("Setting result = [%d]", err);
1024 } else if (svct->sim_type == TAPI_SIM_CARD_TYPE_USIM) {
1025 if (svct->table.ust.service[TAPI_SIM_UST_SMS] == 1) {
1026 err = MsgSettingSetBool(sstKey, true);
1028 err = MsgSettingSetBool(sstKey, false);
1030 MSG_DEBUG("Setting result = [%d]", err);
1032 if (svct->table.ust.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1) {
1033 err = MsgSettingSetBool(moCtrlKey, true);
1035 err = MsgSettingSetBool(moCtrlKey, false);
1037 MSG_DEBUG("Setting result = [%d]", err);
1040 MSG_DEBUG("Unknown SIM type value");
1043 SmsPluginSetting::instance()->setResultFromSim(bRet);
1046 void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data)
1048 MSG_DEBUG("TapiEventSatSmsRefresh is called.");
1050 if (result != TAPI_API_SUCCESS || data == NULL) {
1051 MSG_ERR("Error. data is NULL. result:0x%x", result);
1056 SmsPluginSatHandler::instance()->refreshSms(handle, data);
1057 } catch (MsgException& e) {
1058 MSG_FATAL("%s", e.what());
1064 void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
1066 MSG_DEBUG("TapiEventSatSendSms is called.");
1069 MSG_ERR("Error. data is NULL.");
1074 SmsPluginSatHandler::instance()->sendSms(handle, data);
1075 } catch (MsgException& e) {
1076 MSG_FATAL("%s", e.what());
1082 void TapiEventSatMoSmsCtrl(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
1084 MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
1087 MSG_ERR("Error. data is NULL.");
1092 SmsPluginSatHandler::instance()->ctrlSms(handle, data);
1093 } catch (MsgException& e) {
1094 MSG_FATAL("%s", e.what());
1099 void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
1101 MSG_DEBUG("Tapi result is [%d]", result);
1102 if (result == TAPI_API_SUCCESS)
1103 isMemAvailable = true;
1106 void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
1108 MSG_DEBUG("TapiEventSetMsgStatus is called. result [%d]", result);
1110 if (result != TAPI_API_SUCCESS || data == NULL) {
1111 MSG_ERR("Error. data is NULL. result:0x%x", result);
1112 SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
1116 msg_sim_id_t sim_id = *((msg_sim_id_t *)user_data);
1118 SmsPluginSimMsg::instance()->setSimEvent(sim_id, true);
1122 void TapiEventGetMeImei(TapiHandle *handle, int result, void *data, void *user_data)
1124 MSG_SEC_DEBUG("TapiEventGetMeImei is called. result [%d]", result);
1126 if (result != TAPI_API_SUCCESS || data == NULL) {
1127 MSG_ERR("Error. data is NULL. result:0x%x", result);
1128 SmsPluginSetting::instance()->setResultImei(false, NULL);
1132 char *tmpImei = (char *)data;
1134 SmsPluginSetting::instance()->setResultImei(true, tmpImei);
1138 void TapiEventSimStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
1140 MSG_DEBUG("TapiEventSimStatusChange is called.");
1143 MSG_ERR("Error. data is NULL.");
1147 int status = *(int *)data;
1149 MSG_DEBUG("SIM Status [%d]", status);
1151 if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
1152 MSG_INFO("SIM Initialize by sim status change callback");
1153 SmsPluginSetting::instance()->setSimChangeStatus(handle, false);
1157 void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
1159 MSG_DEBUG("TapiEventNetworkStatusChange is called.");
1162 MSG_ERR("Error. data is NULL.");
1166 TelNetworkServiceType_t *type = (TelNetworkServiceType_t *)data;
1168 MSG_INFO("network status type [%d]", *type);
1170 if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
1171 /* Call Event Handler */
1172 SmsPluginEventHandler::instance()->handleResendMessage();
1176 void TapiEventSimRefreshed(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
1178 MSG_DEBUG("TapiEventSimRefreshed is called.");
1180 SmsPluginSetting::instance()->SimRefreshCb(handle);
1183 /*==================================================================================================
1184 IMPLEMENTATION OF SmsPluginCallback - Member Functions
1185 ==================================================================================================*/
1186 SmsPluginCallback* SmsPluginCallback::pInstance = NULL;
1189 SmsPluginCallback::SmsPluginCallback()
1194 SmsPluginCallback::~SmsPluginCallback()
1196 if (pInstance != NULL) {
1203 SmsPluginCallback* SmsPluginCallback::instance()
1206 pInstance = new SmsPluginCallback();
1212 void SmsPluginCallback::registerEvent()
1214 TapiHandle *pTapiHandle;
1216 int count = SmsPluginDSHandler::instance()->getTelHandleCount();
1218 for (int i = 1; i <= count; ++i) {
1219 pTapiHandle = SmsPluginDSHandler::instance()->getTelHandle(i);
1220 /* int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle); */
1222 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL) != TAPI_API_SUCCESS)
1223 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_DEVICE_READY);
1224 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL) != TAPI_API_SUCCESS)
1225 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_INCOM_MSG);
1226 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL) != TAPI_API_SUCCESS)
1227 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_CB_INCOM_MSG);
1228 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL) != TAPI_API_SUCCESS)
1229 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_ETWS_INCOM_MSG);
1230 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_SEND_SMS, TapiEventSatSendSms, NULL) != TAPI_API_SUCCESS)
1231 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_SEND_SMS);
1232 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SM_CONTROL_RESULT, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS)
1233 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SM_CONTROL_RESULT);
1234 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_STATUS, TapiEventSimStatusChange, NULL) != TAPI_API_SUCCESS)
1235 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_STATUS);
1236 if (tel_register_noti_event(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, TapiEventNetworkStatusChange, NULL) != TAPI_API_SUCCESS)
1237 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_PROP_NETWORK_SERVICE_TYPE);
1238 if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_REFRESHED, TapiEventSimRefreshed, NULL) != TAPI_API_SUCCESS)
1239 MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED);
1240 /* if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL) != TAPI_API_SUCCESS) */
1241 /* MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_REFRESH); */
1242 /* if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS) */
1243 /* MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SMS_CTRL); */
1248 void SmsPluginCallback::deRegisterEvent()