summaryrefslogtreecommitdiff
path: root/plugin/sms_plugin
diff options
context:
space:
mode:
authorChangseok Oh <seok.oh@samsung.com>2012-10-09 17:37:37 +0900
committerChangseok Oh <seok.oh@samsung.com>2012-10-09 18:57:15 +0900
commit114f168b55d684805732268dbb528c0236f0c4e7 (patch)
tree7e8c22519b190b0c3ca616fa90c439331217b645 /plugin/sms_plugin
parent81675912331f540b11a43fb5affa82524bee0d7d (diff)
downloadmsg-service-114f168b55d684805732268dbb528c0236f0c4e7.tar.gz
msg-service-114f168b55d684805732268dbb528c0236f0c4e7.tar.bz2
msg-service-114f168b55d684805732268dbb528c0236f0c4e7.zip
apply push/cb function
Diffstat (limited to 'plugin/sms_plugin')
-rwxr-xr-xplugin/sms_plugin/SmsPluginCallback.cpp24
-rwxr-xr-xplugin/sms_plugin/SmsPluginCbMsgHandler.cpp185
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp32
-rwxr-xr-xplugin/sms_plugin/SmsPluginStorage.cpp116
-rwxr-xr-xplugin/sms_plugin/SmsPluginWapPushHandler.cpp195
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginCbMsgHandler.h5
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginEventHandler.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginStorage.h7
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTypes.h13
9 files changed, 560 insertions, 19 deletions
diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp
index 337a4e7..a11a027 100755
--- a/plugin/sms_plugin/SmsPluginCallback.cpp
+++ b/plugin/sms_plugin/SmsPluginCallback.cpp
@@ -196,6 +196,29 @@ void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data,
}
+void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventEtwsMsgIncoming is called. noti_id [%s]", noti_id);
+
+ if (data == NULL) {
+ MSG_DEBUG("Error. evt->pData is NULL.");
+ return;
+ }
+
+ TelSmsEtwsMsg_t *pEtwsMsg = (TelSmsEtwsMsg_t*)data;
+
+ try
+ {
+ SmsPluginCbMsgHandler::instance()->handleEtwsMsg(pEtwsMsg);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return;
+ }
+}
+
+
void TapiEventDeliveryReportCNF(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventDeliveryReportCNF is called. : result = [%d]", result);
@@ -755,6 +778,7 @@ void SmsPluginCallback::registerEvent()
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL);
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL);
+ tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL);
// tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL);
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_SEND_SMS, TapiEventSatSendSms, NULL);
// tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL);
diff --git a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
index 82d22f5..16ea14e 100755
--- a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
@@ -112,9 +112,27 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
if (err == MSG_SUCCESS)
{
- // Callback
- err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+ MSG_CB_MSG_S cbOutMsg = {0, };
+ cbOutMsg.type = MSG_CB_SMS;
+ cbOutMsg.receivedTime = cbMsg.recvTime;
+ cbOutMsg.serialNum = encodeCbSerialNum (CbMsgPage.pageHeader.serialNum);
+ cbOutMsg.messageId = cbMsg.msgId;
+ cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
+ memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
+
+ SMS_LANG_INFO_S langInfo = {0};
+
+ langInfo.bSingleShift = false;
+ langInfo.bLockingShift = false;
+
+ if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
+ cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
+ else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
+ cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
+
+
+ err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
if (err != MSG_SUCCESS)
{
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
@@ -132,6 +150,40 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
}
+void SmsPluginCbMsgHandler::handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg)
+{
+ MSG_BEGIN();
+ msg_error_t err = MSG_SUCCESS;
+ SMS_ETWS_NETWORK_TYPE_T type = pEtwsMsg->EtwsMsgType;
+ //MSG_MESSAGE_INFO_S msgInfo = {};
+ SMS_ETWS_PRIMARY_S etwsPn = {0, };
+ MSG_CB_MSG_S cbOutMsg = {0, };
+
+ if(type != TAPI_NETTEXT_ETWS_PRIMARY)
+ {
+ MSG_DEBUG("The Etws Msg is not supported");
+ return;
+ }
+ DecodeEtwsMsg(pEtwsMsg, &etwsPn);
+ //convertEtwsMsgToMsginfo(CbMsgPage, &msgInfo);
+
+ cbOutMsg.type = MSG_ETWS_SMS;
+ cbOutMsg.receivedTime = etwsPn.recvTime;
+ cbOutMsg.serialNum = encodeCbSerialNum (etwsPn.serialNum);
+ cbOutMsg.messageId = etwsPn.msgId;
+ cbOutMsg.etwsWarningType = etwsPn.warningType;
+ memcpy (cbOutMsg.etwsWarningSecurityInfo, etwsPn.warningSecurityInfo, sizeof(cbOutMsg.etwsWarningSecurityInfo));
+
+ err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
+ if (err != MSG_SUCCESS)
+ {
+ MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
+ }
+
+ MSG_END();
+}
+
+
void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
{
if (pCbMsg->Length > MAX_CBMSG_PAGE_SIZE)
@@ -222,6 +274,47 @@ MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->
}
+void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PRIMARY_S *pEtwsPn)
+{
+ if ( !pEtwsMsg || !pEtwsPn )
+ return;
+
+ if (pEtwsMsg->Length > MAX_ETWS_SIZE)
+ THROW(MsgException::SMS_PLG_ERROR, "ETWS Msg Size is over MAX [%d]", pEtwsMsg->Length);
+
+ unsigned char EtwsData[pEtwsMsg->Length+1];
+
+ memset(EtwsData, 0x00, sizeof(EtwsData));
+ memcpy(EtwsData, pEtwsMsg->szMsgData, pEtwsMsg->Length);
+ EtwsData[pEtwsMsg->Length] = '\0';
+
+ // received time
+ pEtwsPn->recvTime = getRecvTime();
+
+ // Serial Number
+ pEtwsPn->serialNum.geoScope = (EtwsData[0] & 0xC0) >> 6;
+ pEtwsPn->serialNum.msgCode = (EtwsData[0] & 0x3F) << 4;
+ pEtwsPn->serialNum.msgCode |= (EtwsData[1] & 0xF0) >> 4;
+ pEtwsPn->serialNum.updateNum = EtwsData[1] & 0x0F;
+
+ MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pEtwsPn->serialNum.geoScope, pEtwsPn->serialNum.msgCode, pEtwsPn->serialNum.updateNum);
+
+ // Message Identifier
+ pEtwsPn->msgId = (EtwsData[2] << 8) | EtwsData[3];
+ MSG_DEBUG("MSG ID : [%d]", pEtwsPn->msgId);
+
+ // warning type
+ pEtwsPn->warningType = (EtwsData[4] << 8) | EtwsData[5];
+ MSG_DEBUG("warningType : [0x%04x]", pEtwsPn->msgId);
+
+ // warning security information
+ memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo)); // 50bytes
+ for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++)
+ {
+ MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i] );
+ }
+}
+
void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
{
if (pCbMsg->Length > (MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM))
@@ -259,8 +352,52 @@ MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHead
// Get Receive Time
pCbPage->pageHeader.recvTime = getRecvTime();
+
+#if 0
+ // Decode CB Data
+ int dataLen = pCbMsg->Length - 6;
+
+ switch (pCbPage->pageHeader.dcs.codingScheme)
+ {
+ case SMS_CHARSET_7BIT :
+ {
+ dataLen = (dataLen*8) / 7;
+
+ if (pCbPage->pageLength > MAX_CBMSG_PAGE_SIZE)
+ THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbPage->pageLength);
+
+ SmsPluginUDCodec udCodec;
+ int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
+ pCbPage->pageData[unpackLen] = '\0';
+
+ pCbPage->pageLength = unpackLen;
+ }
+ break;
+
+ case SMS_CHARSET_8BIT :
+ case SMS_CHARSET_UCS2 :
+ {
+ pCbPage->pageLength = dataLen;
+
+ memcpy(pCbPage->pageData, &cbData[6], pCbPage->pageLength);
+ pCbPage->pageData[pCbPage->pageLength] = '\0';
+ }
+ break;
+ }
+
+MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
+#endif
}
+unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields )
+{
+ unsigned short serialNum = 0;
+
+ serialNum = ((snFields.geoScope & 0x03) << 14) | ((snFields.msgCode&0x03FF) << 4) | (snFields.updateNum&0x0F);
+ MSG_DEBUG ("serialNum (%x), geo(%x), mc(%x), un(%x)\n", serialNum, snFields.geoScope, snFields.msgCode, snFields.updateNum);
+
+ return serialNum;
+}
bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
{
@@ -534,6 +671,47 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE
}
+void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
+{
+ pMsgInfo->msgId = (msg_message_id_t)EtwsMsg.pageHeader.msgId;
+
+ pMsgInfo->folderId = MSG_CBMSGBOX_ID;
+
+ // Convert Type values
+ pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
+
+ if (EtwsMsg.cbMsgType == SMS_CBMSG_TYPE_ETWS)
+ pMsgInfo->msgType.subType = MSG_ETWS_SMS;
+
+ pMsgInfo->storageId = MSG_STORAGE_PHONE;
+ pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
+ pMsgInfo->bRead = false;
+ pMsgInfo->bProtected = false;
+ pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
+ pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
+
+ // Temporary
+ pMsgInfo->nAddressCnt = 1;
+
+ pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
+ pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
+
+ getDisplayName(EtwsMsg.pageHeader.msgId, pMsgInfo->addressList[0].addressVal);
+ MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
+
+ pMsgInfo->msgPort.valid = false;
+ pMsgInfo->msgPort.dstPort = 0;
+ pMsgInfo->msgPort.srcPort = 0;
+
+ pMsgInfo->displayTime = EtwsMsg.pageHeader.recvTime;
+ MSG_DEBUG("recvTime is %s", ctime(&pMsgInfo->displayTime));
+ MSG_DEBUG("LENGTH %d", EtwsMsg.pageLength);
+ pMsgInfo->bTextSms = true;
+ pMsgInfo->dataSize = EtwsMsg.pageLength;
+ memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData));
+ memcpy(pMsgInfo->msgData, EtwsMsg.pageData, pMsgInfo->dataSize);
+}
+
void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
{
CB_PAGE_INFO_S tmpInfo;
@@ -727,10 +905,8 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayN
{
int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
- char keyName[128];
char from[128];
char to[128];
- char strTmp[CB_CHANNEL_NAME_MAX+1];
for (int i = 0; i < MsgIdCnt; i++)
{
@@ -742,7 +918,6 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayN
if (MsgId >= MsgSettingGetInt(from) && MsgId <= MsgSettingGetInt(to))
{
- char *channelName = NULL;
MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
#if 0
memset(keyName, 0x00, sizeof(keyName));
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index 20761af..f5b5f24 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -184,6 +184,24 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
}
}
+void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *application_id)
+{
+ MSG_PUSH_MESSAGE_DATA_S pushData;
+
+ memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+ /** set PUSH data */
+ memcpy(&pushData.pushHeader, pPushHeader, strlen(pPushHeader));
+
+ pushData.pushBodyLen = pushBodyLen;
+ memcpy(pushData.pushBody, pPushBody, pushBodyLen);
+
+ memcpy(pushData.pushAppId, application_id, MAX_WAPPUSH_ID_LEN);
+
+ /** Callback to MSG FW */
+ listener.pfPushMsgIncomingCb(&pushData);
+}
+
void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen)
{
@@ -236,6 +254,20 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
return err;
}
+msg_error_t SmsPluginEventHandler::callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ /** Callback to MSG FW */
+ err = listener.pfCBMsgIncomingCb(pCbMsg);
+
+ MSG_END();
+
+ return err;
+}
+
msg_error_t SmsPluginEventHandler::callbackInitSimBySat()
{
diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp
index 26fc681..cdbe024 100755
--- a/plugin/sms_plugin/SmsPluginStorage.cpp
+++ b/plugin/sms_plugin/SmsPluginStorage.cpp
@@ -256,8 +256,13 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
}
} else if ((pMsgInfo->msgType.subType == MSG_CB_SMS) || (pMsgInfo->msgType.subType == MSG_JAVACB_SMS)) {
- MSG_DEBUG("Add CB Message");
- err = addCbMessage(pMsgInfo);
+ /** check add message option */
+ bool bSave = false;
+ MsgSettingGetBool(CB_SAVE, &bSave);
+ if(bSave) {
+ MSG_DEBUG("Add CB Message");
+ err = addCbMessage(pMsgInfo);
+ }
} else if ((pMsgInfo->msgType.subType >= MSG_REPLACE_TYPE1_SMS) && (pMsgInfo->msgType.subType <= MSG_REPLACE_TYPE7_SMS)) {
MSG_DEBUG("Add Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
err = addReplaceTypeMsg(pMsgInfo);
@@ -1041,3 +1046,110 @@ msg_error_t SmsPluginStorage::updateAllAddress()
return err;
}
+
+
+msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *count, char *application_id)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ int rowCnt = 0, index = 3;
+
+ char sqlQuery[MAX_QUERY_LEN+1] = {0, };
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONTENT_TYPE, APP_ID, APPCODE FROM %s", MSGFW_PUSH_CONFIG_TABLE_NAME);
+
+ err = dbHandle.getTable(sqlQuery, &rowCnt);
+ MSG_DEBUG("rowCnt: %d", rowCnt);
+
+ if (err == MSG_ERR_DB_NORECORD) {
+ dbHandle.freeTable();
+ return MSG_SUCCESS;
+ }
+ else if ( err != MSG_SUCCESS) {
+ dbHandle.freeTable();
+ return err;
+ }
+
+ char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
+ char app_id[MAX_WAPPUSH_ID_LEN + 1];
+ int appcode = 0, default_appcode = 0;
+ bool found = false;
+ char *_content_type = NULL, *_app_id = NULL;
+ *count = 0;
+
+
+ for (int i = 0; i < rowCnt; i++) {
+ memset(content_type, 0, MAX_WAPPUSH_CONTENT_TYPE_LEN);
+ memset(app_id, 0, MAX_WAPPUSH_ID_LEN);
+
+ dbHandle.getColumnToString(index++, MAX_WAPPUSH_CONTENT_TYPE_LEN + 1, content_type);
+ dbHandle.getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, app_id);
+ appcode = dbHandle.getColumnToInt(index++);
+
+ //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
+ _content_type = strcasestr(pPushHeader, content_type);
+ if(_content_type) {
+ _app_id = strcasestr(pPushHeader, app_id);
+ if(appcode)
+ default_appcode = appcode;
+
+ if(_app_id) {
+ PUSH_APPLICATION_INFO_S pInfo = {0, };
+ pInfo.appcode = appcode;
+ MSG_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, app_id);
+ strcpy(application_id, app_id);
+ pushAppInfoList.push_back(pInfo);
+ (*count)++;
+ found = true;
+ }
+ }
+ }
+
+ if(!found)
+ {
+ // perform default action.
+ PUSH_APPLICATION_INFO_S pInfo = {0, };
+ pInfo.appcode = default_appcode;
+ strcpy(application_id, app_id);
+ pushAppInfoList.push_back(pInfo);
+ *count = 1;
+ }
+ dbHandle.freeTable();
+
+ return err;
+}
+
+
+msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
+{
+ msg_error_t err = MSG_SUCCESS;
+ if(index > pushAppInfoList.size() - 1)
+ return MSG_ERR_INVALID_PARAMETER;
+
+ std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
+ int count = 0;
+ for (; it != pushAppInfoList.end(); it++)
+ {
+ if(index == count){
+ *appcode = it->appcode;
+ break;
+ }
+ count++;
+ }
+
+ return err;
+}
+
+
+msg_error_t SmsPluginStorage::releasePushEvent()
+{
+ msg_error_t err = MSG_SUCCESS;
+ std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
+
+ for (; it != pushAppInfoList.end(); it++)
+ it = pushAppInfoList.erase(it);
+
+ return err;
+}
diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
index 015a750..134e4f1 100755
--- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
@@ -28,6 +28,7 @@
static unsigned short wapPushPortList [] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F};
+#if 0
const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
{
{(char*)"text/vnd.wap.si", (char*)"X-Wap-Application-Id: x-wap-application:wml.ua\r\n", SMS_WAP_APPLICATION_PUSH_SI},
@@ -60,13 +61,20 @@ const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
{(char*)"application/vnd.oma.drm.roap-trigger+xml", (char*)"X-Wap-Application-Id: x-wap-application:drm.ua\r\n", SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML},
{(char*)"application/vnd.oma.drm.roap-trigger+wbxml", (char*)"X-Wap-Application-Id: x-wap-application:drm.ua\r\n", SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML},
+ {(char*)"text/vnd.wap.connectivity-xml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML},
+ {(char*)"application/vnd.wap.connectivity-wbxml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML},
+
+ {(char*)"application/x-wap-prov.browser-settings", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS},
+ {(char*)"application/x-wap-prov.browser-bookmarks", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS},
+ {(char*)"application/x-wap-prov.syncset+xml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_SYNCSET_WBXML},
+ {(char*)"application/x-wap-prov.syncset+wbxml", (char*)"X-Wap-Application-Id: x-wap-samsung:provisioning.ua\r\n", SMS_WAP_APPLICATION_PUSH_SYNCSET_XML},
{(char*)"text/vnd.wap.emn+xml", (char*)"X-Wap-Application-Id: x-wap-application:emn.ua\r\n", SMS_WAP_APPLICATION_PUSH_EMAIL_XML},
{(char*)"application/vnd.wap.emn+wbxml", (char*)"X-Wap-Application-Id: x-wap-application:emn.ua\r\n", SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML},
{(char*)"application/vnd.wv.csp.cir", (char*)"X-Wap-Application-Id: x-wap-application:wv.ua\r\n", SMS_WAP_APPLICATION_PUSH_IMPS_CIR},
{(char*)"application/vnd.omaloc-supl-init", (char*)"X-Wap-Application-Id: x-oma-application:ulp.ua\r\n", SMS_WAP_APPLICATION_LBS},
{NULL, NULL}
};
-
+#endif
char gWapCodeBufferLeft[WSP_CODE_BUFFER_LEFT_LEN_MAX];
char gWapCodeBufferRight[WSP_CODE_BUFFER_RIGHT_LEN_MAX];
@@ -602,7 +610,8 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
{ (char*)"x-wap-application:loc.ua", 0x06 },
{ (char*)"x-wap-application:syncml.dm", 0x07 },
{ (char*)"x-wap-application:drm.ua", 0x08 },
- { (char*)"x-wap-application:emn.ua", 0x09 }
+ { (char*)"x-wap-application:emn.ua", 0x09 },
+ { (char*)"x-oma-docomo:xmd.mail.ua", 0x905C },
};
@@ -743,7 +752,7 @@ bool SmsPluginWapPushHandler::IsWapPushMsg(SMS_USERDATA_S *pUserData)
return false;
}
-
+#if 0
SMS_WAP_APP_CODE_T SmsPluginWapPushHandler::getAppCode(const char *pPushHeader)
{
int appCount = sizeof(pushDefaultApplication)/sizeof(pushDefaultApplication[0]) - 1;
@@ -771,6 +780,7 @@ SMS_WAP_APP_CODE_T SmsPluginWapPushHandler::getAppCode(const char *pPushHeader)
return appCode;
}
+#endif
void SmsPluginWapPushHandler::copyDeliverData(SMS_DELIVER_S *pDeliver)
@@ -894,7 +904,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
MSG_END();
}
-
+#if 0
void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
{
MSG_BEGIN();
@@ -1040,7 +1050,169 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_END();
}
+#else
+void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
+{
+ MSG_BEGIN();
+
+ if (pPushBody == NULL) {
+ MSG_DEBUG("pPushBody is NULL");
+ return;
+ }
+
+ msg_error_t err = MSG_SUCCESS;
+ int pushEvt_cnt = 0;
+ char app_id[MAX_WAPPUSH_ID_LEN] = {0,};
+ SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
+
+ err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id);
+ MSG_DEBUG("pushEvt_cnt: %d", pushEvt_cnt);
+ if(err != MSG_SUCCESS) {
+ MSG_DEBUG("Fail to get registered push event");
+ return;
+ }
+
+ for(int i = 0; i < pushEvt_cnt; ++i) {
+
+ /** check Push message receive setting */
+ bool bPushRecv = false;
+ int appcode = 0;
+ MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
+
+ storageHandler->getnthPushEvent(i, &appcode);
+ MSG_DEBUG("pushEvt_cnt: %d, appcode: %d", pushEvt_cnt, appcode);
+ if ((bPushRecv == false) && (appcode != SMS_WAP_APPLICATION_MMS_UA)) {
+ MSG_DEBUG("Push Message Receive option is OFF. Drop Push Message.");
+ return;
+ }
+
+ switch (appcode) {
+ case SMS_WAP_APPLICATION_MMS_UA:
+ MSG_DEBUG("Received MMS Notification");
+ handleMMSNotification(pPushBody, PushBodyLen);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_SI:
+ MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
+ handleSIMessage(pPushBody, PushBodyLen, true);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_SIC:
+ MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
+ handleSIMessage(pPushBody, PushBodyLen, false);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_SL:
+ MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
+ handleSLMessage(pPushBody, PushBodyLen, true);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_SLC:
+ MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
+ handleSLMessage(pPushBody, PushBodyLen, false);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_CO:
+ MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
+ handleCOMessage(pPushBody, PushBodyLen, true);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_COC:
+ MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
+ handleCOMessage(pPushBody, PushBodyLen, false);
+ break;
+
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+ MSG_DEBUG("Received DM BOOTSTRAP");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+ MSG_DEBUG("Received DM BOOTSTRAP");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+ MSG_DEBUG("Received Provisioning");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+ MSG_DEBUG("Received Provisioning");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+ MSG_DEBUG("Received Provisioning");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+ MSG_DEBUG("Received DM Notification");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+ MSG_DEBUG("Received DS Notification");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+ MSG_DEBUG("Received DS Notification");
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ break;
+
+ case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
+ case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
+ MSG_DEBUG("Received DRM UA");
+
+ if (pPushBody != NULL)
+ handleDrmVer1(pPushBody, PushBodyLen);
+
+ break;
+
+ case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
+ case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
+ case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
+ case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
+ MSG_DEBUG("Received DRM V2");
+ // TODO: DRM V2
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_EMAIL:
+ case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
+ case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
+ MSG_DEBUG("Received Email");
+ // TODO: Email
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
+ MSG_DEBUG("Received IMPS CIR");
+ // TODO: IMPS CIR
+ break;
+
+ case SMS_WAP_APPLICATION_LBS :
+ MSG_DEBUG("Received LBS related message");
+ SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
+ // TODO: LBS
+ break;
+
+ case SMS_WAP_APPLICATION_PUSH_SIA :
+ MSG_DEBUG("Received SIA");
+ // TODO: SIA
+ break;
+
+ default:
+ SmsPluginEventHandler::instance()->handlePushMsgIncoming(pPushHeader, pPushBody, PushBodyLen, app_id);
+ break;
+ }
+ }
+ storageHandler->releasePushEvent();
+
+ MSG_END();
+}
+#endif
void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen)
{
@@ -2182,13 +2354,16 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
- if (integerValue > 0x0A) {
- MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x0A).\n");
- break;
+ int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
+ for(int i = 0; i < count ; ++i)
+ {
+ if(integerValue == wspHeaderApplId[i].parameterCode)
+ {
+ snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
+ break;
+ }
}
-
- snprintf((char*)temp, 64, "%s", wspHeaderApplId[integerValue].parameterToken);
- strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
}
break;
/* Accept-Application */
diff --git a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
index 9e46c77..febd64d 100755
--- a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
@@ -65,6 +65,7 @@ public:
static SmsPluginCbMsgHandler* instance();
void handleCbMsg(TelSmsCbMsg_t *pCbMsg);
+ void handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg);
private:
SmsPluginCbMsgHandler();
@@ -74,11 +75,15 @@ private:
void Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage);
void Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage);
+ void DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PRIMARY_S *pEtwsPn);
+ unsigned short encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields );
bool checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg);
unsigned char checkCbPage(SMS_CBMSG_PAGE_S CbPage);
void MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg);
void convertCbMsgToMsginfo(SMS_CBMSG_S cbMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
+ void convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
+ int convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg);
void addToPageLiat(SMS_CBMSG_PAGE_S CbPage);
void removeFromPageList(SMS_CBMSG_PAGE_S CbPage);
diff --git a/plugin/sms_plugin/include/SmsPluginEventHandler.h b/plugin/sms_plugin/include/SmsPluginEventHandler.h
index 0165eb2..e8ba8fa 100755
--- a/plugin/sms_plugin/include/SmsPluginEventHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginEventHandler.h
@@ -39,8 +39,10 @@ public:
void handleMsgIncoming(SMS_TPDU_S *pTpdu);
void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen);
void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
+ void handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *app_id);
msg_error_t callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg);
msg_error_t callbackInitSimBySat();
msg_error_t callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h
index fae7306..df8029a 100755
--- a/plugin/sms_plugin/include/SmsPluginStorage.h
+++ b/plugin/sms_plugin/include/SmsPluginStorage.h
@@ -27,6 +27,7 @@
#include "SmsPluginTypes.h"
#include "MsgInternalTypes.h"
#include "MsgSqliteWrapper.h"
+#include <list>
extern "C"
{
@@ -53,6 +54,9 @@ public:
msg_error_t deleteSmsMessage(msg_message_id_t MsgId);
+ msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id);
+ msg_error_t getnthPushEvent(int index, int *appcode);
+ msg_error_t releasePushEvent();
private:
SmsPluginStorage();
~SmsPluginStorage();
@@ -71,7 +75,8 @@ private:
static SmsPluginStorage* pInstance;
MsgDbHandler dbHandle;
-
+ std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
+// unsigned char tmpMsgRef;
};
#endif //SMS_PLUGIN_STORAGE_H
diff --git a/plugin/sms_plugin/include/SmsPluginTypes.h b/plugin/sms_plugin/include/SmsPluginTypes.h
index eb07acc..57d60f4 100755
--- a/plugin/sms_plugin/include/SmsPluginTypes.h
+++ b/plugin/sms_plugin/include/SmsPluginTypes.h
@@ -41,6 +41,7 @@
#define MAX_UD_HEADER_NUM 7
#define MAX_SAT_TPDU_LEN 175
#define MAX_CBMSG_PAGE_SIZE 93
+#define MAX_ETWS_SIZE 56
#define MAX_CBMSG_PAGE_NUM 15
#define MAX_SIM_SMS_NUM 90
@@ -168,9 +169,10 @@ typedef unsigned char SMS_SAT_CMD_TYPE_T;
typedef unsigned short SMS_SIM_EFILE_NAME_T;
-
typedef unsigned char SMS_LANGUAGE_ID_T;
+typedef unsigned char SMS_ETWS_NETWORK_TYPE_T;
+
/*==================================================================================================
ENUMS
@@ -462,6 +464,7 @@ enum _SMS_CBMSG_TYPE_E
SMS_CBMSG_TYPE_SCHEDULE, /**< Schedule */
SMS_CBMSG_TYPE_CBS41, /**< CBS41 */
SMS_CBMSG_TYPE_JAVACBS, /**< JAVA-CB Message*/
+ SMS_CBMSG_TYPE_ETWS,
};
@@ -852,6 +855,14 @@ typedef struct _SMS_CBMSG_S
char msgData[MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM+1]; /**< user data */
} SMS_CBMSG_S;
+typedef struct _SMS_ETWS_PRIMARY_S
+{
+ time_t recvTime;
+ SMS_CBMSG_SERIAL_NUM_S serialNum;
+ unsigned short msgId;
+ unsigned short warningType;
+ unsigned char warningSecurityInfo[MAX_ETWS_SIZE-6];
+}SMS_ETWS_PRIMARY_S;
typedef struct _SMS_LANG_INFO_S
{