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 "SmsPluginParamCodec.h"
40 #include "SmsPluginTpduCodec.h"
41 #include "SmsPluginEventHandler.h"
42 #include "SmsPluginStorage.h"
43 #include "SmsPluginTransport.h"
47 #include <ITapiNetText.h>
50 #define MSG_DEBUG_BY_FILE
52 /*==================================================================================================
53 IMPLEMENTATION OF SmsPluginTransport - Member Functions
54 ==================================================================================================*/
55 SmsPluginTransport* SmsPluginTransport::pInstance = NULL;
58 SmsPluginTransport::SmsPluginTransport()
66 SmsPluginTransport::~SmsPluginTransport()
72 SmsPluginTransport* SmsPluginTransport::instance()
75 pInstance = new SmsPluginTransport();
81 void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
87 tpdu.tpduType = SMS_TPDU_SUBMIT;
89 // Set SMS Send Options - Setting
90 setSmsSendOptions(&(tpdu.data.submit));
92 // Set SMS Send Options - Each Message
93 if (pReqInfo->sendOptInfo.bSetting == true)
95 tpdu.data.submit.bStatusReport = pReqInfo->sendOptInfo.bDeliverReq;
96 tpdu.data.submit.bReplyPath = pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath;
99 // Set Coding Scheme for apps that use port number
100 if (pReqInfo->msgInfo.msgPort.valid == true)
102 tpdu.data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
104 MSG_DEBUG("DCS is changed by application : [%d]", tpdu.data.submit.dcs.codingScheme);
109 setSmscOptions(&smsc);
111 // Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S
112 SMS_SUBMIT_DATA_S submitData = {{0},};
113 msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme));
115 // Encode SMSC Address
116 unsigned char smscAddr[MAX_SMSC_LEN];
117 memset(smscAddr, 0x00, sizeof(smscAddr));
119 int smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
121 if (smscLen <= 0) return;
123 for (int i = 0; i < smscLen; i++)
125 MSG_DEBUG("pSCAInfo [%02x]", smscAddr[i]);
128 int bufLen = 0, reqId = 0;
130 char buf[MAX_TPDU_DATA_LEN];
132 int addLen = strlen(submitData.destAddress.address);
134 tpdu.data.submit.destAddress.ton = submitData.destAddress.ton;
135 tpdu.data.submit.destAddress.npi = submitData.destAddress.npi;
137 memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, addLen);
138 tpdu.data.submit.destAddress.address[addLen] = '\0';
140 for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
142 if (submitData.userData[segCnt].headerCnt > 0)
144 tpdu.data.submit.bHeaderInd = true;
148 tpdu.data.submit.bHeaderInd = false;
151 memset(&(tpdu.data.submit.userData), 0x00, sizeof(SMS_USERDATA_S));
152 memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
154 // Encode SMS-SUBMIT TPDU
155 memset(buf, 0x00, sizeof(buf));
157 bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
159 // Make Telephony Structure
160 TelSmsDatapackageInfo_t pkgInfo;
163 memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
164 memcpy((void*)pkgInfo.szData, buf, bufLen);
166 pkgInfo.szData[bufLen] = 0;
167 pkgInfo.MsgLength = bufLen;
170 memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
171 memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
172 pkgInfo.Sca[smscLen] = '\0';
174 MSG_DEBUG("bReqCb [%d]", pReqInfo->bReqCb);
176 SMS_SENT_INFO_S sentInfo = {};
178 TS_BOOL bMoreMsg = FALSE;
180 memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S));
182 if ((segCnt+1) == submitData.segCount)
184 sentInfo.bLast = true;
190 sentInfo.bLast = false;
195 SmsPluginEventHandler::instance()->SetSentInfo(&sentInfo);
197 curStatus = MSG_NETWORK_SENDING;
200 int tapiRet = TAPI_API_SUCCESS;
202 tapiRet = tel_send_sms(&pkgInfo, bMoreMsg, &reqId);
204 if (tapiRet == TAPI_API_SUCCESS)
206 MSG_DEBUG("######## TelTapiSmsSend Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
210 SmsPluginEventHandler::instance()->handleSentStatus(reqId, MSG_NETWORK_SEND_FAIL);
212 THROW(MsgException::SMS_PLG_ERROR, "######## TelTapiSmsSend Fail !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
215 MSG_NETWORK_STATUS_T retStatus = getNetStatus();
217 if (retStatus == MSG_NETWORK_SEND_SUCCESS)
219 MSG_DEBUG("######## Msg Sent was Successful !!! req Id : [%d] return : [%d] #######", reqId, retStatus);
223 THROW(MsgException::SMS_PLG_ERROR, "######## Msg Sent was Failed !!! req Id : [%d] return : [%d] #######", reqId, retStatus);
226 if (tpdu.data.submit.userData.headerCnt > 0) tpdu.data.submit.userData.headerCnt--;
233 void SmsPluginTransport::sendDeliverReport(MSG_ERROR_T err)
239 tpdu.tpduType = SMS_TPDU_DELIVER_REP;
241 TelSmsResponse_t response;
243 int tapiRet = TAPI_API_SUCCESS, reqId = 0;
245 if (err == MSG_SUCCESS)
247 tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
248 response = TAPI_NETTEXT_SENDSMS_SUCCESS;
250 tapiRet = tel_set_sms_memory_status(TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, &reqId);
252 if (tapiRet == TAPI_API_SUCCESS)
254 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] #######", reqId);
258 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
261 else if (err == MSG_ERR_SIM_STORAGE_FULL)
263 tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
264 tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
265 response = TAPI_NETTEXT_SIM_FULL;
267 tapiRet = tel_set_sms_memory_status(TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, &reqId);
269 if (tapiRet == TAPI_API_SUCCESS)
271 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] #######", reqId);
275 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
278 else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
280 tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
281 tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
282 response = TAPI_NETTEXT_ME_FULL;
284 tapiRet = tel_set_sms_memory_status(TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, &reqId);
286 if (tapiRet == TAPI_API_SUCCESS)
288 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] #######", reqId);
292 MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
297 tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
298 tpdu.data.deliverRep.failCause = SMS_FC_UNSPEC_ERROR;
299 response = TAPI_NETTEXT_SIM_FULL;
303 MSG_DEBUG("err : [%d], response : [%02x]", err, response);
305 tpdu.data.deliverRep.bHeaderInd = false;
306 tpdu.data.deliverRep.paramInd = 0x00;
308 // Encode SMS-DELIVER-REPORT TPDU
311 char buf[MAX_TPDU_DATA_LEN];
312 memset(buf, 0x00, sizeof(buf));
314 bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
316 // Make Telephony Structure
317 TelSmsDatapackageInfo_t pkgInfo;
320 memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
321 memcpy((void*)pkgInfo.szData, buf, bufLen);
323 pkgInfo.szData[bufLen] = 0;
324 pkgInfo.MsgLength = bufLen;
330 setSmscOptions(&smsc);
332 // Encode SMSC Address
333 unsigned char smscAddr[MAX_SMSC_LEN];
334 memset(smscAddr, 0x00, sizeof(smscAddr));
336 int smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
338 if (smscLen <= 0) return;
341 memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
342 memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
343 pkgInfo.Sca[smscLen] = '\0';
345 // Send Deliver Report
346 tapiRet = tel_send_sms_deliver_report(&pkgInfo, response, &reqId);
348 if (tapiRet == TAPI_API_SUCCESS)
350 MSG_DEBUG("######## tel_send_sms_deliver_report() Success !!! req Id : [%d] #######", reqId);
354 MSG_DEBUG("######## tel_send_sms_deliver_report() Fail !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
361 void SmsPluginTransport::setSmsSendOptions(SMS_SUBMIT_S *pSubmit)
363 // Set SMS Send Options
364 pSubmit->bRejectDup = false;
365 pSubmit->bHeaderInd = false;
367 MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSubmit->bStatusReport);
368 MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSubmit->bReplyPath);
370 pSubmit->msgRef = msgRef++;
372 pSubmit->dcs.bCompressed = false;
373 pSubmit->dcs.msgClass = SMS_MSG_CLASS_NONE;
374 pSubmit->dcs.codingGroup = SMS_GROUP_GENERAL;
376 pSubmit->dcs.codingScheme = (SMS_CODING_SCHEME_T)MsgSettingGetInt(SMS_SEND_DCS);
378 MSG_DEBUG("DCS : %d", pSubmit->dcs.codingScheme);
380 int selectIdx = MsgSettingGetInt(SMSC_SELECTED);
384 memset(keyName, 0x00, sizeof(keyName));
385 sprintf(keyName, "%s/%d", SMSC_PID, selectIdx);
386 MSG_SMS_PID_T pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName);
388 pSubmit->pid = convertPid(pid);
389 MSG_DEBUG("PID : %d", pSubmit->pid);
391 memset(keyName, 0x00, sizeof(keyName));
392 sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, selectIdx);
393 int valPeriod = MsgSettingGetInt(keyName);
395 MSG_DEBUG("valPeriod : %d", valPeriod);
399 pSubmit->vpf = SMS_VPF_NOT_PRESENT;
403 pSubmit->vpf = SMS_VPF_RELATIVE;
404 pSubmit->validityPeriod.format = SMS_TIME_RELATIVE;
405 pSubmit->validityPeriod.time.relative.time = valPeriod;
410 void SmsPluginTransport::setSmscOptions(SMS_ADDRESS_S *pSmsc)
413 int selectIdx = MsgSettingGetInt(SMSC_SELECTED);
417 memset(keyName, 0x00, sizeof(keyName));
418 sprintf(keyName, "%s/%d", SMSC_ADDRESS, selectIdx);
420 char* tmpValue = NULL;
422 tmpValue = MsgSettingGetString(keyName);
424 if (tmpValue != NULL)
426 memset(pSmsc->address, 0x00, sizeof(pSmsc->address));
427 strncpy(pSmsc->address, tmpValue, MAX_ADDRESS_LEN);
429 MSG_DEBUG("address : %s", pSmsc->address);
433 strncpy(pSmsc->address, "", MAX_ADDRESS_LEN);
436 memset(keyName, 0x00, sizeof(keyName));
437 sprintf(keyName, "%s/%d", SMSC_TON, selectIdx);
438 pSmsc->ton = (SMS_TON_T)MsgSettingGetInt(keyName);
440 MSG_DEBUG("ton : %d", pSmsc->ton);
442 memset(keyName, 0x00, sizeof(keyName));
443 sprintf(keyName, "%s/%d", SMSC_NPI, selectIdx);
444 pSmsc->npi = (SMS_NPI_T)MsgSettingGetInt(keyName);
446 MSG_DEBUG("npi : %d", pSmsc->npi);
448 if (tmpValue != NULL)
456 void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SUBMIT_DATA_S *pData, SMS_CODING_SCHEME_T *pCharType)
458 // Destination Address
459 pData->destAddress.ton = SMS_TON_NATIONAL;
460 pData->destAddress.npi = SMS_NPI_ISDN;
462 memset(pData->destAddress.address, 0x00, MAX_ADDRESS_LEN+1);
463 memcpy(pData->destAddress.address, pMsgInfo->addressList[0].addressVal, MAX_ADDRESS_LEN);
465 MSG_DEBUG("ton [%d]", pData->destAddress.ton);
466 MSG_DEBUG("npi [%d]", pData->destAddress.npi);
467 MSG_DEBUG("address [%s]", pData->destAddress.address);
469 int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1; // SMS_CHARSET_7BIT
471 unsigned char decodeData[bufSize];
472 memset(decodeData, 0x00, sizeof(decodeData));
474 MSG_ENCODE_TYPE_T encodeType = MSG_ENCODE_GSM7BIT;
476 SMS_LANGUAGE_ID_T langId = SMS_LANG_ID_RESERVED;
479 if (pMsgInfo->bTextSms == true)
481 if (*pCharType == SMS_CHARSET_7BIT)
483 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &langId);
485 else if (*pCharType == SMS_CHARSET_8BIT)
487 memcpy(decodeData, pMsgInfo->msgText, pMsgInfo->dataSize);
488 decodeLen = pMsgInfo->dataSize;
490 else if (*pCharType == SMS_CHARSET_UCS2)
492 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize);
494 else if (*pCharType == SMS_CHARSET_AUTO)
496 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &encodeType);
497 *pCharType = encodeType;
504 char* pFileData = NULL;
505 AutoPtr<char> FileBuf(&pFileData);
507 // Read Message Data from File
508 if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
509 THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
511 MSG_DEBUG("file size : [%d] file data : [%s]", fileSize, pFileData);
513 if (*pCharType == SMS_CHARSET_7BIT)
515 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId);
517 else if (*pCharType == SMS_CHARSET_8BIT)
519 memcpy(decodeData, pFileData, fileSize);
520 decodeLen = fileSize;
522 else if (*pCharType == SMS_CHARSET_UCS2)
524 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
526 else if (*pCharType == SMS_CHARSET_AUTO)
528 decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
529 *pCharType = encodeType;
533 MsgDeleteFile(pMsgInfo->msgData);
536 MSG_DEBUG("decode length : [%d]", decodeLen);
537 MSG_DEBUG("character type : [%d]", *pCharType);
538 MSG_DEBUG("Language Identifier : [%d]", langId);
539 MSG_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
543 char* encodedAddr = NULL;
544 AutoPtr<char> addressBuf(&encodedAddr);
546 if (strlen(pMsgInfo->replyAddress) > 0)
548 SMS_ADDRESS_S replyAddr = {};
550 replyAddr.ton = SMS_TON_NATIONAL;
551 replyAddr.npi = SMS_NPI_ISDN;
553 memset(replyAddr.address, 0x00, MAX_ADDRESS_LEN+1);
554 memcpy(replyAddr.address, pMsgInfo->replyAddress, MAX_ADDRESS_LEN);
556 addrLen = SmsPluginParamCodec::encodeAddress(&replyAddr, &encodedAddr);
558 MSG_DEBUG("reply addr length : [%d]", addrLen);
561 int segSize = 0, index = 0;
563 segSize = getSegmentSize(*pCharType, decodeLen, pMsgInfo->msgPort.valid, langId, addrLen);
565 if (segSize >= decodeLen)
568 pData->segCount = (decodeLen/segSize) + 1;
570 MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCount);
572 if (pData->segCount > MAX_SEGMENT_NUM)
573 THROW(MsgException::SMS_PLG_ERROR, "Segment Count is over maximum : %d", pData->segCount);
577 for (unsigned int i = 0; i < pData->segCount; i++)
581 if ((i + 1) == pData->segCount)
582 pData->userData[i].length = decodeLen - (i*segSize);
584 pData->userData[i].length = segSize;
586 memset(pData->userData[i].data, 0x00, MAX_USER_DATA_LEN+1);
587 memcpy(pData->userData[i].data, &(decodeData[index]), pData->userData[i].length);
588 pData->userData[i].data[pData->userData[i].length] = 0;
590 MSG_DEBUG("user data len [%d]", pData->userData[i].length);
591 MSG_DEBUG("user data [%s]", pData->userData[i].data);
595 // Set User Data Header for Concatenated Message
596 if (pData->segCount > 1)
598 pData->userData[i].header[headerCnt].udhType = SMS_UDH_CONCAT_8BIT;
599 pData->userData[i].header[headerCnt].udh.concat8bit.msgRef = msgRef8bit;
600 pData->userData[i].header[headerCnt].udh.concat8bit.totalSeg = pData->segCount;
601 pData->userData[i].header[headerCnt].udh.concat8bit.seqNum = i + 1;
606 // Set User Data Header Port Information
607 if (pMsgInfo->msgPort.valid == true)
609 pData->userData[i].header[headerCnt].udhType = SMS_UDH_APP_PORT_16BIT;
610 pData->userData[i].header[headerCnt].udh.appPort16bit.destPort = pMsgInfo->msgPort.dstPort;
611 pData->userData[i].header[headerCnt].udh.appPort16bit.originPort = pMsgInfo->msgPort.srcPort;
616 // Set User Data Header for Alternate Reply Address
617 if (strlen(pMsgInfo->replyAddress) > 0)
619 pData->userData[i].header[headerCnt].udhType = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
621 pData->userData[i].header[headerCnt].udh.alternateAddress.ton = SMS_TON_NATIONAL;
622 pData->userData[i].header[headerCnt].udh.alternateAddress.npi = SMS_NPI_ISDN;
624 memset(pData->userData[i].header[headerCnt].udh.alternateAddress.address, 0x00, MAX_ADDRESS_LEN+1);
625 memcpy(pData->userData[i].header[headerCnt].udh.alternateAddress.address, pMsgInfo->replyAddress, MAX_ADDRESS_LEN);
630 // Set User Data Header for National Language Single Shift
631 if (*pCharType == SMS_CHARSET_7BIT && langId != SMS_LANG_ID_RESERVED)
633 pData->userData[i].header[headerCnt].udhType = SMS_UDH_SINGLE_SHIFT;
634 pData->userData[i].header[headerCnt].udh.singleShift.langId = langId;
639 pData->userData[i].headerCnt = headerCnt;
646 int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, SMS_LANGUAGE_ID_T LangId, int ReplyAddrLen)
648 int headerLen = 1, concat = 5, port = 6, lang = 3, reply = 2;
649 int headerSize = 0, segSize = 0, maxSize = 0;
651 if (CodingScheme == SMS_CHARSET_7BIT)
653 MSG_DEBUG("SMS_CHARSET_7BIT");
654 maxSize = MAX_GSM_7BIT_DATA_LEN;
656 else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
658 MSG_DEBUG("SMS_CHARSET_8BIT or SMS_CHARSET_UCS2 [%d]", CodingScheme);
659 maxSize = MAX_UCS2_DATA_LEN;
662 if (bPortNum == true)
664 MSG_DEBUG("Port Number Exists");
668 if (LangId != SMS_LANG_ID_RESERVED)
670 MSG_DEBUG("National Language Exists");
674 if (ReplyAddrLen > 0)
676 MSG_DEBUG("Reply Address Exists");
678 headerSize += ReplyAddrLen;
681 if (CodingScheme == SMS_CHARSET_7BIT)
683 if (((DataLen+headerSize)/maxSize) >= 1)
684 segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
688 else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
690 if (((DataLen+headerSize)/maxSize) >= 1)
691 segSize = 140 - (headerLen + concat + headerSize);
700 void SmsPluginTransport::setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstHeader)
702 pDstHeader->udhType = pSrcHeader->udhType;
704 switch (pDstHeader->udhType)
706 case SMS_UDH_CONCAT_8BIT :
708 pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef;
709 pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg;
710 pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum;
714 case SMS_UDH_CONCAT_16BIT :
716 pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef;
717 pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg;
718 pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum;
725 void SmsPluginTransport::setNetStatus(MSG_NETWORK_STATUS_T netStatus)
728 curStatus = netStatus;
734 MSG_NETWORK_STATUS_T SmsPluginTransport::getNetStatus()
740 if (curStatus == MSG_NETWORK_SENDING)
741 ret = cv.timedwait(mx.pMutex(), 65);
745 if (ret == ETIMEDOUT)
747 MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
748 curStatus = MSG_NETWORK_SEND_TIMEOUT;
755 unsigned char SmsPluginTransport::getMsgRef()
761 SMS_PID_T SmsPluginTransport::convertPid(MSG_SMS_PID_T pid)
768 retPid = SMS_PID_NORMAL;
771 retPid = SMS_PID_VOICE;
774 retPid = SMS_PID_TELEX;
777 retPid = SMS_PID_x400;
780 retPid = SMS_PID_ERMES;
783 retPid = SMS_PID_EMAIL;
786 retPid = SMS_PID_NORMAL;