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 "MsgUtilFile.h"
24 #include "MsgGconfWrapper.h"
25 #include "MsgProxyContact.h"
26 #include "MsgProxyListener.h"
27 #include "MsgHandle.h"
28 #include "MsgSqliteWrapper.h"
30 /*==================================================================================================
31 IMPLEMENTATION OF MsgHandle - Control Member Functions
32 ==================================================================================================*/
33 MsgHandle::MsgHandle() : mCounter(0), mClientSock()
35 memset(mConnectionId, 0x00, sizeof(mConnectionId));
36 memset(mCookie, 0x00, sizeof(mCookie));
40 MsgHandle::~MsgHandle()
45 void MsgHandle::openHandle()
49 MsgProxyListener::instance()->insertOpenHandleSet(this);
51 /* server is currently booting and service is not available until the end of booting */
52 if (MsgSettingGetBool(VCONFKEY_MSG_SERVER_READY, &bReady) != MSG_SUCCESS)
53 MSG_INFO("MsgSettingGetBool() is failed");
55 if (bReady == false) {
56 THROW(MsgException::SERVER_READY_ERROR, "Msg Server is not ready !!!!!");
58 MSG_INFO("Msg Server is ready !!!!!");
64 /* Check cynara permission */
65 if (checkPermission() == MSG_ERR_PERMISSION_DENIED) {
66 THROW(MsgException::SECURITY_ERROR, "Client doesn't have permission");
71 void MsgHandle::closeHandle(MsgHandle* pHandle)
75 /* Remove CB List of closing Handle */
76 MsgProxyListener* eventListener = MsgProxyListener::instance();
78 eventListener->clearListOfClosedHandle(pHandle);
79 /* eventListener->stop(); */
81 /* Close Socket IPC */
84 #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
85 /* Close Contact Service */
86 if (MsgCloseContactSvc() != MSG_SUCCESS) {
87 MSG_WARN("Fail to close contact service.");
89 #endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
90 removeDbHandle(); /* unregister db handler */
96 void MsgHandle::connectSocket()
98 mClientSock.connect(MSG_SOCKET_PATH);
102 void MsgHandle::disconnectSocket()
108 void MsgHandle::write(const char *pCmdData, int cmdSize, char **ppEvent)
110 if (pCmdData == NULL || ppEvent == NULL) {
111 THROW(MsgException::INVALID_PARAM, "Param is NULL");
116 /* Send Command to MSG FW */
117 MsgMutexLocker lock(mx);
118 ret = mClientSock.write(pCmdData, cmdSize);
120 THROW(MsgException::IPC_ERROR, "IPC write error");
122 char *tmpEvent = NULL;
125 /* Receive Result from MSG FW */
128 if (tmpEvent == NULL) {
129 MSG_DEBUG("Event Data is NULL!!");
133 if (!checkEventData(tmpEvent)) {
144 void MsgHandle::read(char **ppEvent)
146 unsigned int dataSize = 0;
148 int ret = mClientSock.read(ppEvent, &dataSize);
150 if (ret == CLOSE_CONNECTION_BY_SIGNAL) {
151 THROW(MsgException::IPC_ERROR, "Server closed connection");
156 void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_INFO_S *pDest)
160 pDest->msgId = pSrc->msgId;
161 pDest->threadId = pSrc->threadId;
162 pDest->folderId = pSrc->folderId;
163 pDest->msgType.mainType = pSrc->mainType;
164 pDest->msgType.subType = pSrc->subType;
165 pDest->msgType.classType = pSrc->classType;
166 pDest->storageId = pSrc->storageId;
168 if (g_list_length(pSrc->addressList) > 0) {
169 msg_struct_s *addr_info = NULL;
170 MSG_ADDRESS_INFO_S *address = NULL;
172 pDest->nAddressCnt = g_list_length(pSrc->addressList);
173 pDest->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pDest->nAddressCnt];
174 memset(pDest->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pDest->nAddressCnt);
176 for (int i = 0; i < pDest->nAddressCnt; i++) {
177 addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList, (guint)i);
178 address = (MSG_ADDRESS_INFO_S *)addr_info->data;
180 pDest->addressList[i].addressType = address->addressType;
181 pDest->addressList[i].recipientType = address->recipientType;
182 pDest->addressList[i].contactId = address->contactId;
183 strncpy(pDest->addressList[i].addressVal, address->addressVal, MAX_ADDRESS_VAL_LEN);
184 strncpy(pDest->addressList[i].displayName, address->displayName, MAX_DISPLAY_NAME_LEN);
187 msg_struct_list_s *addr_info_s = pSrc->addr_list;
189 if (addr_info_s && (addr_info_s->nCount > 0)) {
190 msg_struct_s *addr_info = NULL;
191 MSG_ADDRESS_INFO_S *address = NULL;
193 pDest->nAddressCnt = addr_info_s->nCount;
195 pDest->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * addr_info_s->nCount];
196 memset(pDest->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * addr_info_s->nCount);
198 for (int i = 0; i < addr_info_s->nCount; i++) {
199 addr_info = (msg_struct_s *)addr_info_s->msg_struct_info[i];
201 address = (MSG_ADDRESS_INFO_S *)addr_info->data;
203 pDest->addressList[i].addressType = address->addressType;
204 pDest->addressList[i].recipientType = address->recipientType;
205 pDest->addressList[i].contactId = address->contactId;
206 strncpy(pDest->addressList[i].addressVal, address->addressVal, MAX_ADDRESS_VAL_LEN);
207 strncpy(pDest->addressList[i].displayName, address->displayName, MAX_DISPLAY_NAME_LEN);
212 strncpy(pDest->replyAddress, pSrc->replyAddress, MAX_PHONE_NUMBER_LEN);
213 strncpy(pDest->subject, pSrc->subject, MAX_SUBJECT_LEN);
215 pDest->displayTime = pSrc->displayTime;
216 pDest->networkStatus = pSrc->networkStatus;
217 pDest->encodeType = pSrc->encodeType;
218 pDest->bRead = pSrc->bRead;
219 pDest->bProtected = pSrc->bProtected;
220 pDest->bBackup = pSrc->bBackup;
221 pDest->priority = pSrc->priority;
222 pDest->direction = pSrc->direction;
225 pDest->msgPort.valid = pSrc->bPortValid;
227 if (pDest->msgPort.valid == true) {
228 pDest->msgPort.dstPort = pSrc->dstPort;
229 pDest->msgPort.srcPort = pSrc->srcPort;
232 MSG_DEBUG("nSize = %d", pSrc->dataSize);
233 MSG_DEBUG("mainType = %d", pSrc->mainType);
235 if (pSrc->mainType == MSG_SMS_TYPE) {
236 if (pSrc->pData != NULL) {
237 pDest->bTextSms = true;
238 pDest->dataSize = pSrc->dataSize;
240 memset(pDest->msgText, 0x00, sizeof(pDest->msgText));
242 if (pSrc->dataSize > MAX_MSG_TEXT_LEN) {
243 /* Save Message Data into File */
244 char fileName[MSG_FILENAME_LEN_MAX+1];
245 memset(fileName, 0x00, sizeof(fileName));
247 if (MsgCreateFileName(fileName) == false)
248 THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
250 MSG_SEC_DEBUG("Save pSrc->pData into file : size[%d] name[%s]", pDest->dataSize, fileName);
252 if (MsgWriteIpcFile(fileName, (char*)pSrc->pData, pSrc->dataSize) == false)
253 THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
255 memset(pDest->msgData, 0x00, sizeof(pDest->msgData));
256 strncpy(pDest->msgData, fileName, MAX_MSG_DATA_LEN);
258 pDest->bTextSms = false;
261 if (pDest->encodeType == MSG_ENCODE_8BIT)
262 memcpy(pDest->msgText, pSrc->pData, pSrc->dataSize);
264 strncpy(pDest->msgText, (char*)pSrc->pData, pSrc->dataSize);
267 MSG_DEBUG("pData = %s", pSrc->pData);
269 MSG_DEBUG("pSrc->pData is NULL.");
270 pDest->bTextSms = true;
274 MSG_SEC_DEBUG("msgText = %s", pDest->msgText);
275 } else if (pSrc->mainType == MSG_MMS_TYPE) {
276 pDest->bTextSms = false;
277 pDest->dataSize = pSrc->dataSize;
279 if (pSrc->subType == MSG_READREPLY_MMS) {
280 memset(pDest->msgData, 0x00, sizeof(pDest->msgData));
282 if (pSrc->mmsDataSize < MAX_MSG_DATA_LEN)
283 memcpy(pDest->msgData, pSrc->pMmsData, pSrc->mmsDataSize);
285 memcpy(pDest->msgData, pSrc->pMmsData, MAX_MSG_DATA_LEN);
288 /* Save Message Data into File */
289 char fileName[MSG_FILENAME_LEN_MAX+1];
290 memset(fileName, 0x00, sizeof(fileName));
292 if (MsgCreateFileName(fileName) == false)
293 THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
295 /* change file extension in case of java MMS msg */
296 if (pSrc->subType == MSG_SENDREQ_JAVA_MMS) {
297 char* pFileNameExt = NULL;
298 pFileNameExt = strstr(fileName, "DATA");
300 snprintf(pFileNameExt, strlen("JAVA")+1, "JAVA");
303 MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]", pSrc->mmsDataSize, fileName);
304 if (MsgWriteIpcFile(fileName, (char*)pSrc->pMmsData, pSrc->mmsDataSize) == false)
305 THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
307 memset(pDest->msgData, 0x00, sizeof(pDest->msgData));
308 strncpy(pDest->msgData, fileName, MAX_MSG_DATA_LEN);
310 strncpy(pDest->msgText, (char*)pSrc->pData, MAX_MSG_TEXT_LEN);
313 if (strlen(pSrc->thumbPath) > 0) {
314 memset(pDest->thumbPath, 0x00, sizeof(pDest->thumbPath));
315 memcpy(pDest->thumbPath, pSrc->thumbPath, sizeof(pDest->thumbPath));
320 pDest->sim_idx = pSrc->simIndex;
326 void MsgHandle::convertMsgStruct(const MSG_MESSAGE_INFO_S *pSrc, MSG_MESSAGE_HIDDEN_S *pDest)
330 pDest->msgId = pSrc->msgId;
331 pDest->threadId = pSrc->threadId;
332 pDest->folderId = pSrc->folderId;
333 pDest->mainType = pSrc->msgType.mainType;
334 pDest->subType = pSrc->msgType.subType;
335 pDest->storageId = pSrc->storageId;
337 strncpy(pDest->replyAddress, pSrc->replyAddress, MAX_PHONE_NUMBER_LEN);
338 strncpy(pDest->subject, pSrc->subject, MAX_SUBJECT_LEN);
340 pDest->displayTime = pSrc->displayTime;
341 pDest->networkStatus = pSrc->networkStatus;
342 pDest->encodeType = pSrc->encodeType;
343 pDest->bRead = pSrc->bRead;
344 pDest->bProtected = pSrc->bProtected;
345 pDest->bBackup = pSrc->bBackup;
346 pDest->priority = pSrc->priority;
347 pDest->direction = pSrc->direction;
348 pDest->simIndex = pSrc->sim_idx;
351 pDest->bPortValid = pSrc->msgPort.valid;
353 if (pDest->bPortValid == true) {
354 pDest->dstPort = pSrc->msgPort.dstPort;
355 pDest->srcPort = pSrc->msgPort.srcPort;
358 if (pSrc->thumbPath[0] != '\0')
359 strncpy(pDest->thumbPath, pSrc->thumbPath, MSG_FILEPATH_LEN_MAX);
361 int maxCnt = (pSrc->nAddressCnt > 10)? MAX_TO_ADDRESS_CNT: pSrc->nAddressCnt;
363 pDest->addr_list->nCount = maxCnt;
365 msg_struct_s *addr_info_s = NULL;
366 MSG_ADDRESS_INFO_S *addr_info = NULL;
368 for (int i = 0; i < maxCnt; i++) {
369 addr_info_s = (msg_struct_s *)pDest->addr_list->msg_struct_info[i];
370 addr_info = (MSG_ADDRESS_INFO_S *)addr_info_s->data;
372 addr_info->addressType = pSrc->addressList[i].addressType;
373 addr_info->recipientType = pSrc->addressList[i].recipientType;
374 addr_info->contactId = pSrc->addressList[i].contactId;
375 strncpy(addr_info->addressVal, pSrc->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN);
376 strncpy(addr_info->displayName, pSrc->addressList[i].displayName, MAX_DISPLAY_NAME_LEN);
377 addr_info->displayName[MAX_DISPLAY_NAME_LEN] = '\0';
380 for (int i = 0; i < pSrc->nAddressCnt; i++) {
381 addr_info_s = new msg_struct_s;
382 memset(addr_info_s, 0x00, sizeof(msg_struct_s));
384 addr_info_s->type = MSG_STRUCT_ADDRESS_INFO;
385 addr_info_s->data = new MSG_ADDRESS_INFO_S;
386 memset(addr_info_s->data, 0x00, sizeof(MSG_ADDRESS_INFO_S));
388 addr_info = (MSG_ADDRESS_INFO_S *)addr_info_s->data;
390 addr_info->addressType = pSrc->addressList[i].addressType;
391 addr_info->recipientType = pSrc->addressList[i].recipientType;
392 addr_info->contactId = pSrc->addressList[i].contactId;
393 strncpy(addr_info->addressVal, pSrc->addressList[i].addressVal, MAX_ADDRESS_VAL_LEN);
394 strncpy(addr_info->displayName, pSrc->addressList[i].displayName, MAX_DISPLAY_NAME_LEN);
395 addr_info->displayName[MAX_DISPLAY_NAME_LEN] = '\0';
397 pDest->addressList = g_list_append(pDest->addressList, addr_info_s);
401 if (pSrc->bTextSms == false) {
404 char* pFileData = NULL;
405 unique_ptr<char*, void(*)(char**)> buf(&pFileData, unique_ptr_deleter);
407 pDest->dataSize = pSrc->dataSize;
409 /* Get Message Data from File */
410 if (MsgOpenAndReadFile(pSrc->msgData, &pFileData, &fileSize) == false)
411 THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
413 if (pSrc->msgType.mainType == MSG_SMS_TYPE) {
414 if (pDest->encodeType == MSG_ENCODE_8BIT) {
415 pDest->pData = (void*)new char[fileSize];
416 memset(pDest->pData, 0x00, fileSize);
417 memcpy(pDest->pData, pFileData, fileSize);
419 pDest->pData = (void*)new char[fileSize+1];
420 memset(pDest->pData, 0x00, fileSize+1);
421 strncpy((char*)pDest->pData, pFileData, fileSize);
424 if (pSrc->msgText[0] != '\0') {
425 pDest->pData = (void*)new char[strlen(pSrc->msgText)+1];
426 memset(pDest->pData, 0x00, strlen(pSrc->msgText)+1);
427 strncpy((char*)pDest->pData, pSrc->msgText, strlen(pSrc->msgText));
429 pDest->mmsDataSize = fileSize;
430 pDest->pMmsData = (void*)new char[fileSize];
431 memset(pDest->pMmsData, 0x00, fileSize);
432 memcpy(pDest->pMmsData, pFileData, fileSize);
433 MSG_SEC_DEBUG("Get Message Data from file : size[%d] name[%s]", pDest->mmsDataSize, pSrc->msgData);
437 pDest->dataSize = pSrc->dataSize;
439 if (pSrc->msgType.mainType == MSG_SMS_TYPE) {
440 if (pDest->encodeType == MSG_ENCODE_8BIT || pSrc->msgType.subType == MSG_ETWS_SMS) {
441 pDest->pData = (void*)new char[pDest->dataSize];
442 memset(pDest->pData, 0x00, pDest->dataSize);
443 memcpy(pDest->pData, pSrc->msgText, pDest->dataSize);
445 pDest->pData = (void*)new char[pDest->dataSize+1];
446 memset(pDest->pData, 0x00, pDest->dataSize+1);
447 strncpy((char*)pDest->pData, pSrc->msgText, pDest->dataSize);
450 if (pSrc->msgText[0] != '\0') {
451 pDest->pData = (void*)new char[strlen(pSrc->msgText)+1];
452 memset(pDest->pData, 0x00, strlen(pSrc->msgText)+1);
453 strncpy((char*)pDest->pData, pSrc->msgText, strlen(pSrc->msgText));
456 pDest->mmsDataSize = pDest->dataSize;
457 pDest->pMmsData = (void*)new char[pDest->dataSize];
458 memset(pDest->pMmsData, 0x00, pDest->dataSize);
459 memcpy(pDest->pMmsData, pSrc->msgData, pDest->dataSize);
467 void MsgHandle::convertSendOptStruct(const MSG_SENDINGOPT_S* pSrc, MSG_SENDINGOPT_INFO_S* pDest, MSG_MESSAGE_TYPE_S msgType)
471 pDest->bSetting = pSrc->bSetting;
473 if (pSrc->bSetting == false) {
474 MSG_DEBUG("No Sending Option");
478 pDest->bDeliverReq = pSrc->bDeliverReq;
479 pDest->bKeepCopy = pSrc->bKeepCopy;
481 MSG_DEBUG("pDest->bSetting = %d", pDest->bSetting);
482 MSG_DEBUG("pDest->bDeliverReq = %d", pDest->bDeliverReq);
483 MSG_DEBUG("pDest->bKeepCopy = %d", pDest->bKeepCopy);
485 if (msgType.mainType == MSG_SMS_TYPE) {
486 msg_struct_s *pStruct = (msg_struct_s *)pSrc->smsSendOpt;
488 SMS_SENDINGOPT_S *pSms = (SMS_SENDINGOPT_S *)pStruct->data;
490 pDest->option.smsSendOptInfo.bReplyPath = pSms->bReplyPath;
493 } else if (msgType.mainType == MSG_MMS_TYPE) {
494 msg_struct_s *pStruct = (msg_struct_s *)pSrc->mmsSendOpt;
496 MMS_SENDINGOPT_S *pMms = (MMS_SENDINGOPT_S *)pStruct->data;
498 pDest->option.mmsSendOptInfo.priority = pMms->priority;
499 pDest->option.mmsSendOptInfo.bReadReq = pMms->bReadReq;
501 MSG_DEBUG("pDest->option.mmsSendOpt.priority = %d", pMms->priority);
502 MSG_DEBUG("pDest->option.mmsSendOpt.bReadReq = %d", pMms->bReadReq);
504 if (pMms->expiryTime == 0) {
505 pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_NONE;
506 pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
508 pDest->option.mmsSendOptInfo.expiryTime.type = MMS_TIMETYPE_RELATIVE;
509 pDest->option.mmsSendOptInfo.expiryTime.time = pMms->expiryTime;
512 if (pMms->bUseDeliveryCustomTime == true) {
513 pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = true;
515 pDest->option.mmsSendOptInfo.bUseDeliveryCustomTime = false;
517 pDest->option.mmsSendOptInfo.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
518 pDest->option.mmsSendOptInfo.deliveryTime.time = pMms->deliveryTime;
520 MSG_DEBUG("pDest->option.mmsSendOpt.expiryTime = %d", pDest->option.mmsSendOptInfo.expiryTime.time);
529 void MsgHandle::convertSendOptStruct(const MSG_SENDINGOPT_INFO_S* pSrc, MSG_SENDINGOPT_S* pDest, MSG_MESSAGE_TYPE_S msgType)
533 pDest->bDeliverReq = pSrc->bDeliverReq;
534 pDest->bKeepCopy = pSrc->bKeepCopy;
536 MSG_DEBUG("pDest->bDeliverReq = %d", pDest->bDeliverReq);
537 MSG_DEBUG("pDest->bKeepCopy = %d", pDest->bKeepCopy);
539 if (msgType.mainType == MSG_SMS_TYPE) {
540 msg_struct_s *pStruct = (msg_struct_s *)pDest->smsSendOpt;
541 SMS_SENDINGOPT_S *pSms = (SMS_SENDINGOPT_S *)pStruct->data;
542 pSms->bReplyPath = pSrc->option.smsSendOptInfo.bReplyPath;
543 } else if (msgType.mainType == MSG_MMS_TYPE) {
544 msg_struct_s *pStruct = (msg_struct_s *)pDest->mmsSendOpt;
545 MMS_SENDINGOPT_S *pMms = (MMS_SENDINGOPT_S *)pStruct->data;
546 pMms->priority = pSrc->option.mmsSendOptInfo.priority;
547 pMms->bReadReq = pSrc->option.mmsSendOptInfo.bReadReq;
548 pMms->expiryTime = pSrc->option.mmsSendOptInfo.expiryTime.time;
549 pMms->deliveryTime = pSrc->option.mmsSendOptInfo.deliveryTime.time;
551 MSG_DEBUG("pDest->option.mmsSendOpt.priority = %d", pMms->priority);
552 MSG_DEBUG("pDest->option.mmsSendOpt.bReadReq = %d", pMms->bReadReq);
553 MSG_DEBUG("pDest->option.mmsSendOpt.expiryTime = %d", pMms->expiryTime);
560 int MsgHandle::getSettingCmdSize(MSG_OPTION_TYPE_T optionType)
562 int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_OPTION_TYPE_T);
564 switch (optionType) {
565 case MSG_GENERAL_OPT:
566 cmdSize += sizeof(MSG_GENERAL_OPT_S);
568 case MSG_SMS_SENDOPT:
569 cmdSize += sizeof(MSG_SMS_SENDOPT_S);
572 cmdSize += sizeof(MSG_SMSC_LIST_S);
574 case MSG_MMS_SENDOPT:
575 cmdSize += sizeof(MSG_MMS_SENDOPT_S);
577 case MSG_MMS_RECVOPT:
578 cmdSize += sizeof(MSG_MMS_RECVOPT_S);
580 case MSG_MMS_STYLEOPT:
581 cmdSize += sizeof(MSG_MMS_STYLEOPT_S);
583 case MSG_PUSHMSG_OPT:
584 cmdSize += sizeof(MSG_PUSHMSG_OPT_S);
587 cmdSize += sizeof(MSG_CBMSG_OPT_S);
589 case MSG_VOICEMAIL_OPT:
590 cmdSize += sizeof(MSG_VOICEMAIL_OPT_S);
592 case MSG_MSGSIZE_OPT:
593 cmdSize += sizeof(MSG_MSGSIZE_OPT_S);
601 bool MsgHandle::checkEventData(char *pEventData)
603 MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
605 switch (pEvent->eventType) {
606 case MSG_EVENT_PLG_SENT_STATUS_CNF:
607 case MSG_EVENT_PLG_INCOMING_MSG_IND:
608 case MSG_EVENT_PLG_INCOMING_MMS_CONF:
609 case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND:
610 case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND:
611 case MSG_EVENT_PLG_STORAGE_CHANGE_IND:
612 case MSG_EVENT_PLG_INCOMING_CB_MSG_IND:
613 case MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND:
614 case MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND:
625 msg_error_t MsgHandle::checkPermission(void)
627 /* Allocate Memory to Command Data */
628 int cmdSize = sizeof(MSG_CMD_S);
630 char cmdBuf[cmdSize];
631 bzero(cmdBuf, cmdSize);
632 MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
634 /* Set Command Parameters */
635 pCmd->cmdType = MSG_CMD_CHECK_PERMISSION;
637 /* Send Command to Messaging FW */
638 char* pEventData = NULL;
639 unique_ptr<char*, void(*)(char**)> eventBuf(&pEventData, unique_ptr_deleter);
641 write((char*)pCmd, cmdSize, &pEventData);
643 /* Get Return Data */
644 MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
647 THROW(MsgException::INVALID_RESULT, "Event is NULL");
649 if (pEvent->eventType != MSG_EVENT_CHECK_PERMISSION) {
650 THROW(MsgException::INVALID_RESULT, "Event Data Error");
653 return pEvent->result;