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.
20 #include <eventsystem.h>
23 #include "MsgException.h"
24 #include "MsgUtilFile.h"
25 #include "MsgContact.h"
26 #include "MsgGconfWrapper.h"
27 #include "MsgNotificationWrapper.h"
28 #include "MsgUtilFunction.h"
29 #include "MsgSubmitHandler.h"
30 #include "MsgDeliverHandler.h"
31 #include "MsgStorageHandler.h"
32 #include "MsgTransManager.h"
33 #include "MsgPluginManager.h"
34 #include "MsgUtilStorage.h"
36 #include "MsgCmdHandler.h"
37 #include "MsgDevicedWrapper.h"
38 #include "MsgMmsMessage.h"
41 /*==================================================================================================
42 FUNCTION IMPLEMENTATION
43 ==================================================================================================*/
44 int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent)
46 msg_error_t err = MSG_SUCCESS;
49 if (!pCmd || !ppEvent) {
50 MSG_DEBUG("pCmd or ppEvent is null");
57 MSG_REQUEST_INFO_S reqInfo = {0, };
58 MSG_PROXY_INFO_S proxyInfo = {0, };
60 reqInfo.msgInfo.addressList = NULL;
61 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&reqInfo.msgInfo.addressList, unique_ptr_deleter);
63 /* Get Message Request */
64 memcpy(&reqInfo.reqId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_request_id_t));
66 /* Storing Request ID, Proxy Info for Sent Status CNF */
67 memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)), sizeof(MSG_PROXY_INFO_S));
69 MsgDecodeMsgInfo((char *)(pCmd->cmdData+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)), &reqInfo.msgInfo, &reqInfo.sendOptInfo);
72 if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE
73 && reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) {
75 memcpy(&fd, pCmd->cmdCookie, sizeof(int));
76 if (reqInfo.msgInfo.bTextSms == false) {
77 err = MsgMmsCheckFilepathSmack(fd, reqInfo.msgInfo.msgData);
78 if (err != MSG_SUCCESS) {
79 return MsgMakeEvent(NULL, 0, MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent);
84 if (reqInfo.msgInfo.msgId > 0)
88 err = MsgSubmitReq(&reqInfo, false);
90 if (err == MSG_SUCCESS) {
91 MSG_DEBUG("Command Handle Success : MsgSubmitReq()");
93 MSG_DEBUG("Command Handle Fail : MsgSubmitReq()");
96 int reqId = reqInfo.reqId;
97 proxyInfo.sentMsgId = reqInfo.msgInfo.msgId;
99 MSG_DEBUG("REQID: %d, MSGID: %d", reqId, proxyInfo.sentMsgId);
101 if (reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE) {
102 MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo);
103 } else if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE) {
104 /* Retrieve MMS shall not be kept in sentMsg */
105 if ((reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) ||
106 (reqInfo.msgInfo.msgType.subType == MSG_FORWARD_MMS) ||
107 (reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS))
108 MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo);
111 /* keep transaction Id list for distinguish java MMS sent msg when sendconf received */
112 if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE &&
113 reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) {
114 MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S trId = {0};
115 memcpy(&trId.id, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)+sizeof(MSG_PROXY_INFO_S)), MMS_TR_ID_LEN);
118 pFileName = strstr(reqInfo.msgInfo.msgData, "MSG_");
119 strncpy(trId.pduFileName, pFileName, MAX_COMMON_INFO_SIZE);
121 MSG_SEC_DEBUG("java MMS msg trId:%s filepath:%s", trId.id, reqInfo.msgInfo.msgData);
123 MsgTransactionManager* tm = MsgTransactionManager::instance();
124 tm->setJavaMMSList(&trId);
128 ret[1] = reqInfo.msgInfo.msgId;
129 ret[2] = reqInfo.msgInfo.threadId;
131 /* Make Event Data */
132 eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent);
134 /* reject_msg_support */
135 if (((reqInfo.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) &&
136 (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE)))
137 err = MsgStoDeleteMessage(reqInfo.msgInfo.msgId, true);
139 /** send storage CB */
140 msg_id_list_s msgIdList;
141 msg_message_id_t msgIds[1];
142 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
144 msgIdList.nCount = 1;
145 msgIds[0] = reqInfo.msgInfo.msgId;
146 msgIdList.msgIdList = msgIds;
148 if ((err == MSG_SUCCESS || err != MSG_ERR_PLUGIN_STORAGE) && reqInfo.msgInfo.msgPort.valid == false) {
150 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
152 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
155 MSG_DEBUG("No need to broadcast storage change CB");
158 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
160 MsgStoAutoDeleteConversation(reqInfo.msgInfo.threadId, &msgIdList);
161 if (msgIdList.msgIdList) {
162 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
163 delete [] (char*)msgIdList.msgIdList;
170 int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
173 if (!pCmd || !ppEvent) {
174 MSG_DEBUG("pCmd or ppEvent is null");
178 /* Get Message Request */
180 memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
181 MSG_DEBUG("Registering sent status CB for %d", listenerFd);
183 /* storing dst fd in list */
184 MsgTransactionManager::instance()->setSentStatusCB(listenerFd);
186 /* Make Event Data */
187 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SENT_STATUS_CB, MSG_SUCCESS, (void**)ppEvent);
193 int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
196 if (!pCmd || !ppEvent) {
197 MSG_DEBUG("pCmd or ppEvent is null");
201 /* Get Message Request */
202 MSG_CMD_REG_INCOMING_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MSG_CB_S*) pCmd->cmdData;
203 MSG_DEBUG("Registering incoming SMS CB for fd %d mType %d port %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->port);
205 /* storing dst fd in list */
206 MsgTransactionManager::instance()->setIncomingMsgCB(pCmdData);
208 /* Make Event Data */
209 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
215 int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
218 if (!pCmd || !ppEvent) {
219 MSG_DEBUG("pCmd or ppEvent is null");
223 /* Get Message Request */
224 MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S*) pCmd->cmdData;
225 MSG_DEBUG("Registering incoming MMS Conf CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId);
227 /* storing dst fd in list */
228 MsgTransactionManager::instance()->setMMSConfMsgCB(pCmdData);
230 /* Make Event Data */
231 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
236 int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
239 if (!pCmd || !ppEvent) {
240 MSG_DEBUG("pCmd or ppEvent is null");
244 /* Get Message Request */
245 MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S*) pCmd->cmdData;
246 MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId);
248 /* storing dst fd in list */
249 MsgTransactionManager::instance()->setPushMsgCB(pCmdData);
250 /* MsgTransactionManager::instance()->sendPendigPushMsg(pCmdData); */
253 /* Make Event Data */
254 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
261 int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
264 if (!pCmd || !ppEvent) {
265 MSG_DEBUG("pCmd or ppEvent is null");
269 /* Get Message Request */
270 MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_CB_MSG_CB_S*) pCmd->cmdData;
271 MSG_DEBUG("Registering incoming CB Msg CB for fd:%d mType:%d: bSave: %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->bsave);
273 /* storing dst fd in list */
274 MsgTransactionManager::instance()->setCBMsgCB(pCmdData);
276 /* Make Event Data */
277 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_CB_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
283 int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
286 if (!pCmd || !ppEvent) {
287 MSG_DEBUG("pCmd or ppEvent is null");
291 /* Get Message Request */
292 MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S*) pCmd->cmdData;
293 MSG_DEBUG("Registering incoming Sync ML Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
295 /* storing dst fd in list */
296 MsgTransactionManager::instance()->setSyncMLMsgCB(pCmdData);
298 /* Make Event Data */
299 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
305 int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
308 if (!pCmd || !ppEvent) {
309 MSG_DEBUG("pCmd or ppEvent is null");
313 /* Get Message Request */
314 MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_LBS_MSG_CB_S*) pCmd->cmdData;
315 MSG_DEBUG("Registering incoming LBS Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
317 /* storing dst fd in list */
318 MsgTransactionManager::instance()->setLBSMsgCB(pCmdData);
320 /* Make Event Data */
321 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_LBS_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
327 int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
330 if (!pCmd || !ppEvent) {
331 MSG_DEBUG("pCmd or ppEvent is null");
335 /* Get Message Request */
336 MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCmdData = (MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S*) pCmd->cmdData;
337 MSG_DEBUG("Registering SyncML Msg ooperation CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
339 /* storing dst fd in list */
340 MsgTransactionManager::instance()->setSyncMLMsgOperationCB(pCmdData);
342 /* Make Event Data */
343 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, MSG_SUCCESS, (void**)ppEvent);
349 int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
352 if (!pCmd || !ppEvent) {
353 MSG_DEBUG("pCmd or ppEvent is null");
357 /* Get Message Request */
359 memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
360 MSG_DEBUG("Registering storage change CB for %d", listenerFd);
362 /* storing dst fd in list */
363 MsgTransactionManager::instance()->setStorageChangeCB(listenerFd);
365 /* Make Event Data */
366 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_STORAGE_CHANGE_CB, MsgException::SUCCESS, (void**)ppEvent);
372 int MsgRegThreadChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
375 if (!pCmd || !ppEvent) {
376 MSG_DEBUG("pCmd or ppEvent is null");
380 /* Get Message Request */
382 memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
383 MSG_DEBUG("Registering storage change CB for %d", listenerFd);
385 /* storing dst fd in list */
386 MsgTransactionManager::instance()->setThreadChangeCB(listenerFd);
388 /* Make Event Data */
389 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_THREAD_CHANGE_CB, MsgException::SUCCESS, (void**)ppEvent);
395 int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
398 if (!pCmd || !ppEvent) {
399 MSG_DEBUG("pCmd or ppEvent is null");
403 /* Get Message Request */
405 memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
406 MSG_DEBUG("Registering report msg incoming CB for %d", listenerFd);
408 /* storing dst fd in list */
409 MsgTransactionManager::instance()->setReportMsgCB(listenerFd);
411 /* Make Event Data */
412 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_REPORT_MSG_INCOMING_CB, MsgException::SUCCESS, (void**)ppEvent);
418 int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent)
421 if (!pCmd || !ppEvent) {
422 MSG_DEBUG("pCmd or ppEvent is null");
426 /* Get Message Request */
427 MSG_SENT_STATUS_S* pStatus = (MSG_SENT_STATUS_S*) pCmd->cmdData;
429 MSG_DEBUG("REQID %d, STATUS %d", pStatus->reqId, pStatus->status);
431 /* storing dst fd in list */
432 MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(pStatus->reqId);
434 /* when no sent status cb is found */
436 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
439 MSG_DEBUG("REQID %d, listenerFD %d, handleAddr %x, msgId %d", pStatus->reqId, prxInfo->listenerFd, prxInfo->handleAddr, prxInfo->sentMsgId);
441 /* if APP send and quit(not exist at this time), don't send the data up. */
442 if (prxInfo->handleAddr == 0) {
443 /* just making data which will be passed to plugin. it indicates "handling evt success" */
444 MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId);
446 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
449 unsigned long ret[3] = {0}; /* reqid, status, object */
451 ret[0] = (unsigned long)pStatus->reqId;
452 ret[1] = (unsigned long)pStatus->status;
453 ret[2] = prxInfo->handleAddr;
455 /* Make Event Data for APP */
456 int eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
458 /* Send to listener thread, here */
459 MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventSize);
461 MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId);
467 int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
471 msg_error_t err = MSG_SUCCESS;
473 bool sendNoti = true;
474 bool isClass2msg = false;
477 if (!pCmd || !ppEvent) {
478 MSG_DEBUG("pCmd or ppEvent is null");
482 /* Get Incoming Message */
483 MSG_MESSAGE_INFO_S msgInfo;
484 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
486 msgInfo.addressList = NULL;
487 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
489 MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo);
491 /* broadcast to listener threads, here */
492 msg_id_list_s msgIdList;
493 msg_message_id_t msgIds[2];
494 msg_message_id_t class2msgId = 0;
495 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
497 #ifdef MSG_NOTI_INTEGRATION
498 if (msgInfo.msgType.classType == MSG_CLASS_2) {
499 class2msgId = msgInfo.msgId;
505 err = MsgHandleIncomingMsg(&msgInfo, &sendNoti);
507 if (msgInfo.msgType.mainType == MSG_SMS_TYPE) {
508 /* Send system event */
512 char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
513 snprintf(msgId, sizeof(msgId), "%u", msgInfo.msgId);
514 bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
516 if (msgInfo.msgType.subType >= MSG_WAP_SI_SMS && msgInfo.msgType.subType <= MSG_WAP_CO_SMS) {
517 bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_PUSH);
519 bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS);
520 bundle_add_str(b, "cmd", "incoming_msg");
521 msg_launch_app(MSG_MGR_APP_ID, b);
523 eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
528 if (isClass2msg == true) {
529 msgIdList.nCount = 2;
530 msgIds[0] = class2msgId;
531 msgIds[1] = msgInfo.msgId;
532 msgIdList.msgIdList = msgIds;
535 msgIdList.nCount = 1;
536 msgIds[0] = msgInfo.msgId;
537 msgIdList.msgIdList = msgIds;
540 if (sendNoti == true) {
541 MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo);
542 if (msgInfo.msgType.subType > MSG_TYPE0_SMS && msgInfo.msgType.subType < MSG_WAP_SI_SMS) { /* if it is replacement message. */
543 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
545 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
547 } else if (msgInfo.msgPort.valid || (msgInfo.msgType.subType >= MSG_MWI_VOICE_SMS && msgInfo.msgType.subType <= MSG_MWI_OTHER_SMS)) {
548 MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo);
549 } else if (msgInfo.folderId == MSG_SPAMBOX_ID || msgInfo.bRestricted == true) {
550 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
551 } else if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS || msgInfo.msgType.subType == MSG_DELIVERYIND_MMS) {
552 MsgTransactionManager::instance()->broadcastReportMsgCB(err, MSG_REPORT_TYPE_DELIVERY, &msgInfo);
553 } else if (msgInfo.msgType.subType == MSG_READORGIND_MMS) {
554 MsgTransactionManager::instance()->broadcastReportMsgCB(err, MSG_REPORT_TYPE_READ, &msgInfo);
557 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
558 MsgStoAutoDeleteConversation(msgInfo.threadId, &msgIdList);
559 if (msgIdList.msgIdList) {
560 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
561 delete [] (char*)msgIdList.msgIdList;
564 #ifdef FEATURE_SMS_CDMA
565 eventSize = MsgMakeEvent(&msgInfo.msgId, sizeof(msg_message_id_t), MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)ppEvent);
567 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)ppEvent);
570 if (msgInfo.bTextSms == false) {
571 MsgDeleteFile(msgInfo.msgData); /*ipc */
572 memset(msgInfo.msgData, 0x00, sizeof(msgInfo.msgData));
580 int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
584 if (!pCmd || !ppEvent) {
585 MSG_DEBUG("pCmd or ppEvent is null");
589 msg_error_t err = MSG_SUCCESS;
592 MSG_MESSAGE_INFO_S msgInfo;
593 msg_request_id_t reqID;
595 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
597 msgInfo.addressList = NULL;
598 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
600 memcpy(&reqID, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_request_id_t));
601 MsgDecodeMsgInfo((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t), &msgInfo);
603 MSG_DEBUG(" pMsg = %s, pReqId = %d ", msgInfo.msgData, reqID);
604 MSG_DEBUG(" msgtype subtype is [%d]", msgInfo.msgType.subType);
606 /* For Storage change callback */
607 msg_id_list_s msgIdList;
608 msg_message_id_t msgIds[1];
609 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
611 msgIdList.nCount = 1;
612 msgIds[0] = msgInfo.msgId;
613 msgIdList.msgIdList = msgIds;
615 MsgDbHandler *dbHandle = getDbHandle();
617 MSG_ADDRESS_INFO_S *tmpAddr = NULL;
618 err = MsgStoGetAddressByMsgId(dbHandle, msgInfo.msgId, &tmpAddrCnt, &tmpAddr);
619 if (err != MSG_SUCCESS) {
620 MSG_DEBUG("MsgStoGetAddressByMsgId() fail.");
623 if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) {
624 if (msgInfo.networkStatus != MSG_NETWORK_RETRIEVE_SUCCESS) {
625 if (msgInfo.addressList) {
626 delete[] msgInfo.addressList;
627 msgInfo.addressList = NULL;
630 msgInfo.addressList = tmpAddr;
631 msgInfo.nAddressCnt = tmpAddrCnt;
639 msg_thread_id_t prev_conv_id = MsgGetThreadId(dbHandle, msgInfo.msgId);
640 MSG_SUB_TYPE_T recv_sub_type = msgInfo.msgType.subType; /* Check retrieve mode to determine broadcast type */
642 err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID);
644 if (err != MSG_SUCCESS) {
645 MSG_DEBUG("MsgHandleMmsConfIncomingMsg failed.");
646 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)ppEvent);
649 MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData;
651 if (pMmsRecvData->msgAppId.valid == true) {
652 MSG_DEBUG("valid : %d, appId : %s", pMmsRecvData->msgAppId.valid, pMmsRecvData->msgAppId.appId);
654 msgInfo.bTextSms = true;
655 msgInfo.dataSize = 0 ;
656 memset(msgInfo.msgData, 0x00, sizeof(MMS_RECV_DATA_S));
659 /* broadcast to listener threads, here */
660 MsgTransactionManager::instance()->broadcastMMSConfCB(msgInfo.networkStatus, &msgInfo, pMmsRecvData);
662 /* determine broadcast type with retrieve mode */
663 if (recv_sub_type == MSG_RETRIEVE_AUTOCONF_MMS) {
664 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
666 if (prev_conv_id == msgInfo.threadId
667 || msgInfo.networkStatus == MSG_NETWORK_RETRIEVE_FAIL || msgInfo.networkStatus == MSG_NETWORK_RETRIEVE_PENDING) {
668 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
670 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
671 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
675 /* make return event */
676 eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent);
678 } else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS || msgInfo.msgType.subType == MSG_SENDCONF_MMS) {
679 if (msgInfo.addressList) {
680 delete[] msgInfo.addressList;
681 msgInfo.addressList = NULL;
684 msgInfo.addressList = tmpAddr;
685 msgInfo.nAddressCnt = tmpAddrCnt;
687 MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(reqID);
689 /* when no sent status cb is found */
691 /* No need to update javaMMS sent messages */
692 javamms_list& listenerList = MsgTransactionManager::instance()->getJavaMMSList();
693 javamms_list::iterator it = listenerList.begin();
695 MSG_DEBUG("listenerList size:%d ", listenerList.size());
697 if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL && msgInfo.msgType.subType == MSG_SENDREQ_MMS) {
698 for ( ; it != listenerList.end() ; it++) {
699 if (strstr(it->pduFileName, "JAVA")) {
700 MSG_SEC_DEBUG("JAVA MMS fileName:%s", it->pduFileName);
701 MsgDeleteFile(it->pduFileName); /* ipc */
702 listenerList.erase(it);
703 goto __BYPASS_UPDATE;
707 /*msgData has MMS_RECV_DATA_S */
708 MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData;
710 for ( ; it != listenerList.end() ; it++) {
711 if (!strcmp(it->id, pMmsRecvData->szTrID)) {
712 MSG_SEC_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s", pMmsRecvData->szTrID, it->id);
713 MsgDeleteFile(it->pduFileName); /* ipc */
714 listenerList.erase(it);
715 goto __BYPASS_UPDATE;
720 MSG_DEBUG("prxInfo is NULL");
723 err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID);
725 if (err != MSG_SUCCESS) {
726 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, err, (void**)ppEvent);
730 if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL) {
731 MSG_DEBUG("message-dialog: send fail");
732 MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED, true, msgInfo.msgId);
734 MSG_DEBUG("message-dialog: send success");
736 #if 0 /* disabled as per UX request to not show success notification : 2015. 09. 18 */
739 if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) {
740 MSG_DEBUG("MsgSettingGetBool is failed.");
744 MsgInsertTicker("Multimedia message sent.", MULTIMEDIA_MESSAGE_SENT, false, 0);
748 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
749 MSG_SEC_DEBUG("Enter MsgAddPhoneLog() : msgInfo.addressList[0].addressVal [%s]", msgInfo.addressList[0].addressVal);
750 MsgAddPhoneLog(&msgInfo);
751 /* Send system event */
755 bundle_add_str(b, EVT_KEY_MSG_TYPE, EVT_VAL_MMS);
756 char msgId[MSG_EVENT_MSG_ID_LEN] = {0, };
757 snprintf(msgId, sizeof(msgId), "%u", msgInfo.msgId);
758 bundle_add_str(b, EVT_KEY_MSG_ID, msgId);
759 eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b);
760 bundle_add_str(b, "cmd", "incoming_msg");
761 msg_launch_app(MSG_MGR_APP_ID, b);
764 #endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
768 if (prxInfo->handleAddr == 0) {
769 /* just making data which will be passed to plugin. it indicates "handling evt success" */
770 MsgTransactionManager::instance()->delProxyInfo(reqID);
772 unsigned long ret[3] = {0}; /* reqid, status, object */
774 ret[0] = (unsigned long)reqID;
775 ret[1] = (unsigned long)msgInfo.networkStatus;
776 ret[2] = prxInfo->handleAddr;
778 /* Make Event Data for APP */
779 eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
781 /* Send to listener thread, here */
782 MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize);
784 MsgTransactionManager::instance()->delProxyInfo(reqID);
788 eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent);
789 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
791 /*To avoid prevent memory leak.. this case will not occur. eventsize will be return as 0. */
802 int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
809 if (!pCmd || !ppEvent) {
810 MSG_DEBUG("pCmd or ppEvent is null");
814 MSG_PUSH_MESSAGE_DATA_S pushData;
815 memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
817 /* Get Incoming Message */
818 memcpy(&pushData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_MESSAGE_DATA_S));
822 /* broadcast to listener threads, here */
823 MsgTransactionManager::instance()->broadcastPushMsgCB(MSG_SUCCESS, &pushData);
825 /* Make Event Data */
826 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
832 int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
836 msg_error_t err = MSG_SUCCESS;
840 if (!pCmd || !ppEvent) {
841 MSG_DEBUG("pCmd or ppEvent is null");
845 /* Get Incoming Message */
847 memset(&cbMsg, 0x00, sizeof(MSG_CB_MSG_S));
849 memcpy(&cbMsg, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_CB_MSG_S));
851 MSG_MESSAGE_INFO_S msgInfo;
852 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
854 msgInfo.addressList = NULL;
855 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
857 MsgDecodeMsgInfo((char *)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_CB_MSG_S), &msgInfo);
859 MSG_DEBUG("CB MSG ADDRESS COUNT=%d", msgInfo.nAddressCnt);
861 if (MsgStoAddCBMsg(&msgInfo) != MSG_SUCCESS) {
862 MSG_DEBUG("MsgStoAddCBMsg is fail");
865 if (msgInfo.msgType.classType == MSG_CLASS_0) {
866 MsgLaunchClass0(msgInfo.msgId);
867 MsgSoundPlayStart(&(msgInfo.addressList[0]), MSG_SOUND_PLAY_USER);
869 MsgInsertNotification(&msgInfo);
874 msg_id_list_s msgIdList;
875 msg_message_id_t msgIds[1];
876 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
878 msgIdList.nCount = 1;
879 msgIds[0] = (msg_message_id_t)msgInfo.msgId;
880 msgIdList.msgIdList = msgIds;
881 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
882 MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg, msgInfo.msgId);
884 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)ppEvent);
891 int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
894 if (!pCmd || !ppEvent) {
895 MSG_DEBUG("pCmd or ppEvent is null");
899 MSG_SYNCML_MESSAGE_DATA_S syncMLData;
900 memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S));
902 /* Get Incoming Message */
903 memcpy(&syncMLData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_SYNCML_MESSAGE_DATA_S));
907 /* broadcast to listener threads, here */
908 MsgTransactionManager::instance()->broadcastSyncMLMsgCB(MSG_SUCCESS, &syncMLData);
910 /* Make Event Data */
911 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
917 int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
922 if (!pCmd || !ppEvent) {
923 MSG_DEBUG("pCmd or ppEvent is null");
927 MSG_LBS_MESSAGE_DATA_S lbsData;
928 memset(&lbsData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S));
930 /* Get Incoming Message */
931 memcpy(&lbsData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_LBS_MESSAGE_DATA_S));
933 /* broadcast to listener threads, here */
934 MsgTransactionManager::instance()->broadcastLBSMsgCB(MSG_SUCCESS, &lbsData);
936 /* Make Event Data */
937 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
943 int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent)
945 msg_error_t err = MSG_SUCCESS;
947 char* encodedData = NULL;
948 unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
952 msg_message_id_t msgId = 0;
956 if (!pCmd || !ppEvent) {
957 MSG_DEBUG("pCmd or ppEvent is null");
962 memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t));
963 memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(int));
965 err = MsgStoGetSyncMLExtId(msgId, &extId);
967 if (err == MSG_SUCCESS) {
968 MSG_DEBUG("Command Handle Success : MsgStoGetSyncMLExtId()");
970 /* broadcast to listener threads, here */
971 MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, msgId, extId);
973 MSG_DEBUG("Command Handle Fail : MsgStoGetSyncMLExtId()");
976 /* Make Event Data to Client */
977 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SYNCML_OPERATION, err, (void**)ppEvent);
983 int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent)
986 if (!pCmd || !ppEvent) {
987 MSG_DEBUG("pCmd or ppEvent is null");
991 msg_id_list_s msgIdList;
992 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
993 msg_storage_change_type_t storageChangeType;
995 memcpy(&msgIdList.nCount, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int));
997 msgIdList.msgIdList = new msg_message_id_t[msgIdList.nCount];
998 for (int i = 0; i < msgIdList.nCount; i++) {
999 memcpy(&msgIdList.msgIdList[i], (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+i*sizeof(msg_message_id_t)), sizeof(msg_message_id_t));
1002 memcpy(&storageChangeType, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(msg_message_id_t)*msgIdList.nCount)), sizeof(msg_storage_change_type_t));
1004 char* encodedData = NULL;
1005 unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
1009 MSG_DEBUG("msgIdList.nCount [%d]", msgIdList.nCount);
1010 for (int i = 0; i < msgIdList.nCount; i++) {
1011 MSG_DEBUG("storageChangeType : [%d], msg Id : [%d]", storageChangeType, msgIdList.msgIdList[i]);
1014 /* broadcast to listener threads, here */
1015 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, storageChangeType, &msgIdList);
1017 if (msgIdList.msgIdList) {
1018 delete [] msgIdList.msgIdList;
1021 /* Make Event Data to Client */
1022 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_STORAGE_CHANGE_IND, MSG_SUCCESS, (void**)ppEvent);
1027 int MsgThreadChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent)
1030 if (!pCmd || !ppEvent) {
1031 MSG_DEBUG("pCmd or ppEvent is null");
1035 msg_storage_change_type_t storageChangeType;
1036 msg_thread_id_t threadId;
1038 memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_thread_id_t));
1039 memcpy(&storageChangeType, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), sizeof(msg_storage_change_type_t));
1041 char* encodedData = NULL;
1042 unique_ptr<char*, void(*)(char**)> buf(&encodedData, unique_ptr_deleter);
1046 MSG_DEBUG("storageChangeType : [%d], thread Id : [%d]", storageChangeType, threadId);
1048 /* broadcast to listener threads, here */
1049 MsgTransactionManager::instance()->broadcastThreadChangeCB(MSG_SUCCESS, storageChangeType, threadId);
1051 /* Make Event Data to Client */
1052 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_THREAD_CHANGE_IND, MSG_SUCCESS, (void**)ppEvent);
1057 int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent)
1059 msg_error_t err = MSG_SUCCESS;
1062 if (!pCmd || !ppEvent) {
1063 MSG_DEBUG("pCmd or ppEvent is null");
1067 /* Get the msgIdList of sending failed message. */
1068 int *failed_msg_list = NULL;
1070 unique_ptr<int*, void(*)(int**)> failed_list(&failed_msg_list, unique_ptr_deleter);
1073 err = MsgStoGetFailedMessage(&failed_msg_list, &count);
1074 if (err != MSG_SUCCESS) {
1075 MSG_DEBUG("MsgStoGetFailedMessage() Error!! [%d]", err);
1078 for (int i = 0; i < count ; ++i) {
1079 MSG_REQUEST_INFO_S reqInfo = {0};
1080 reqInfo.msgInfo.addressList = NULL;
1081 unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&reqInfo.msgInfo.addressList, unique_ptr_deleter);
1082 reqInfo.msgInfo.msgId = failed_msg_list[i];
1083 err = MsgStoGetMessage(reqInfo.msgInfo.msgId, &(reqInfo.msgInfo), &(reqInfo.sendOptInfo));
1085 if (err != MSG_SUCCESS) {
1086 MSG_DEBUG("MsgStoGetMessage() Error!! [%d]", err);
1089 if (reqInfo.msgInfo.msgType.subType == MSG_GET_MMS || \
1090 reqInfo.msgInfo.msgType.subType == MSG_NOTIFICATIONIND_MMS || \
1091 reqInfo.msgInfo.msgType.subType == MSG_RETRIEVE_MMS) {
1092 MSG_WARN("retrieve pending id[%d]", reqInfo.msgInfo.msgId);
1093 /* For retrieving failed msg (MMS)*/
1094 reqInfo.msgInfo.msgType.subType = MSG_RETRIEVE_MMS;
1095 reqInfo.msgInfo.folderId = MSG_OUTBOX_ID; /* outbox fixed */
1096 reqInfo.msgInfo.networkStatus = MSG_NETWORK_RETRIEVING;
1098 /* For sending failed msg */
1099 reqInfo.msgInfo.networkStatus = MSG_NETWORK_SENDING;
1102 msg_id_list_s msgIdList;
1103 msg_message_id_t msgIds[1];
1104 memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
1106 msgIdList.nCount = 1;
1107 msgIds[0] = reqInfo.msgInfo.msgId;
1108 msgIdList.msgIdList = msgIds;
1110 err = MsgSubmitReq(&reqInfo, false);
1112 if (err == MSG_SUCCESS) {
1113 MSG_DEBUG("MsgSubmitReq() Success");
1114 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
1116 MSG_DEBUG("MsgSubmitReq() Fail, [%d]", err);
1120 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_RESEND_MESSAGE, err, (void**)ppEvent);
1126 #ifdef FEATURE_SMS_CDMA
1127 int MsgCheckUniquenessHandler(const MSG_CMD_S *pCmd, char **ppEvent)
1131 msg_error_t err = MSG_SUCCESS;
1135 if (!pCmd || !ppEvent) {
1136 MSG_DEBUG("pCmd or ppEvent is null");
1140 /* Get Incoming Message */
1142 memcpy(&bInsert, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(bool));
1144 msg_message_id_t msgId;
1145 memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(bool)), sizeof(msg_message_id_t));
1147 MSG_UNIQUE_INDEX_S p_msg;
1148 memcpy(&p_msg, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(bool)+sizeof(msg_message_id_t)), sizeof(MSG_UNIQUE_INDEX_S));
1150 MSG_DEBUG("Decoded Teleservice Msg Id = [%d]", p_msg.tele_msgId);
1151 MSG_DEBUG("Decoded Address = [%s]", p_msg.address);
1152 MSG_DEBUG("Decoded Sub Address = [%s]", p_msg.sub_address);
1154 err = MsgCheckUniqueness(bInsert, msgId, &p_msg);
1156 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_CHECK_UNIQUENESS, err, (void**)ppEvent);