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 "MsgCppTypes.h"
35 #include "MsgException.h"
36 #include "MsgGconfWrapper.h"
37 #include "MsgUtilFile.h"
38 #include "SmsPluginTextConvert.h"
39 #include "SmsPluginUDCodec.h"
40 #include "SmsPluginStorage.h"
41 #include "SmsPluginEventHandler.h"
42 #include "SmsPluginCbMsgHandler.h"
45 /*==================================================================================================
46 IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
47 ==================================================================================================*/
48 SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::pInstance = NULL;
51 SmsPluginCbMsgHandler::SmsPluginCbMsgHandler()
57 SmsPluginCbMsgHandler::~SmsPluginCbMsgHandler()
63 SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::instance()
66 pInstance = new SmsPluginCbMsgHandler();
72 void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
76 SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
78 SMS_CBMSG_PAGE_S CbMsgPage = {0};
82 case SMS_CB_NETWORK_TYPE_2G_GSM :
83 Decode2gCbMsg(pCbMsg, &CbMsgPage);
86 case SMS_CB_NETWORK_TYPE_3G_UMTS :
87 Decode3gCbMsg(pCbMsg, &CbMsgPage);
91 // Check CB Msg Options
92 bool bJavaMsg = false;
94 if (!checkCbOpt(CbMsgPage, &bJavaMsg))
96 MSG_DEBUG("The CB Msg is not supported by option.");
100 if (bJavaMsg == true)
102 MSG_DEBUG("JAVA CB Msg.");
103 CbMsgPage.cbMsgType = SMS_CBMSG_TYPE_JAVACBS;
107 unsigned char pageCnt = checkCbPage(CbMsgPage);
109 if (pageCnt == CbMsgPage.pageHeader.totalPages)
111 MSG_DEBUG("RECEIVED LAST MSG : %d", pageCnt);
113 SMS_CBMSG_S cbMsg = {};
114 MSG_MESSAGE_INFO_S msgInfo = {};
116 // Make CB Msg Structure
117 MakeCbMsg(CbMsgPage, &cbMsg);
119 // Convert to MSG_MESSAGE_INFO_S
120 convertCbMsgToMsginfo(cbMsg, &msgInfo);
122 // Add CB Msg into DB
123 MSG_ERROR_T err = MSG_SUCCESS;
125 err = SmsPluginStorage::instance()->addMessage(&msgInfo);
127 if (err == MSG_SUCCESS)
130 err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
132 if (err != MSG_SUCCESS)
134 MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
139 MSG_DEBUG("addMessage() Error !! [%d]", err);
143 removeFromPageList(CbMsgPage);
149 void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
151 if (pCbMsg->Length > MAX_CBMSG_PAGE_SIZE)
152 THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
154 unsigned char cbData[pCbMsg->Length+1];
156 memset(cbData, 0x00, sizeof(cbData));
157 memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
158 cbData[pCbMsg->Length] = '\0';
160 pCbPage->cbMsgType = SMS_CBMSG_TYPE_CBS;
163 pCbPage->pageHeader.serialNum.geoScope = (cbData[0] & 0xC0) >> 6;
165 pCbPage->pageHeader.serialNum.msgCode = (cbData[0] & 0x3F) << 4;
166 pCbPage->pageHeader.serialNum.msgCode |= (cbData[1] & 0xF0) >> 4;
168 pCbPage->pageHeader.serialNum.updateNum = cbData[1] & 0x0F;
170 MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
172 pCbPage->pageHeader.msgId = (cbData[2] << 8) | cbData[3];
174 MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
177 decodeCbMsgDCS(cbData[4], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
180 pCbPage->pageHeader.totalPages = cbData[5] & 0x0F;
181 pCbPage->pageHeader.page = (cbData[5] & 0xF0) >> 4;
183 if (pCbPage->pageHeader.totalPages > MAX_CBMSG_PAGE_NUM)
184 THROW(MsgException::SMS_PLG_ERROR, "CB Page Count is over MAX[%d]", pCbPage->pageHeader.totalPages);
186 MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
188 // Convert Language Type
189 convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
191 MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
194 pCbPage->pageHeader.recvTime = getRecvTime();
197 int dataLen = pCbMsg->Length - 6;
199 switch (pCbPage->pageHeader.dcs.codingScheme)
201 case SMS_CHARSET_7BIT :
203 MSG_DEBUG("GSM 7 BIT");
205 dataLen = (dataLen*8) / 7;
207 SmsPluginUDCodec udCodec;
208 int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
210 MSG_DEBUG("dataLen : [%d]", dataLen);
211 MSG_DEBUG("unpackLen : [%d]", unpackLen);
213 pCbPage->pageLength = unpackLen;
214 pCbPage->pageData[unpackLen] = '\0';
219 case SMS_CHARSET_8BIT :
220 case SMS_CHARSET_UCS2 :
224 memcpy(pCbPage->pageData, &cbData[6], dataLen);
226 pCbPage->pageLength = strlen(pCbPage->pageData);
228 pCbPage->pageData[pCbPage->pageLength] = '\0';
233 MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
237 void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
239 if (pCbMsg->Length > (MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM))
240 THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
242 char cbData[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
244 memset(cbData, 0x00, sizeof(cbData));
245 memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
246 cbData[pCbMsg->Length] = '\0';
248 pCbPage->cbMsgType = (SMS_CBMSG_TYPE_T)cbData[0];
250 pCbPage->pageHeader.msgId = (cbData[1] << 8) | cbData[2];
252 MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
255 pCbPage->pageHeader.serialNum.geoScope = (cbData[3] & 0xC0) >> 6;
257 pCbPage->pageHeader.serialNum.msgCode = (cbData[3] & 0x3F) << 4;
258 pCbPage->pageHeader.serialNum.msgCode |= (cbData[4] & 0xF0) >> 4;
260 pCbPage->pageHeader.serialNum.updateNum = cbData[4] & 0x0F;
262 MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
265 decodeCbMsgDCS(cbData[5], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
267 // Convert Language Type
268 convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
270 MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
273 pCbPage->pageHeader.recvTime = getRecvTime();
278 bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
280 bool bReceive = false;
281 MsgSettingGetBool(CB_RECEIVE, &bReceive);
283 // Receive CB Msg = FALSE
286 MSG_DEBUG("RECEIVE CB = FALSE");
293 memset(keyName, 0x00, sizeof(keyName));
294 sprintf(keyName, "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
296 bool bAllLang = false;
297 MsgSettingGetBool(keyName, &bAllLang);
301 MSG_DEBUG("ALL LANGUAGE = FALSE");
303 memset(keyName, 0x00, sizeof(keyName));
304 sprintf(keyName, "%s/%d", CB_LANGUAGE, CbPage.pageHeader.langType);
308 MsgSettingGetBool(keyName, &bLang);
310 if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX)
312 MSG_DEBUG("LANGUAGE [%d] = FALSE", CbPage.pageHeader.langType);
317 bool bAllChannel = false;
318 MsgSettingGetBool(CB_ALL_CHANNEL, &bAllChannel);
320 // Receive All Channel = FALSE
323 MSG_DEBUG("RECEIVE ALL CHANNEL = FALSE");
325 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
327 bool bActivate = false;
330 for (int i = 0; i < MsgIdCnt; i++)
332 memset(keyName, 0x00, sizeof(keyName));
333 sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
335 MsgSettingGetBool(keyName, &bActivate);
337 memset(keyName, 0x00, sizeof(keyName));
338 sprintf(keyName, "%s/%d", CB_CHANNEL_ID, i);
340 MsgId = MsgSettingGetInt(keyName);
342 if (bActivate == true && CbPage.pageHeader.msgId == MsgId)
344 MSG_DEBUG("FIND CHANNEL = [%d]", MsgId);
349 else // Receive All Channel = TRUE
351 MSG_DEBUG("RECEIVE ALL CHANNEL = TRUE");
359 unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
361 unsigned char currPageCnt = 0;
365 if (CbPage.pageHeader.totalPages > 1)
367 for (unsigned int i = 0; i < pageList.size(); i++)
369 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
371 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
373 if (pageList[i].msgId == CbPage.pageHeader.msgId)
375 int updateNum = CbPage.pageHeader.serialNum.updateNum - pageList[i].updateNum;
377 if (updateNum > 0) // New Message Content
381 else if (updateNum == 0) // Same Message Content
383 if (pageList[i].data.count(CbPage.pageHeader.page) != 0)
385 MSG_DEBUG("The Page Number already exists [%d]", CbPage.pageHeader.page);
389 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
390 pageList[i].data.insert(newData);
392 MSG_DEBUG("PAGE DATA : %s", CbPage.pageData);
393 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
395 pageList[i].pageCnt++;
396 pageList[i].totalSize += CbPage.pageLength;
398 currPageCnt = pageList[i].pageCnt;
404 else // Old Message Content
413 if (bFind == false || CbPage.pageHeader.totalPages == 1)
415 addToPageLiat(CbPage);
423 void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg)
425 pCbMsg->cbMsgType = CbPage.cbMsgType;
426 pCbMsg->msgId = CbPage.pageHeader.msgId;
427 pCbMsg->classType = CbPage.pageHeader.dcs.classType;
428 pCbMsg->codingScheme = CbPage.pageHeader.dcs.codingScheme;
429 pCbMsg->recvTime = CbPage.pageHeader.recvTime;
431 cbPageMap::iterator it;
434 for (unsigned int i = 0; i < pageList.size(); i++)
436 if (pageList[i].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage.pageHeader.serialNum.msgCode)
438 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
440 if (pageList[i].msgId == CbPage.pageHeader.msgId)
442 for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
444 tmpStr += it->second;
450 pCbMsg->msgLength = tmpStr.size();
452 memcpy(pCbMsg->msgData, tmpStr.c_str(), tmpStr.size());
453 pCbMsg->msgData[tmpStr.size()] = '\0';
455 MSG_DEBUG("SIZE : [%d] TOTAL MSG : %s", tmpStr.size(), tmpStr.c_str());
459 void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
461 pMsgInfo->msgId = (MSG_MESSAGE_ID_T)cbMsg.msgId;
463 pMsgInfo->folderId = MSG_CBMSGBOX_ID;
465 // Convert Type values
466 pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
468 if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_CBS)
469 pMsgInfo->msgType.subType = MSG_CB_SMS;
470 else if (cbMsg.cbMsgType == SMS_CBMSG_TYPE_JAVACBS)
471 pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
473 switch(cbMsg.classType)
475 case SMS_MSG_CLASS_0:
476 pMsgInfo->msgType.classType = MSG_CLASS_0;
478 case SMS_MSG_CLASS_1:
479 pMsgInfo->msgType.classType = MSG_CLASS_1;
481 case SMS_MSG_CLASS_2:
482 pMsgInfo->msgType.classType = MSG_CLASS_2;
484 case SMS_MSG_CLASS_3:
485 pMsgInfo->msgType.classType = MSG_CLASS_3;
488 pMsgInfo->msgType.classType = MSG_CLASS_NONE;
491 pMsgInfo->storageId = MSG_STORAGE_PHONE;
492 pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
493 pMsgInfo->bRead = false;
494 pMsgInfo->bProtected = false;
495 pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
496 pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
499 pMsgInfo->nAddressCnt = 1;
501 pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
502 pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
504 getDisplayName(cbMsg.msgId, pMsgInfo->addressList[0].addressVal);
505 MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
507 pMsgInfo->msgPort.valid = false;
508 pMsgInfo->msgPort.dstPort = 0;
509 pMsgInfo->msgPort.srcPort = 0;
511 pMsgInfo->displayTime = cbMsg.recvTime;
512 MSG_DEBUG("recvTime is %s", ctime(&pMsgInfo->displayTime));
514 int bufSize = cbMsg.msgLength*2;
516 char tmpBuf[bufSize];
517 memset(tmpBuf, 0x00, sizeof(tmpBuf));
519 MSG_DEBUG("LENGTH %d CB MSG %s", cbMsg.msgLength, cbMsg.msgData);
521 SMS_LANG_INFO_S langInfo = {0};
523 langInfo.bSingleShift = false;
524 langInfo.bLockingShift = false;
526 // Convert Data values
527 if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
528 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
529 else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
530 pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
532 if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
534 pMsgInfo->bTextSms = false;
536 // Save Message Data into File
537 char fileName[MAX_COMMON_INFO_SIZE+1];
538 memset(fileName, 0x00, sizeof(fileName));
540 if (MsgCreateFileName(fileName) == false)
541 THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
543 MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
544 if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
545 THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
547 strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
551 pMsgInfo->bTextSms = true;
553 memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
554 memcpy(pMsgInfo->msgText, tmpBuf, pMsgInfo->dataSize);
559 void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
561 CB_PAGE_INFO_S tmpInfo;
563 tmpInfo.geoScope = CbPage.pageHeader.serialNum.geoScope;
564 tmpInfo.msgCode = CbPage.pageHeader.serialNum.msgCode;
565 tmpInfo.updateNum = CbPage.pageHeader.serialNum.updateNum;
566 tmpInfo.msgId = CbPage.pageHeader.msgId;
567 tmpInfo.totalPages = CbPage.pageHeader.totalPages;
570 tmpInfo.totalSize = CbPage.pageLength;
572 pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
573 tmpInfo.data.insert(newData);
575 MSG_DEBUG("MSG DATA : %s", CbPage.pageData);
576 MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
578 pageList.push_back(tmpInfo);
582 void SmsPluginCbMsgHandler::removeFromPageList(SMS_CBMSG_PAGE_S CbPage)
586 for (index = 0; index < pageList.size(); index++)
588 if (pageList[index].geoScope == CbPage.pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage.pageHeader.serialNum.msgCode)
590 MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[index].geoScope, pageList[index].msgCode);
592 if (pageList[index].msgId == CbPage.pageHeader.msgId) break;
596 MSG_DEBUG("remove index [%d]", index);
598 pageList.erase(pageList.begin()+index);
602 void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned char *pMsgData, SMS_CBMSG_DCS_S* pDcs)
604 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
605 pDcs->classType = SMS_MSG_CLASS_NONE;
606 pDcs->bCompressed = false;
607 pDcs->codingScheme = SMS_CHARSET_7BIT;
608 pDcs->langType = SMS_CBMSG_LANG_UNSPECIFIED;
609 memset(pDcs->iso639Lang, 0x00, sizeof(pDcs->iso639Lang));
611 pDcs->rawData = dcsData;
613 unsigned char codingGrp = (dcsData & 0xF0) >> 4;
621 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
622 pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
628 if (dcsData == 0x10 || dcsData == 0x11)
630 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
631 pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
632 pDcs->langType = SMS_CBMSG_LANG_ISO639;
634 if (pMsgData != NULL)
636 pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
637 pDcs->iso639Lang[1] = (pMsgData[0] & 0x80) >> 7;
638 pDcs->iso639Lang[1] |= (pMsgData[1] & 0x3F) << 1;
639 pDcs->iso639Lang[2] = 0x13; /* CR char in GSM 7-bit Alphabet */
643 /* Default it to English if pMsgData is NULL */
644 pDcs->iso639Lang[0] = 0x45; /* E */
645 pDcs->iso639Lang[1] = 0x4E; /* N */
646 pDcs->iso639Lang[2] = 0x13; /* CR */
657 pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
659 pDcs->bCompressed = (dcsData & 0x20) ? true : false;
662 pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
664 pDcs->codingScheme = (SMS_CODING_SCHEME_T)(dcsData & 0x0C);
676 pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
682 pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
683 pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
684 pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
691 void SmsPluginCbMsgHandler::convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType)
695 case SMS_CBMSG_LANG_GERMAN :
696 *pOutType = MSG_CBLANG_TYPE_GER;
699 case SMS_CBMSG_LANG_ENGLISH :
700 *pOutType = MSG_CBLANG_TYPE_ENG;
703 case SMS_CBMSG_LANG_ITALIAN :
704 *pOutType = MSG_CBLANG_TYPE_ITA;
707 case SMS_CBMSG_LANG_FRENCH :
708 *pOutType = MSG_CBLANG_TYPE_FRE;
711 case SMS_CBMSG_LANG_SPANISH :
712 *pOutType = MSG_CBLANG_TYPE_SPA;
715 case SMS_CBMSG_LANG_DUTCH :
716 *pOutType = MSG_CBLANG_TYPE_NED;
719 case SMS_CBMSG_LANG_SWEDISH :
720 *pOutType = MSG_CBLANG_TYPE_SWE;
723 case SMS_CBMSG_LANG_PORTUGUESE :
724 *pOutType = MSG_CBLANG_TYPE_POR;
727 case SMS_CBMSG_LANG_TURKISH :
728 *pOutType = MSG_CBLANG_TYPE_TUR;
732 *pOutType = MSG_CBLANG_TYPE_MAX;
738 unsigned long SmsPluginCbMsgHandler::getRecvTime()
742 recvTime = time(NULL);
744 return (unsigned long)recvTime;
748 void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName)
750 int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
753 char strTmp[CB_CHANNEL_NAME_MAX+1];
755 for (int i = 0; i < MsgIdCnt; i++)
757 memset(keyName, 0x00, sizeof(keyName));
758 sprintf(keyName, "%s/%d", CB_CHANNEL_ID, i);
760 if (MsgId == MsgSettingGetInt(keyName))
762 char *channelName = NULL;
763 MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
765 memset(keyName, 0x00, sizeof(keyName));
766 sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
768 memset(strTmp, 0x00, sizeof(strTmp));
770 channelName = MsgSettingGetString(keyName);
772 strncpy(strTmp, channelName, CB_CHANNEL_NAME_MAX);
779 if (strlen(strTmp) > 0)
780 sprintf(pDisplayName, "[%s]", strTmp);
782 sprintf(pDisplayName, "[%d]", MsgId);
788 sprintf(pDisplayName, "[%d]", MsgId);