3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
34 #include "MsgException.h"
35 #include "MsgUtilFile.h"
36 #include "MsgContact.h"
37 #include "MsgSoundPlayer.h"
38 #include "MsgGconfWrapper.h"
39 #include "MsgNotificationWrapper.h"
40 #include "MsgUtilFunction.h"
41 #include "MsgSubmitHandler.h"
42 #include "MsgDeliverHandler.h"
43 #include "MsgStorageHandler.h"
44 #include "MsgTransManager.h"
45 #include "MsgPluginManager.h"
46 #include "MsgCmdHandler.h"
49 /*==================================================================================================
50 FUNCTION IMPLEMENTATION
51 ==================================================================================================*/
52 int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent)
54 MSG_ERROR_T err = MSG_SUCCESS;
59 MSG_REQUEST_INFO_S reqInfo = {0,};
60 MSG_PROXY_INFO_S proxyInfo = {0,};
62 // Get Message Request
63 memcpy(&reqInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_REQUEST_INFO_S));
65 // Storing Request ID, Proxy Info for Sent Status CNF
66 memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)), sizeof(MSG_PROXY_INFO_S));
68 if (reqInfo.msgInfo.msgId > 0)
72 err = MsgSubmitReq(&reqInfo, false);
74 if (err == MSG_SUCCESS){
75 MSG_DEBUG("Command Handle Success : MsgSubmitReq()");
77 MSG_DEBUG("Command Handle Fail : MsgSubmitReq()");
80 int reqId = reqInfo.reqId;
81 proxyInfo.sentMsgId = reqInfo.msgInfo.msgId;
83 MSG_DEBUG("REQID: %d, MSGID: %d", reqId, proxyInfo.sentMsgId);
85 if (reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE) {
86 MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo);
87 } else if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE) {
88 // Retrieve MMS shall not be kept in sentMsg
89 if ((reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) ||
90 (reqInfo.msgInfo.msgType.subType == MSG_FORWARD_MMS) ||
91 (reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS))
92 MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo);
95 // keep transaction Id list for distinguish java MMS sent msg when sendconf received
96 if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE &&
97 reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) {
98 MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S trId={0};
99 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);
102 pFileName = strstr(reqInfo.msgInfo.msgData, "MSG_");
103 strncpy(trId.pduFileName, pFileName, MAX_COMMON_INFO_SIZE);
105 MSG_DEBUG("java MMS msg trId:%s filepath:%s ",trId.id, reqInfo.msgInfo.msgData);
107 MsgTransactionManager* tm = MsgTransactionManager::instance();
108 tm->setJavaMMSList(&trId);
112 eventSize = MsgMakeEvent(&reqId, sizeof(reqId), MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent);
114 /* reject_msg_support */
115 if(((reqInfo.msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) &&
116 (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE)))
117 err = MsgStoDeleteMessage(reqInfo.msgInfo.msgId, true);
118 /* reject_msg_support */
120 /** send storage CB */
121 if (err == MSG_SUCCESS && bNewMsg && reqInfo.msgInfo.msgPort.valid == false) {
123 MSG_MSGID_LIST_S msgIdList;
124 MSG_MESSAGE_ID_T msgIds[1];
125 memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S));
127 msgIdList.nCount = 1;
128 msgIds[0] = reqInfo.msgInfo.msgId;
129 msgIdList.msgIdList = msgIds;
131 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
137 int MsgCancelReqHandler(const MSG_CMD_S *pCmd, char **ppEvent)
139 MSG_ERROR_T err = MSG_SUCCESS;
144 MSG_REQUEST_ID_T* reqId = (MSG_REQUEST_ID_T*)pCmd->cmdData;
147 err = MsgCancelReq(*reqId);
149 if (err == MSG_SUCCESS)
151 MSG_DEBUG("Command Handle Success : MsgSubCancelReq()");
155 MSG_DEBUG("Command Handle Fail : MsgSubCancelReq()");
159 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_CANCEL_REQ, err, (void**)ppEvent);
165 int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
168 if( !pCmd || !ppEvent)
169 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
171 // Get Message Request
172 int listenerFd = *((int*) pCmd->cmdData);
173 MSG_DEBUG("Registering sent status CB for %d", listenerFd);
175 // storing dst fd in list
176 MsgTransactionManager::instance()->setSentStatusCB(listenerFd);
179 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SENT_STATUS_CB, MSG_SUCCESS, (void**)ppEvent);
185 int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
188 if( !pCmd || !ppEvent)
189 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
191 // Get Message Request
192 MSG_CMD_REG_INCOMING_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MSG_CB_S*) pCmd->cmdData;
193 MSG_DEBUG("Registering incoming SMS CB for fd %d mType %d port %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->port);
195 // storing dst fd in list
196 MsgTransactionManager::instance()->setIncomingMsgCB(pCmdData);
199 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
205 int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
208 if( !pCmd || !ppEvent)
209 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
211 // Get Message Request
212 MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S*) pCmd->cmdData;
213 MSG_DEBUG("Registering incoming MMS Conf CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId);
215 // storing dst fd in list
216 MsgTransactionManager::instance()->setMMSConfMsgCB(pCmdData);
219 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
225 int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
228 if( !pCmd || !ppEvent)
229 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
231 // Get Message Request
232 MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S*) pCmd->cmdData;
233 MSG_DEBUG("Registering incoming Sync ML Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
235 // storing dst fd in list
236 MsgTransactionManager::instance()->setSyncMLMsgCB(pCmdData);
239 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
245 int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
248 if( !pCmd || !ppEvent)
249 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
251 // Get Message Request
252 MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_LBS_MSG_CB_S*) pCmd->cmdData;
253 MSG_DEBUG("Registering incoming LBS Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
255 // storing dst fd in list
256 MsgTransactionManager::instance()->setLBSMsgCB(pCmdData);
259 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_LBS_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
265 int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
268 if( !pCmd || !ppEvent)
269 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
271 // Get Message Request
272 MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCmdData = (MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S*) pCmd->cmdData;
273 MSG_DEBUG("Registering SyncML Msg ooperation CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType);
275 // storing dst fd in list
276 MsgTransactionManager::instance()->setSyncMLMsgOperationCB(pCmdData);
279 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, MSG_SUCCESS, (void**)ppEvent);
285 int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
288 if( !pCmd || !ppEvent)
289 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
291 // Get Message Request
292 int listenerFd = *((int*) pCmd->cmdData);
293 MSG_DEBUG("Registering storage change CB for %d", listenerFd);
295 // storing dst fd in list
296 MsgTransactionManager::instance()->setStorageChangeCB(listenerFd);
299 int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_STORAGE_CHANGE_CB, MsgException::SUCCESS, (void**)ppEvent);
305 int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent)
308 if (!pCmd || !ppEvent)
309 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
311 // Get Message Request
312 MSG_SENT_STATUS_S* pStatus = (MSG_SENT_STATUS_S*) pCmd->cmdData;
314 MSG_DEBUG("REQID %d, STATUS %d", pStatus->reqId, pStatus->status);
316 // storing dst fd in list
317 MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(pStatus->reqId);
319 // when no sent status cb is found (in case of mobile tracker)
322 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
325 MSG_DEBUG("REQID %d, listenerFD %d, handleAddr %x, msgId %d", pStatus->reqId, prxInfo->listenerFd, prxInfo->handleAddr, prxInfo->sentMsgId);
327 // if APP send and quit(not exist at this time), don't send the data up.
328 if (prxInfo->handleAddr == 0)
330 // just making data which will be passed to plugin. it indicates "handling evt success"
331 MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId);
333 //in case of scheduled message sending, scheduled msg table should be updated.
334 MsgStoDeleteScheduledMessage(prxInfo->sentMsgId);
336 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
339 unsigned int ret[3] = {0}; //3// reqid, status, object
341 ret[0] = pStatus->reqId;
342 ret[1] = pStatus->status;
343 ret[2] = prxInfo->handleAddr;
345 // Make Event Data for APP
346 int eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
348 // Send to listener thread, here
349 MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventSize);
351 MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId);
357 int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
361 MSG_ERROR_T err = MSG_SUCCESS;
363 bool sendNoti = true;
366 if (!pCmd || !ppEvent)
367 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
369 // Get Incoming Message
370 MSG_MESSAGE_INFO_S msgInfo;
371 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
373 memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S));
376 err = MsgHandleIncomingMsg(&msgInfo, &sendNoti);
378 // broadcast to listener threads, here
379 MSG_MSGID_LIST_S msgIdList;
380 MSG_MESSAGE_ID_T msgIds[1];
381 memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S));
383 msgIdList.nCount = 1;
384 msgIds[0] = msgInfo.msgId;
385 msgIdList.msgIdList = msgIds;
387 if (sendNoti == true) {
388 MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo);
389 MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
392 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MSG_IND, err, (void**)ppEvent);
399 int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
402 MSG_ERROR_T err = MSG_SUCCESS;
405 MSG_MESSAGE_INFO_S msgInfo = {0};
406 MSG_REQUEST_ID_T reqID;
408 memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S));
409 memcpy(&reqID, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), sizeof(MSG_REQUEST_ID_T));
411 MSG_DEBUG(" pMsg = %s, pReqId = %d ", msgInfo.msgData, reqID);
412 MSG_DEBUG(" msgtype subtype is [%d]", msgInfo.msgType.subType);
414 // For Storage change callback
415 MSG_MSGID_LIST_S msgIdList;
416 MSG_MESSAGE_ID_T msgIds[1];
417 memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S));
419 msgIdList.nCount = 1;
420 msgIds[0] = msgInfo.msgId;
421 msgIdList.msgIdList = msgIds;
423 err = MsgStoGetAddrInfo(msgInfo.msgId, &(msgInfo.addressList[0]));
425 if (err == MSG_SUCCESS) {
426 MSG_DEBUG("MmsStoGetAddrInfo() success.");
427 msgInfo.nAddressCnt = 1;
429 MSG_DEBUG("MmsStoGetAddrInfo() fail.");
432 if(msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) {
434 err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID);
436 if(err != MSG_SUCCESS)
439 MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData;
441 if (pMmsRecvData->msgAppId.valid == true) {
442 MSG_DEBUG("valid : %d, appId : %s", pMmsRecvData->msgAppId.valid, pMmsRecvData->msgAppId.appId);
444 msgInfo.bTextSms = true;
445 msgInfo.dataSize = 0 ;
446 memset(msgInfo.msgData, 0x00, sizeof(MMS_RECV_DATA_S));
449 eventsize = MsgMakeEvent(&msgInfo, sizeof(MSG_MESSAGE_INFO_S), MSG_EVENT_PLG_INCOMING_MMS_CONF, msgInfo.networkStatus, (void**)ppEvent);
451 // broadcast to listener threads, here
452 MsgTransactionManager::instance()->broadcastMMSConfCB(msgInfo.networkStatus, &msgInfo, pMmsRecvData);
453 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
454 } else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS || msgInfo.msgType.subType == MSG_SENDCONF_MMS) {
455 MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(reqID);
457 // when no sent status cb is found (in case of mobile tracker)
459 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
461 // No need to update javaMMS sent messages
462 javamms_list& listenerList = MsgTransactionManager::instance()->getJavaMMSList();
463 javamms_list::iterator it = listenerList.begin();
465 MSG_DEBUG("listenerList size:%d ",listenerList.size());
467 if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL && msgInfo.msgType.subType == MSG_SENDREQ_MMS) {
468 for ( ; it != listenerList.end() ; it++) {
469 if (strstr(it->pduFileName,"JAVA")) {
470 MSG_DEBUG("JAVA MMS fileName:%s", it->pduFileName);
471 MsgDeleteFile(it->pduFileName); // ipc
472 listenerList.erase(it);
473 goto __BYPASS_UPDATE;
477 //msgData has MMS_RECV_DATA_S
478 MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData;
480 for ( ; it != listenerList.end() ; it++) {
481 if(!strcmp(it->id, pMmsRecvData->szTrID)) {
482 MSG_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s",pMmsRecvData->szTrID, it->id);
483 MsgDeleteFile(it->pduFileName); // ipc
484 listenerList.erase(it);
485 goto __BYPASS_UPDATE;
490 err = MsgHandleMmsConfIncomingMsg(&msgInfo, reqID);
492 if(err != MSG_SUCCESS)
496 if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL) {
497 MSG_DEBUG("message-dialog: send fail");
498 MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED);
500 MSG_DEBUG("message-dialog: send success");
501 MsgInsertTicker("Multimedia message sent.", MULTIMEDIA_MESSAGE_SENT);
504 if (prxInfo->handleAddr == 0) {
505 // just making data which will be passed to plugin. it indicates "handling evt success"
506 MsgTransactionManager::instance()->delProxyInfo(reqID);
508 //in case of scheduled message sending, scheduled msg table should be updated.
509 MsgStoDeleteScheduledMessage(prxInfo->sentMsgId);
511 return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
514 unsigned int ret[3] = {0}; //3// reqid, status, object
517 ret[1] = msgInfo.networkStatus;
518 ret[2] = prxInfo->handleAddr;
520 // Make Event Data for APP
521 eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent);
523 // Send to listener thread, here
524 MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize);
526 MsgTransactionManager::instance()->delProxyInfo(reqID);
528 msgInfo.bTextSms = true;
529 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList);
537 int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
540 if (!pCmd || !ppEvent)
541 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
543 MSG_SYNCML_MESSAGE_DATA_S syncMLData;
544 memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S));
546 // Get Incoming Message
547 memcpy(&syncMLData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_SYNCML_MESSAGE_DATA_S));
551 // broadcast to listener threads, here
552 MsgTransactionManager::instance()->broadcastSyncMLMsgCB(MSG_SUCCESS, &syncMLData);
555 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
561 int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
566 if (!pCmd || !ppEvent)
567 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
569 MSG_LBS_MESSAGE_DATA_S lbsData;
570 memset(&lbsData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S));
572 // Get Incoming Message
573 memcpy(&lbsData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_LBS_MESSAGE_DATA_S));
575 // broadcast to listener threads, here
576 MsgTransactionManager::instance()->broadcastLBSMsgCB(MSG_SUCCESS, &lbsData);
579 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
585 int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent)
587 MSG_ERROR_T err = MSG_SUCCESS;
589 char* encodedData = NULL;
590 AutoPtr<char> buf(&encodedData);
594 MSG_MESSAGE_ID_T msgId = 0;
598 if (!pCmd || !ppEvent)
599 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
602 memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_ID_T));
603 memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_ID_T)), sizeof(int));
605 err = MsgStoGetSyncMLExtId(msgId, &extId);
607 if (err == MSG_SUCCESS)
609 MSG_DEBUG("Command Handle Success : MsgStoGetSyncMLExtId()");
611 // broadcast to listener threads, here
612 MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, msgId, extId);
616 MSG_DEBUG("Command Handle Fail : MsgStoGetSyncMLExtId()");
619 // Make Event Data to Client
620 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SYNCML_OPERATION, err, (void**)ppEvent);
626 int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent)
629 if (!pCmd || !ppEvent)
630 THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
632 MSG_STORAGE_CHANGE_TYPE_T storageChangeType;
634 MSG_MESSAGE_INFO_S msgInfo;
635 memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
637 memcpy(&msgInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_MESSAGE_INFO_S));
638 memcpy(&storageChangeType, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_MESSAGE_INFO_S)), sizeof(MSG_STORAGE_CHANGE_TYPE_T));
640 char* encodedData = NULL;
641 AutoPtr<char> buf(&encodedData);
645 MSG_DEBUG("storageChangeType : [%d], msg Id : [%d]", storageChangeType, msgInfo.msgId);
647 // broadcast to listener threads, here
648 MSG_MSGID_LIST_S msgIdList;
649 MSG_MESSAGE_ID_T msgIds[1];
650 memset(&msgIdList, 0x00, sizeof(MSG_MSGID_LIST_S));
652 msgIdList.nCount = 1;
653 msgIds[0] = msgInfo.msgId;
654 msgIdList.msgIdList = msgIds;
656 MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, storageChangeType, &msgIdList);
658 // Make Event Data to Client
659 eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_STORAGE_CHANGE_IND, MSG_SUCCESS, (void**)ppEvent);