summaryrefslogtreecommitdiff
path: root/plugin/sms_plugin
diff options
context:
space:
mode:
authorseunggi.hong <seunggi.hong@samsung.com>2015-04-03 17:44:25 +0900
committerseunggi.hong <seunggi.hong@samsung.com>2015-04-03 17:46:03 +0900
commit873b33b178b7b31d1074e5c1f93b2f68f839416b (patch)
tree6a084331009e4d82c6351b2690e76161fd0a485b /plugin/sms_plugin
parent1cd776d274fc36821557958fca79abeec457a703 (diff)
downloadmsg-service-873b33b178b7b31d1074e5c1f93b2f68f839416b.tar.gz
msg-service-873b33b178b7b31d1074e5c1f93b2f68f839416b.tar.bz2
msg-service-873b33b178b7b31d1074e5c1f93b2f68f839416b.zip
Change-Id: I73019c4c236709be9c36c1744a3bcce4b98076e4 Signed-off-by: seunggi.hong <seunggi.hong@samsung.com>
Diffstat (limited to 'plugin/sms_plugin')
-rwxr-xr-xplugin/sms_plugin/CMakeLists.txt9
-rwxr-xr-xplugin/sms_plugin/SmsPluginCallback.cpp583
-rwxr-xr-xplugin/sms_plugin/SmsPluginCbMsgHandler.cpp493
-rwxr-xr-xplugin/sms_plugin/SmsPluginConcatHandler.cpp417
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp477
-rwxr-xr-xplugin/sms_plugin/SmsPluginMain.cpp479
-rwxr-xr-xplugin/sms_plugin/SmsPluginParamCodec.cpp40
-rwxr-xr-xplugin/sms_plugin/SmsPluginSatHandler.cpp193
-rwxr-xr-xplugin/sms_plugin/SmsPluginSetting.cpp1503
-rwxr-xr-xplugin/sms_plugin/SmsPluginSimMsg.cpp673
-rwxr-xr-xplugin/sms_plugin/SmsPluginStorage.cpp1216
-rwxr-xr-xplugin/sms_plugin/SmsPluginTpduCodec.cpp87
-rwxr-xr-xplugin/sms_plugin/SmsPluginTransport.cpp548
-rwxr-xr-xplugin/sms_plugin/SmsPluginUAManager.cpp30
-rwxr-xr-xplugin/sms_plugin/SmsPluginUDCodec.cpp36
-rwxr-xr-xplugin/sms_plugin/SmsPluginWapPushHandler.cpp397
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginCallback.h24
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginCbMsgHandler.h25
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginConcatHandler.h21
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginEventHandler.h29
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginMain.h25
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginParamCodec.h9
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSatHandler.h27
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSetting.h86
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSimMsg.h46
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginStorage.h45
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTpduCodec.h7
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTransport.h36
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTypes.h190
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginUAManager.h13
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginUDCodec.h7
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginWapPushHandler.h21
32 files changed, 5090 insertions, 2702 deletions
diff --git a/plugin/sms_plugin/CMakeLists.txt b/plugin/sms_plugin/CMakeLists.txt
index 09601e0..7c6a0a9 100755
--- a/plugin/sms_plugin/CMakeLists.txt
+++ b/plugin/sms_plugin/CMakeLists.txt
@@ -30,17 +30,20 @@ SET(SMS-PLUGIN-SRCS
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginUAManager.cpp
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginCallback.cpp
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginMain.cpp
+ ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginDSHandler.cpp
)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include/mapi
${CMAKE_SOURCE_DIR}/include/common
${CMAKE_SOURCE_DIR}/include/utils
+ ${CMAKE_SOURCE_DIR}/include/externals
${CMAKE_CURRENT_SOURCE_DIR}/include
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 drm-client dlog vconf dbus-glib-1)
+pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 db-util)
+#capi-telephony
FOREACH(flag ${sms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -53,7 +56,7 @@ ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
ADD_LIBRARY(${SMS-PLUGIN-LIB} SHARED ${SMS-PLUGIN-SRCS})
-TARGET_LINK_LIBRARIES(${SMS-PLUGIN-LIB} ${sms_plugin_pkgs_LDFLAGS} ${UTILS-LIB})
+TARGET_LINK_LIBRARIES(${SMS-PLUGIN-LIB} ${sms_plugin_pkgs_LDFLAGS} ${UTILS-LIB} ${EXTERNALS-LIB})
-INSTALL(TARGETS ${SMS-PLUGIN-LIB} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS ${SMS-PLUGIN-LIB} LIBRARY DESTINATION lib)
diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp
index 8141439..202c8be 100755
--- a/plugin/sms_plugin/SmsPluginCallback.cpp
+++ b/plugin/sms_plugin/SmsPluginCallback.cpp
@@ -1,26 +1,24 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <glib.h>
#include <pthread.h>
#include "MsgDebug.h"
+#include "MsgCppTypes.h"
#include "MsgException.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginCbMsgHandler.h"
@@ -34,8 +32,10 @@
#include "SmsPluginSetting.h"
#include "MsgGconfWrapper.h"
#include "SmsPluginCallback.h"
+#include "SmsPluginDSHandler.h"
+
+extern bool isMemAvailable;
-extern struct tapi_handle *pTapiHandle;
/*==================================================================================================
FUNCTION IMPLEMENTATION
@@ -47,7 +47,7 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
try
{
// Call Event Handler
- SmsPluginEventHandler::instance()->setDeviceStatus();
+ SmsPluginEventHandler::instance()->setDeviceStatus(handle);
}
catch (MsgException& e)
{
@@ -57,26 +57,100 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
}
+SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result)
+{
+ SMS_NETWORK_STATUS_T sentStatus;
+
+ /* Convert TAPI status -> SMS network status */
+ switch ((TelSmsResponse_t)result) {
+ case TAPI_NETTEXT_SENDSMS_SUCCESS :
+ sentStatus = SMS_NETWORK_SEND_SUCCESS;
+ break;
+
+ case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
+ sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
+ break;
+
+ case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
+ case TAPI_NETTEXT_TEMPORARY_FAILURE :
+ case TAPI_NETTEXT_CONGESTION :
+ case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
+ case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
+ case TAPI_NETTEXT_NETWORK_OUTOFORDER:
+ sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
+ break;
+
+ case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
+ sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
+ break;
+
+ case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
+ case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
+ sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
+ break;
+ case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
+ sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
+ break;
+ default :
+ sentStatus = SMS_NETWORK_SEND_FAIL;
+ break;
+ }
+ return sentStatus;
+}
void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventSentStatus is called. : result = [%d]", result);
+ MSG_DEBUG("TapiEventSentStatus is called. : result = [0x%x]", result);
+
+ SMS_NETWORK_STATUS_T sentStatus;
+
+ TelSatMoSmCtrlIndData_t *moCtrlStatus = (TelSatMoSmCtrlIndData_t *)user_data;
+
+ sentStatus = convertTapiRespToSmsPlugin(result);
+
+ if (moCtrlStatus && sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED) {
+ if (moCtrlStatus->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
+ sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD;
+ }
+
+ if (result != TAPI_NETTEXT_SENDSMS_SUCCESS)
+ MSG_INFO("sentStatus:[%d], tapi_result:[0x%x]", sentStatus, result);
+
+ MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
+ /* only temporary errors should be returned without calling handleSentStatus() in order to resend sms */
+ if (sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
+ sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD) {
+ SmsPluginTransport::instance()->setNetStatus(sentStatus);
+ return;
+ }
+
+ if (sentStatus == SMS_NETWORK_SEND_FAIL) {
+ int svc_type;
+ tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) {
+ sentStatus = SMS_NETWORK_SEND_PENDING;
+ }
+ }
+
+ /* Convert SMS status -> Messaging network status */
msg_network_status_t netStatus;
- // Convert TAPI status -> Messaging status
- if ((TelSmsResponse_t)result == TAPI_NETTEXT_SENDSMS_SUCCESS)
+ if (sentStatus == SMS_NETWORK_SEND_SUCCESS) {
netStatus = MSG_NETWORK_SEND_SUCCESS;
- else
+ } else if (sentStatus == SMS_NETWORK_SENDING) {
+ netStatus = MSG_NETWORK_SENDING;
+ } else if (sentStatus == SMS_NETWORK_SEND_PENDING) {
+ netStatus = MSG_NETWORK_SEND_PENDING;
+ } else {
netStatus = MSG_NETWORK_SEND_FAIL;
+ }
try
{
- // Call Event Handler
SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
- // Call SAT Handler
- SmsPluginSatHandler::instance()->ctrlSms(netStatus);
+ SmsPluginTransport::instance()->setNetStatus(sentStatus);
}
catch (MsgException& e)
{
@@ -86,16 +160,48 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
}
+void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSatSmsSentStatus is called. : result = [%d]", result);
+
+ SMS_NETWORK_STATUS_T sentStatus;
+
+ sentStatus = convertTapiRespToSmsPlugin(result);
+
+ MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
+
+ if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE)
+ {
+ int svc_type;
+ tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+ sentStatus = SMS_NETWORK_SEND_PENDING;
+ }
+ }
+
+ try
+ {
+ SmsPluginSatHandler::instance()->ctrlSms(handle, sentStatus);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return;
+ }
+}
void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventMsgIncoming is called. noti_id [%s]", noti_id);
+ MSG_SEC_DEBUG("TapiEventMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
MSG_DEBUG("Error. evt->pData is NULL.");
return;
}
-
+#if 0
+ SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, NULL);
+ return;
+#endif
TelSmsDatapackageInfo_t* pDataPackage = (TelSmsDatapackageInfo_t*)data;
SMS_TPDU_S tpdu;
@@ -118,7 +224,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("tpdu.data.deliver.dcs.codingScheme : %d", tpdu.data.deliver.dcs.codingScheme);
MSG_DEBUG("tpdu.data.deliver.dcs.codingGroup : %d", tpdu.data.deliver.dcs.codingGroup);
MSG_DEBUG("tpdu.data.deliver.dcs.bIndActive : %d", tpdu.data.deliver.dcs.bIndActive);
- MSG_DEBUG("tpdu.data.deliver.originAddress.address : %s", tpdu.data.deliver.originAddress.address);
+ MSG_SEC_DEBUG("tpdu.data.deliver.originAddress.address : %s", tpdu.data.deliver.originAddress.address);
MSG_DEBUG("tpdu.data.deliver.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.deliver.timeStamp.time.absolute.year, tpdu.data.deliver.timeStamp.time.absolute.month, tpdu.data.deliver.timeStamp.time.absolute.day,
tpdu.data.deliver.timeStamp.time.absolute.hour, tpdu.data.deliver.timeStamp.time.absolute.minute, tpdu.data.deliver.timeStamp.time.absolute.second);
MSG_DEBUG("tpdu.data.deliver.userData.headerCnt : %d", tpdu.data.deliver.userData.headerCnt);
@@ -139,7 +245,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("tpdu.data.statusRep.dcs.msgClass : %d", tpdu.data.statusRep.dcs.msgClass);
MSG_DEBUG("tpdu.data.statusRep.dcs.codingScheme : %d", tpdu.data.statusRep.dcs.codingScheme);
MSG_DEBUG("tpdu.data.statusRep.dcs.codingGroup : %d", tpdu.data.statusRep.dcs.codingGroup);
- MSG_DEBUG("tpdu.data.statusRep.recipAddress.address : %s", tpdu.data.statusRep.recipAddress.address);
+ MSG_SEC_DEBUG("tpdu.data.statusRep.recipAddress.address : %s", tpdu.data.statusRep.recipAddress.address);
MSG_DEBUG("tpdu.data.statusRep.timeStamp.time : %d/%d/%d %d:%d:%d ", tpdu.data.statusRep.timeStamp.time.absolute.year, tpdu.data.statusRep.timeStamp.time.absolute.month, tpdu.data.statusRep.timeStamp.time.absolute.day,
tpdu.data.statusRep.timeStamp.time.absolute.hour, tpdu.data.statusRep.timeStamp.time.absolute.minute, tpdu.data.statusRep.timeStamp.time.absolute.second);
MSG_DEBUG("tpdu.data.statusRep.dischargeTime.time : %d/%d/%d %d:%d:%d ", tpdu.data.statusRep.dischargeTime.time.absolute.year, tpdu.data.statusRep.dischargeTime.time.absolute.month, tpdu.data.statusRep.dischargeTime.time.absolute.day,
@@ -162,16 +268,16 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
{
- SmsPluginConcatHandler::instance()->handleConcatMsg(&tpdu); // Call Concat Msg Handler
+ SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu); // Call Concat Msg Handler
}
else
{
- SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
+ SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
}
}
else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
{
- SmsPluginEventHandler::instance()->handleMsgIncoming(&tpdu); // Call Event Handler
+ SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
}
}
catch (MsgException& e)
@@ -185,7 +291,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventCbMsgIncoming is called. noti_id [%s]", noti_id);
+ MSG_SEC_DEBUG("TapiEventCbMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
MSG_DEBUG("Error. evt->pData is NULL.");
@@ -196,7 +302,7 @@ void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data,
try
{
- SmsPluginCbMsgHandler::instance()->handleCbMsg(pCbMsg);
+ SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, pCbMsg);
}
catch (MsgException& e)
{
@@ -209,7 +315,7 @@ 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);
+ MSG_SEC_DEBUG("TapiEventEtwsMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
MSG_DEBUG("Error. evt->pData is NULL.");
@@ -220,7 +326,7 @@ void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *dat
try
{
- SmsPluginCbMsgHandler::instance()->handleEtwsMsg(pEtwsMsg);
+ SmsPluginCbMsgHandler::instance()->handleEtwsMsg(handle, pEtwsMsg);
}
catch (MsgException& e)
{
@@ -247,11 +353,11 @@ void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *use
MSG_DEBUG("Error. data is NULL.");
MSG_SIM_COUNT_S simCnt;
memset(&simCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
- SmsPluginSimMsg::instance()->setSimMsgCntEvent(&simCnt);
+ SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, &simCnt);
return;
}
- SmsPluginSimMsg::instance()->setSimMsgCntEvent((MSG_SIM_COUNT_S *)data);
+ SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, (MSG_SIM_COUNT_S *)data);
}
@@ -264,12 +370,16 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
MSG_DEBUG("Error!! pEvent->Status [%d]", result);
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
return;
}
+
TelSmsData_t* pSmsTpdu = (TelSmsData_t*)data;
+ //SmsPluginSimMsg::instance()->deleteSimMessage((msg_sim_id_t)pSmsTpdu->SimIndex);
+
+ int *simIdList = (int *)user_data;
// Reading TelSmsData_t
MSG_DEBUG ("sim index %d", pSmsTpdu->SimIndex);
@@ -280,7 +390,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
MSG_DEBUG ("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength);
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
return;
}
@@ -304,7 +414,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
MSG_DEBUG("Unsupported message!!");
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
return;
}
@@ -313,9 +423,15 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
// Handler Concatenated Message
if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
- tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
- {
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
+ SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
+ //SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ return;
+ }
+
+ if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_SPECIAL_SMS) {
+ MSG_DEBUG("Unsupported Special SMS!!");
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
return;
}
}
@@ -324,10 +440,9 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
MSG_DEBUG("Unsupported message!!");
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
return;
}
-
MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++)
@@ -336,7 +451,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
if (tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
{
- SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
return;
}
}
@@ -346,23 +461,64 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ // set storage id
+ msgInfo.storageId = MSG_STORAGE_SIM;
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+
SmsPluginEventHandler::instance()->convertTpduToMsginfo(&tpdu, &msgInfo);
- // set Sim Message ID
- msgInfo.msgId = pSmsTpdu->SimIndex;
+ msgInfo.sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ if (tpdu.tpduType == SMS_TPDU_DELIVER && tpdu.data.deliver.dcs.bMWI == true) {
+ if (tpdu.data.deliver.pid == 0x20 && tpdu.data.deliver.originAddress.ton == SMS_TON_ALPHANUMERIC) {
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ char *voiceNumber = NULL;
+ char *voiceAlphaId = NULL;
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msgInfo.sim_idx);
+ voiceNumber = MsgSettingGetString(keyName);
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msgInfo.sim_idx);
+ voiceAlphaId = MsgSettingGetString(keyName);
+
+ memset(msgInfo.addressList[0].addressVal, 0x00, sizeof(msgInfo.addressList[0].addressVal));
+ memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
+
+ if (voiceNumber) {
+ snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), "%s", voiceNumber);
+ free(voiceNumber);
+ voiceNumber = NULL;
+ }
+
+ if (voiceAlphaId) {
+ snprintf(msgInfo.addressList[0].displayName, sizeof(msgInfo.addressList[0].displayName), "%s", voiceAlphaId);
+ free(voiceAlphaId);
+ voiceAlphaId = NULL;
+ }
+
+ memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "Voice message");
+ }
+ }
+ else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
+ msgInfo.displayTime = time(NULL);
+ }
// set read status
msgInfo.bRead = bRead;
- // set storage id
- msgInfo.storageId = MSG_STORAGE_SIM;
-
+ simIdList[0] = pSmsTpdu->SimIndex + 1;
/// Print MSG_MESSAGE_INFO_S
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
- MSG_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].displayName : %s", msgInfo.addressList[0].displayName);
MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
MSG_DEBUG("msgInfo.bRead : %d", msgInfo.bRead);
@@ -374,12 +530,14 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
MSG_DEBUG("msgInfo.displayTime : %s", ctime(&msgInfo.displayTime));
MSG_DEBUG("msgInfo.dataSize : %d", msgInfo.dataSize);
if (msgInfo.bTextSms == true)
- MSG_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
+ MSG_SEC_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
else
- MSG_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
+ MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
+ MSG_DEBUG("msgInfo.sim_idx : %d", msgInfo.sim_idx);
MSG_DEBUG("###############################################################");
- SmsPluginSimMsg::instance()->setSimMsgEvent(&msgInfo, true); // Call Event Handler
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+
}
@@ -395,22 +553,44 @@ void TapiEventSaveSimMsg(TapiHandle *handle, int result, void *data, void *user_
else
MSG_DEBUG("Data(SIM Msg ID) is NULL");
- SmsPluginSimMsg::instance()->setSaveSimMsgEvent(simId, result);
+ SmsPluginSimMsg::instance()->setSaveSimMsgEvent(handle, simId, result);
}
void TapiEventSaveClass2Msg(TapiHandle *handle, int result, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventSaveSimMsg is called. result [%d]", result);
+ MSG_DEBUG("TapiEventSaveClass2Msg is called. result [%d]", result);
int simId = -1;
- if (data != NULL)
+ if (data != NULL) {
simId = *((int*)data);
- else
+ MSG_DEBUG("SIM Msg ID : %d", simId);
+ } else {
MSG_DEBUG("Data(SIM Msg ID) is NULL");
+ }
+
+ MSG_MESSAGE_INFO_S *pMsgInfo = (MSG_MESSAGE_INFO_S *)user_data;
+
+ SmsPluginSimMsg::instance()->setSaveClass2MsgEvent(handle, simId, result, pMsgInfo);
+
+ if(result == TAPI_NETTEXT_SENDSMS_SUCCESS)
+ {
+ SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)simId, true);
+ }
+ else
+ {
+ SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
+ }
- SmsPluginSimMsg::instance()->setSaveClass2MsgEvent(simId, result);
+ if (pMsgInfo) {
+ if (pMsgInfo->addressList) {
+ delete[] pMsgInfo->addressList;
+ pMsgInfo->addressList = NULL;
+ }
+ free(pMsgInfo);
+ pMsgInfo = NULL;
+ }
}
@@ -418,18 +598,16 @@ void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *use
{
MSG_DEBUG("TapiEventDeleteSimMsg is called. result [%d]", result);
- MSG_DEBUG("status : [%d]", (TelSmsCause_t)result);
-
if (result != TAPI_API_SUCCESS || data == NULL)
{
MSG_DEBUG("Error. data is NULL.");
- SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
+ SmsPluginSimMsg::instance()->setDelSimEvent(-1, false);
return;
}
int sim_id = *((int*)data);
- SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)sim_id, true);
+ SmsPluginSimMsg::instance()->setDelSimEvent(sim_id, true);
}
@@ -515,7 +693,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
if (result != TAPI_API_SUCCESS || data == NULL)
{
MSG_DEBUG("Error. data is NULL.");
- SmsPluginSetting::instance()->setParamEvent(NULL, -1, false);
+ SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
@@ -533,7 +711,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
{
MSG_DEBUG("Wrong Alpha ID Length[%d]", alphaIdLen);
- SmsPluginSetting::instance()->setParamEvent(NULL, -1, false);
+ SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
@@ -545,13 +723,13 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
if(addrLen > SMSC_ADDR_MAX)
{
MSG_DEBUG("addrLen is too long: %d", addrLen);
- SmsPluginSetting::instance()->setParamEvent(NULL, -1, false);
+ SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
else if(addrLen < 2)
{
MSG_DEBUG("addrLen is too short: %d", addrLen);
- SmsPluginSetting::instance()->setParamEvent(NULL, -1, false);
+ SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
@@ -577,13 +755,13 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
memset(smscData.smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
paramCodec.decodeSMSC(smsParam->TpSvcCntrAddr.szDiallingNum, addrLen, smscData.smscAddr.ton, smscData.smscAddr.address);
- MSG_DEBUG("SMSC Address : [%s]", smscData.smscAddr.address);
+ MSG_SEC_DEBUG("SMSC Address : [%s]", smscData.smscAddr.address);
memset(smscData.name, 0x00, SMSC_NAME_MAX+1);
memcpy(smscData.name, smsParam->szAlphaId, alphaIdLen);
smscData.name[alphaIdLen] = '\0';
- MSG_DEBUG("SMSC Name : [%s]", smscData.name);
+ MSG_SEC_DEBUG("SMSC Name : [%s]", smscData.name);
}
else
{
@@ -595,7 +773,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
// memset(smscData.smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
// memset(smscData.name, 0x00, SMSC_NAME_MAX+1);
- SmsPluginSetting::instance()->setParamEvent(NULL, -1, false);
+ SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
@@ -663,26 +841,42 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
}
else
{
+
smscData.valPeriod = 0;
+
MSG_DEBUG("Validity Period is not present");
}
- SmsPluginSetting::instance()->setParamEvent(&smscData, (int)smsParam->RecordIndex, true);
+ SmsPluginSetting::instance()->setParamEvent(handle, &smscData, (int)smsParam->RecordIndex, true);
}
+void TapiEventSetSmscInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSetSmscInfo is called. result=[%d]", result);
+
+ if (result != TAPI_API_SUCCESS) {
+ SmsPluginSetting::instance()->setResultFromSim(false);
+ } else {
+ SmsPluginSetting::instance()->setResultFromSim(true);
+ }
+}
+
+
void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventGetCBConfig is called.");
MSG_CBMSG_OPT_S cbOpt = {0};
- if (result != TAPI_API_SUCCESS || data == NULL)
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0)
{
MSG_DEBUG("Error. data is NULL.");
- SmsPluginSetting::instance()->setCbConfigEvent(NULL, false);
+ SmsPluginSetting::instance()->setCbConfigEvent(handle, NULL, false);
return;
}
@@ -693,7 +887,9 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount;
- MSG_DEBUG("Receive [%d], Max SIM Count [%d]", cbOpt.bReceive, cbOpt.maxSimCnt);
+ cbOpt.simIndex = simIndex;
+
+ MSG_DEBUG("Sim Index [%d], Receive [%d], Max SIM Count [%d]", simIndex, cbOpt.bReceive, cbOpt.maxSimCnt);
cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
@@ -703,10 +899,6 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
}
- if (MsgSettingSetInt(CB_CHANNEL_COUNT, cbOpt.channelData.channelCnt) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT);
- }
-
MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
@@ -719,7 +911,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
MSG_DEBUG("Channel FROM [%d], Channel TO [%d] ", cbOpt.channelData.channelInfo[i].from, cbOpt.channelData.channelInfo[i].to);
}
- SmsPluginSetting::instance()->setCbConfigEvent(&cbOpt, true);
+ SmsPluginSetting::instance()->setCbConfigEvent(handle, &cbOpt, true);
}
void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
@@ -727,8 +919,9 @@ void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
MSG_DEBUG("TapiEventSetMailboxInfo is called. result = [%d]", result);
bool bRet = true;
+ bool *bShowError = (bool*)user_data;
- if (result != TAPI_SIM_ACCESS_SUCCESS)
+ if (result != TAPI_SIM_ACCESS_SUCCESS && *bShowError == true)
bRet = false;
SmsPluginSetting::instance()->setResultFromSim(bRet);
@@ -736,13 +929,35 @@ void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventGetMailboxInfo is called.");
-
- if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
- SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, false);
-
+ MSG_DEBUG("TapiEventGetMailboxInfo is called. result=[%d]", result);
+
+ if (result == TAPI_API_SIM_SERVICE_IS_DISABLED) {
+ MSG_INFO("result is TAPI_API_SIM_SERVICE_IS_DISABLED");
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ char *voiceNum = NULL;
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+ voiceNum = MsgSettingGetString(keyName);
+
+ if (voiceNum && strlen(voiceNum)) {
+ MSG_DEBUG("Voice mailbox number exist in vconf");
+ SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, true, false);
+ free(voiceNum);
+ voiceNum = NULL;
+ return;
+ } else {
+ SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, false);
+ if (voiceNum) {
+ free(voiceNum);
+ voiceNum = NULL;
+ }
+ return;
+ }
+ } else if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL.");
+ /*If result is not TAPI_SIM_ACCESS_SUCCESS, set bMbdnEnable to false*/
+ SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, false);
return;
}
@@ -750,7 +965,8 @@ void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
SMS_SIM_MAILBOX_LIST_S mbList = {0,};
if (list->count <= 0) {
- SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, true);
+ MSG_INFO("Mailbox list is empty");
+ SmsPluginSetting::instance()->setMailboxInfoEvent(handle, NULL, false, true);
return;
}
@@ -768,9 +984,10 @@ void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *u
snprintf(mbList.list[i].num, sizeof(mbList.list[i].num), "%s", list->list[i].num);
mbList.list[i].cc_id = list->list[i].cc_id;
mbList.list[i].ext1_id = list->list[i].ext1_id;
+ mbList.list[i].num_len = strlen(mbList.list[i].num);
}
- SmsPluginSetting::instance()->setMailboxInfoEvent(&mbList, true);
+ SmsPluginSetting::instance()->setMailboxInfoEvent(handle, &mbList, true, true);
}
void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
@@ -785,7 +1002,7 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_
if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
{
MSG_DEBUG("Error. data is NULL.");
- SmsPluginSetting::instance()->setMwiInfoEvent(NULL, false);
+ SmsPluginSetting::instance()->setMwiInfoEvent(handle, NULL, false);
return;
}
@@ -795,16 +1012,18 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_
memcpy(&simMwiInfo, MwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
- SmsPluginSetting::instance()->setMwiInfoEvent(&simMwiInfo, true);
+ SmsPluginSetting::instance()->setMwiInfoEvent(handle, &simMwiInfo, true);
}
void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventGetMsisdnInfo is called.");
- if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
- {
+ bool bRet = false;
+
+ if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
MSG_DEBUG("Error. data is NULL.");
+ SmsPluginSetting::instance()->setResultFromSim(bRet);
return;
}
@@ -812,14 +1031,85 @@ void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *us
for (int i = 0; i < list->count; i++) {
if (list->list[i].num[0] != '\0') {
- if (MsgSettingSetString(MSG_SIM_MSISDN, list->list[i].num) == MSG_SUCCESS)
- MSG_DEBUG("Get MSISDN from SIM : [%s]", list->list[i].num);
- else
- MSG_DEBUG("Getting MSISDN is failed!");
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, simIndex);
+
+ if (MsgSettingSetString(keyName, list->list[i].num) == MSG_SUCCESS) {
+ MSG_SEC_DEBUG("Get MSISDN from SIM : [%s]", list->list[i].num);
+ bRet = true;
+ } else {
+ MSG_DEBUG("Getting MSISDN is failed!");
+ }
break;
}
}
+
+ SmsPluginSetting::instance()->setResultFromSim(bRet);
+}
+
+void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventGetSimServiceTable is called.");
+
+ TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
+ TelSimServiceTable_t *svct = (TelSimServiceTable_t *)data;
+
+ bool bRet = true;
+
+ if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL)
+ {
+ MSG_ERR("Error. data is NULL and access_rt [%d] failed", access_rt);
+ SmsPluginSetting::instance()->setResultFromSim(false);
+ return;
+ }
+
+ msg_error_t err = MSG_SUCCESS;
+
+ char sstKey[128];
+ char moCtrlKey[128];
+
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ memset(sstKey, 0x00, sizeof(sstKey));
+ snprintf(sstKey, sizeof(sstKey), "%s/%d", MSG_SIM_SERVICE_TABLE, simIndex);
+
+ memset(moCtrlKey, 0x00, sizeof(moCtrlKey));
+ snprintf(moCtrlKey, sizeof(moCtrlKey), "%s/%d", MSG_SIM_MO_CONTROL, simIndex);
+
+ if (svct->sim_type == TAPI_SIM_CARD_TYPE_GSM) {
+ if (svct->table.sst.service[TAPI_SIM_SST_SMS] == 1) {
+ err = MsgSettingSetBool(sstKey, true);
+ } else {
+ err = MsgSettingSetBool(sstKey, false);
+ }
+
+ if (svct->table.sst.service[TAPI_SIM_SST_MO_SMS_CTRL_BY_SIM] == 1){
+ err = MsgSettingSetBool(moCtrlKey, true);
+ } else {
+ err = MsgSettingSetBool(moCtrlKey, false);
+ }
+ } else if (svct->sim_type == TAPI_SIM_CARD_TYPE_USIM) {
+ if (svct->table.sst.service[TAPI_SIM_UST_SMS] == 1) {
+ err = MsgSettingSetBool(sstKey, true);
+ } else {
+ err = MsgSettingSetBool(sstKey, false);
+ }
+
+ if (svct->table.sst.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1){
+ err = MsgSettingSetBool(moCtrlKey, true);
+ } else {
+ err = MsgSettingSetBool(moCtrlKey, false);
+ }
+ } else {
+ MSG_DEBUG("Unknown SIM type value");
+ }
+
+ MSG_DEBUG("Setting result = [%d]", err);
+
+ SmsPluginSetting::instance()->setResultFromSim(bRet);
}
void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data)
@@ -834,7 +1124,7 @@ void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *us
try
{
- SmsPluginSatHandler::instance()->refreshSms(data);
+ SmsPluginSatHandler::instance()->refreshSms(handle, data);
}
catch (MsgException& e)
{
@@ -857,7 +1147,7 @@ void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, vo
try
{
- SmsPluginSatHandler::instance()->sendSms(data);
+ SmsPluginSatHandler::instance()->sendSms(handle, data);
}
catch (MsgException& e)
{
@@ -868,11 +1158,11 @@ void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, vo
}
-void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *user_data)
+void TapiEventSatMoSmsCtrl(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
{
MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
+ if (data == NULL)
{
MSG_DEBUG("Error. data is NULL.");
return;
@@ -880,7 +1170,7 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *use
try
{
- SmsPluginSatHandler::instance()->ctrlSms(data);
+ SmsPluginSatHandler::instance()->ctrlSms(handle, data);
}
catch (MsgException& e)
{
@@ -893,6 +1183,10 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *use
void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("Tapi result is [%d]", result);
+ if(result == TAPI_API_SUCCESS)
+ {
+ isMemAvailable = true;
+ }
}
void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
@@ -911,6 +1205,68 @@ void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *use
SmsPluginSimMsg::instance()->setSimEvent(sim_id, true);
}
+
+void TapiEventGetMeImei(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_SEC_DEBUG("TapiEventGetMeImei is called. result [%d]", result);
+
+ if (result != TAPI_API_SUCCESS || data == NULL)
+ {
+ MSG_DEBUG("Error. data is NULL.");
+ SmsPluginSetting::instance()->setResultImei(false, NULL);
+ return;
+ }
+
+ char *tmpImei = (char *)data;
+
+ SmsPluginSetting::instance()->setResultImei(true, tmpImei);
+}
+
+
+void TapiEventSimStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSimStatusChange is called.");
+
+ if (data == NULL) {
+ MSG_DEBUG("Error. data is NULL.");
+ return;
+ }
+
+ int status = *(int *)data;
+
+ MSG_DEBUG("SIM Status [%d]", status);
+
+ if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
+ MSG_INFO("SIM Initialize by sim status change callback");
+ SmsPluginSetting::instance()->setSimChangeStatus(handle, false);
+ }
+}
+
+void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventNetworkStatusChange is called.");
+
+ if (data == NULL) {
+ MSG_DEBUG("Error. data is NULL.");
+ return;
+ }
+
+ TelNetworkServiceType_t *type = (TelNetworkServiceType_t *)data;
+
+ MSG_INFO("network status type [%d], simIndex [%d]", *type, (int)user_data);
+
+ if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
+ SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+ }
+}
+
+void TapiEventSimRefreshed(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSimRefreshed is called.");
+
+ SmsPluginSetting::instance()->SimRefreshCb(handle);
+}
+
/*==================================================================================================
IMPLEMENTATION OF SmsPluginCallback - Member Functions
==================================================================================================*/
@@ -926,8 +1282,7 @@ SmsPluginCallback::SmsPluginCallback()
SmsPluginCallback::~SmsPluginCallback()
{
- if (pInstance != NULL)
- {
+ if (pInstance != NULL) {
delete pInstance;
pInstance = NULL;
}
@@ -945,13 +1300,37 @@ SmsPluginCallback* SmsPluginCallback::instance()
void SmsPluginCallback::registerEvent()
{
- tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL);
- 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);
+ struct tapi_handle *pTapiHandle;
+
+ int count = SmsPluginDSHandler::instance()->getTelHandleCount();
+
+ for (int i = 1; i <= count; ++i) {
+ pTapiHandle = SmsPluginDSHandler::instance()->getTelHandle(i);
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle);
+
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_DEVICE_READY);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_INCOM_MSG);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_CB_INCOM_MSG);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_ETWS_INCOM_MSG);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_SEND_SMS, TapiEventSatSendSms, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_SEND_SMS);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SM_CONTROL_RESULT, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SM_CONTROL_RESULT);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_STATUS, TapiEventSimStatusChange, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_STATUS);
+ if (tel_register_noti_event(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, TapiEventNetworkStatusChange, (void*)simIndex) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_PROP_NETWORK_SERVICE_TYPE);
+ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_REFRESHED, TapiEventSimRefreshed, NULL) != TAPI_API_SUCCESS)
+ MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED);
+// if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL) != TAPI_API_SUCCESS)
+// MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_REFRESH);
+// if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS)
+// MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SMS_CTRL);
+ }
}
diff --git a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
index 24e153b..ecacdf8 100755
--- a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <time.h>
@@ -24,11 +21,12 @@
#include "MsgException.h"
#include "MsgGconfWrapper.h"
#include "MsgUtilFile.h"
+#include "MsgUtilStorage.h"
#include "SmsPluginUDCodec.h"
#include "SmsPluginStorage.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginCbMsgHandler.h"
-
+#include "SmsPluginDSHandler.h"
/*==================================================================================================
IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
@@ -57,12 +55,33 @@ SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::instance()
}
-void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
+void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMsg)
{
MSG_BEGIN();
- SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
+#if 0
+ char temp[1000]= {0x01, 0xa4, 0x1f, 0x51, 0x10, 0x11, 0x02, 0xea, 0x30, 0x30, 0xa8, 0x30, 0xea, 0x30, 0xa2, 0x30, 0xe1, 0x30, 0xfc, 0x30, 0xeb, 0x91, 0x4d, 0x4f, 0xe1, 0x30, 0xc6, 0x30, 0xb9, 0x30, 0xc8, 0x00, 0x0d, 0x00, 0x0a, 0x30, 0x53, 0x30, 0x8c, 0x30, 0x6f, 0x8a, 0x66, 0x9a, 0x13, 0x75, 0x28, 0x30, 0x6e, 0x30, 0xe1, 0x30, 0xc3, 0x30, 0xbb, 0x30, 0xfc, 0x30, 0xb8, 0x30, 0x67, 0x30, 0x59, 0x30, 0x02, 0x00, 0x0d, 0x00, 0x0a, 0xff, 0x08, 0x00, 0x32, 0x00, 0x30, 0x00, 0x31, 0x00, 0x33, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2f, 0x00, 0x32, 0x52, 0xea, 0x30, 0x00, 0x37, 0x00, 0x20, 0x00, 0x31, 0x00, 0x35, 0x00, 0x3a, 0x00, 0x34, 0x00, 0x34, 0xff, 0x09, 0x00, 0x0d, 0x00, 0x0a, 0xff, 0x08, 0x30, 0xa8, 0x30, 0xea, 0x30, 0xa2, 0x5e, 0x02, 0xff, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22};
+ TelSmsEtwsMsg_t *pCbMsg = (TelSmsEtwsMsg_t *)calloc(1, sizeof(TelSmsEtwsMsg_t));
+ pCbMsg->Length = 173;
+ pCbMsg->EtwsMsgType = (TelSmsEtwsMsgType_t)2;
+ memcpy(pCbMsg->szMsgData, temp, pCbMsg->Length);
+
+ SMS_CB_NETWORK_TYPE_T type = pCbMsg->EtwsMsgType;
+ SMS_CBMSG_PAGE_S CbMsgPage = {0};
+
+ switch (type)
+ {
+ case SMS_CB_NETWORK_TYPE_2G_GSM :
+ Decode2gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+ break;
+ case SMS_CB_NETWORK_TYPE_3G_UMTS :
+ Decode3gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+ break;
+
+ }
+#else
+ SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
SMS_CBMSG_PAGE_S CbMsgPage = {0};
switch (type)
@@ -74,12 +93,15 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
case SMS_CB_NETWORK_TYPE_3G_UMTS :
Decode3gCbMsg(pCbMsg, &CbMsgPage);
break;
- }
+ }
+#endif
// Check CB Msg Options
bool bJavaMsg = false;
- if (!checkCbOpt(CbMsgPage, &bJavaMsg))
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ if (!checkCbOpt(CbMsgPage, &bJavaMsg, simIndex))
{
MSG_DEBUG("The CB Msg is not supported by option.");
return;
@@ -91,6 +113,7 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
CbMsgPage.cbMsgType = SMS_CBMSG_TYPE_JAVACBS;
}
+
// Check CB Pages
unsigned char pageCnt = checkCbPage(CbMsgPage);
@@ -98,19 +121,25 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
{
MSG_DEBUG("RECEIVED LAST MSG : %d", pageCnt);
- SMS_CBMSG_S cbMsg = {};
- MSG_MESSAGE_INFO_S msgInfo = {};
+ SMS_CBMSG_S cbMsg = {0,};
+ MSG_MESSAGE_INFO_S msgInfo;
+
+ /** initialize msgInfo */
+ memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
// Make CB Msg Structure
MakeCbMsg(CbMsgPage, &cbMsg);
// Convert to MSG_MESSAGE_INFO_S
- convertCbMsgToMsginfo(&cbMsg, &msgInfo);
+ convertCbMsgToMsginfo(&cbMsg, &msgInfo, simIndex);
// Add CB Msg into DB
msg_error_t err = MSG_SUCCESS;
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS)
{
@@ -126,7 +155,7 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
cbOutMsg.cbTextLen= convertTextToUtf8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), &cbMsg);
memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type));
memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
- err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
+ err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, &msgInfo);
if (err != MSG_SUCCESS)
{
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
@@ -134,32 +163,44 @@ void SmsPluginCbMsgHandler::handleCbMsg(TelSmsCbMsg_t *pCbMsg)
}
else
{
- MSG_DEBUG("addMessage() Error !! [%d]", err);
+ MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
+#if 0
+ // insert message-id to internal CB message table
+ SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
+ err = storageHandler->insertReceivedCBMessage(CbMsgPage);
+ if (err != MSG_SUCCESS)
+ {
+ MSG_DEBUG("insertReceivedCBMessage() Error !! [%d]", err);
+ }
+#endif
// Remove From List
removeFromPageList(CbMsgPage);
+
+
}
MSG_END();
}
-void SmsPluginCbMsgHandler::handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg)
+void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *pEtwsMsg)
{
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
- SMS_ETWS_NETWORK_TYPE_T type = pEtwsMsg->EtwsMsgType;
+ TelSmsEtwsMsgType_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");
+ MSG_DEBUG("The Etws secondary Message");
+ handleCbMsg(handle, (TelSmsCbMsg_t *)pEtwsMsg);
return;
}
DecodeEtwsMsg(pEtwsMsg, &etwsPn);
- //convertEtwsMsgToMsginfo(CbMsgPage, &msgInfo);
+ //convertEtwsMsgToMsginfo(CbMsgPage, &msgInfo, simIndex);
cbOutMsg.type = MSG_ETWS_SMS;
cbOutMsg.receivedTime = etwsPn.recvTime;
@@ -168,7 +209,7 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg)
cbOutMsg.etwsWarningType = etwsPn.warningType;
memcpy (cbOutMsg.etwsWarningSecurityInfo, etwsPn.warningSecurityInfo, sizeof(cbOutMsg.etwsWarningSecurityInfo));
- err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
+ err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, NULL);
if (err != MSG_SUCCESS)
{
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
@@ -180,15 +221,22 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg)
void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
{
- if (pCbMsg->Length > MAX_CBMSG_PAGE_SIZE)
- THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
-
unsigned char cbData[pCbMsg->Length+1];
memset(cbData, 0x00, sizeof(cbData));
memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
cbData[pCbMsg->Length] = '\0';
+ // print cb data
+ MSG_INFO("Received CB length:%d", pCbMsg->Length);
+ char cbDataTmp[(pCbMsg->Length*2)+1];
+ memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
+
+ for (int i = 0; i < pCbMsg->Length; i++) {
+ snprintf(cbDataTmp+(i*2), sizeof(cbDataTmp)-(i*2), "%02X", cbData[i]);
+ }
+ MSG_INFO("[%s]", cbDataTmp);
+
pCbPage->cbMsgType = SMS_CBMSG_TYPE_CBS;
// Serial Number
@@ -199,14 +247,14 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
pCbPage->pageHeader.serialNum.updateNum = cbData[1] & 0x0F;
-MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
+ MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
pCbPage->pageHeader.msgId = (cbData[2] << 8) | cbData[3];
-MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
+ MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
// DCS
- decodeCbMsgDCS(cbData[4], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
+ decodeCbMsgDCS(cbData[4], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
// Page Parameter
pCbPage->pageHeader.totalPages = cbData[5] & 0x0F;
@@ -215,19 +263,21 @@ MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
if (pCbPage->pageHeader.totalPages > MAX_CBMSG_PAGE_NUM)
THROW(MsgException::SMS_PLG_ERROR, "CB Page Count is over MAX[%d]", pCbPage->pageHeader.totalPages);
-MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
+ MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
// Convert Language Type
convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
-MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
-MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
+ MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
+ MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
// Get Receive Time
pCbPage->pageHeader.recvTime = getRecvTime();
// Decode CB Data
int dataLen = pCbMsg->Length - 6;
+ MSG_DEBUG("codingScheme:[%d]", pCbPage->pageHeader.dcs.codingScheme);
+
switch (pCbPage->pageHeader.dcs.codingScheme)
{
case SMS_CHARSET_7BIT :
@@ -243,7 +293,10 @@ MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
if(pCbPage->pageHeader.dcs.iso639Lang[0])
{
unpackLen = unpackLen - 3;
- memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+ if (unpackLen > 0)
+ memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+ else
+ unpackLen = 0;
} else {
memcpy(pCbPage->pageData, &pageData, unpackLen);
}
@@ -258,7 +311,7 @@ MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
case SMS_CHARSET_8BIT :
case SMS_CHARSET_UCS2 :
{
- MSG_DEBUG("UCS2");
+ MSG_DEBUG("UCS2 or 8BIT");
if(pCbPage->pageHeader.dcs.iso639Lang[0])
{
@@ -272,7 +325,7 @@ MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
break;
}
-MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
+ MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
}
@@ -290,6 +343,16 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
memcpy(EtwsData, pEtwsMsg->szMsgData, pEtwsMsg->Length);
EtwsData[pEtwsMsg->Length] = '\0';
+ // print received msg data
+ MSG_INFO("Received Etws length:%d", pEtwsMsg->Length);
+ char EtwsDataTmp[(pEtwsMsg->Length*2)+1];
+ memset(EtwsDataTmp, 0x00, sizeof(EtwsDataTmp));
+
+ for (int i = 0; i < pEtwsMsg->Length; i++) {
+ snprintf(EtwsDataTmp+(i*2), sizeof(EtwsDataTmp)-(i*2), "%02X", EtwsData[i]);
+ }
+ MSG_INFO("[%s]", EtwsDataTmp);
+
// received time
pEtwsPn->recvTime = getRecvTime();
@@ -319,20 +382,27 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage)
{
- if (pCbMsg->Length > (MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM))
- THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbMsg->Length);
-
- char cbData[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
+ unsigned char cbData[(MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM)+1];
memset(cbData, 0x00, sizeof(cbData));
- memcpy(cbData, pCbMsg->szMsgData, sizeof(pCbMsg->szMsgData));
+ memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
cbData[pCbMsg->Length] = '\0';
+ // print cb data
+ MSG_INFO("Received CB length:%d", pCbMsg->Length);
+ char cbDataTmp[(pCbMsg->Length*2)+1];
+ memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
+
+ for (int i = 0; i < pCbMsg->Length; i++) {
+ snprintf(cbDataTmp+(i*2), sizeof(cbDataTmp)-(i*2), "%02X", cbData[i]);
+ }
+ MSG_INFO("[%s]", cbDataTmp);
+
pCbPage->cbMsgType = (SMS_CBMSG_TYPE_T)cbData[0];
pCbPage->pageHeader.msgId = (cbData[1] << 8) | cbData[2];
-MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
+ MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
// Serial Number
pCbPage->pageHeader.serialNum.geoScope = (cbData[3] & 0xC0) >> 6;
@@ -342,53 +412,96 @@ MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
pCbPage->pageHeader.serialNum.updateNum = cbData[4] & 0x0F;
-MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
+ MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
// DCS
- decodeCbMsgDCS(cbData[5], (unsigned char*)cbData[6], &(pCbPage->pageHeader.dcs));
+ decodeCbMsgDCS(cbData[5], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
// Convert Language Type
convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
-MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
+ MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
// Get Receive Time
pCbPage->pageHeader.recvTime = getRecvTime();
+ pCbPage->pageHeader.totalPages = cbData[6];
-#if 0
// Decode CB Data
- int dataLen = pCbMsg->Length - 6;
+ int dataLen = 0;
+ int offset = 0;
switch (pCbPage->pageHeader.dcs.codingScheme)
{
case SMS_CHARSET_7BIT :
{
- dataLen = (dataLen*8) / 7;
+ for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
+ {
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen);
- if (pCbPage->pageLength > MAX_CBMSG_PAGE_SIZE)
- THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", pCbPage->pageLength);
+ dataLen = (dataLen*8) / 7;
- SmsPluginUDCodec udCodec;
- int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
- pCbPage->pageData[unpackLen] = '\0';
+ if (dataLen > MAX_CBMSG_PAGE_SIZE)
+ THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", dataLen);
- pCbPage->pageLength = unpackLen;
+ SmsPluginUDCodec udCodec;
+ int unpackLen = udCodec.unpack7bitChar((const unsigned char *)cbMessage, dataLen, 0, pCbPage->pageData + offset);
+ offset += unpackLen;
+ }
+ pCbPage->pageLength = offset;
}
break;
case SMS_CHARSET_8BIT :
case SMS_CHARSET_UCS2 :
{
- pCbPage->pageLength = dataLen;
+#if 0
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+
+ for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
+ {
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+ offset += dataLen;
+ }
+ dataLen = offset;
+
+ if(pCbPage->pageHeader.dcs.iso639Lang[0])
+ {
+ int tmpDataLen = (dataLen > 2)?(dataLen - 2):0;
+ memcpy(pCbPage->pageData, cbMessage + 2, tmpDataLen);
+ pCbPage->pageLength = tmpDataLen;
+ } else {
+ memcpy(pCbPage->pageData, cbMessage, dataLen);
+ pCbPage->pageLength = dataLen;
+ }
+#else
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
- memcpy(pCbPage->pageData, &cbData[6], pCbPage->pageLength);
- pCbPage->pageData[pCbPage->pageLength] = '\0';
+ for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
+ {
+ if(pCbPage->pageHeader.dcs.iso639Lang[0])
+ {
+ dataLen = cbData[7+(i+1)*82 + i] - 2;
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i + 2], dataLen);
+ offset += dataLen;
+ } else {
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+ offset += dataLen;
+ }
+ }
+ dataLen = offset;
+ memcpy(pCbPage->pageData, cbMessage, dataLen);
+ pCbPage->pageLength = dataLen;
+#endif
}
break;
}
+ pCbPage->pageHeader.totalPages = 1;
-MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
-#endif
+ MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
}
unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields )
@@ -401,10 +514,64 @@ unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S
return serialNum;
}
-bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
+int SmsPluginCbMsgHandler::CMAS_class(unsigned short message_id)
+{
+ int ret = 0;
+
+ switch (message_id)
+ {
+ case 4370 :
+ case 4383 :
+ ret = MSG_CMAS_PRESIDENTIAL;
+ break;
+ case 4371 :
+ case 4372 :
+ case 4384 :
+ case 4385 :
+ ret = MSG_CMAS_EXTREME;
+ break;
+ case 4373 :
+ case 4374 :
+ case 4375 :
+ case 4376 :
+ case 4377 :
+ case 4378 :
+ case 4386 :
+ case 4387 :
+ case 4388 :
+ case 4389 :
+ case 4390 :
+ case 4391 :
+ ret = MSG_CMAS_SEVERE;
+ break;
+ case 4379 :
+ case 4392 :
+ ret = MSG_CMAS_AMBER;
+ break;
+ case 4380 :
+ case 4381 :
+ case 4393 :
+ case 4394 :
+ ret = MSG_CMAS_TEST;
+ break;
+ case 4382 :
+ case 4395 :
+ ret = MSG_CMAS_OPERATOR_DEFINED;
+ break;
+ default :
+ break;
+ }
+
+ return ret;
+}
+
+bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg, msg_sim_slot_id_t simIndex)
{
bool bReceive = false;
- MsgSettingGetBool(CB_RECEIVE, &bReceive);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex);
+ MsgSettingGetBool(keyName, &bReceive);
// Receive CB Msg = FALSE
if (!bReceive)
@@ -413,11 +580,11 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
return false;
}
- char keyName[128];
-
+#if 0
+ char keyname[128];
// check Language
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
+ snprintf(keyName, sizeof(keyname), "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
bool bAllLang = false;
MsgSettingGetBool(keyName, &bAllLang);
@@ -427,7 +594,7 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
MSG_DEBUG("ALL LANGUAGE = FALSE");
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_LANGUAGE, CbPage.pageHeader.langType);
+ snprintf(keyName, sizeof(keyname), "%s/%d", CB_LANGUAGE, CbPage.pageHeader.langType);
bool bLang = false;
@@ -439,28 +606,23 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
return false;
}
}
-
- int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
+#endif
bool bActivate = false;
int MsgId_from = 0, MsgId_to = 0;
+ MSG_CB_CHANNEL_S cbChannelInfo = {0,};
+ msg_error_t err = MSG_SUCCESS;
+ MsgDbHandler *dbHandle = getDbHandle();
- for (int i = 0; i < MsgIdCnt; i++)
- {
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
-
- MsgSettingGetBool(keyName, &bActivate);
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_FROM, i);
-
- MsgId_from = MsgSettingGetInt(keyName);
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_TO, i);
+ err = MsgStoGetCBChannelInfo(dbHandle, &cbChannelInfo, simIndex);
+ if (err != MSG_SUCCESS)
+ MSG_ERR("Error value of MsgStoGetCBChannelInfo [%d]", err);
- MsgId_to = MsgSettingGetInt(keyName);
+ for (int i = 0; i < cbChannelInfo.channelCnt; i++)
+ {
+ bActivate = cbChannelInfo.channelInfo[i].bActivate;
+ MsgId_from = cbChannelInfo.channelInfo[i].from;
+ MsgId_to = cbChannelInfo.channelInfo[i].to;
if (bActivate == true && CbPage.pageHeader.msgId >= MsgId_from && CbPage.pageHeader.msgId <= MsgId_to)
{
@@ -472,14 +634,26 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg)
return false;
}
-
unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
{
unsigned char currPageCnt = 0;
bool bFind = false;
- if (CbPage.pageHeader.totalPages > 1)
+#if 0
+ msg_error_t err = MSG_SUCCESS;
+
+ SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
+ err = storageHandler->isReceivedCBMessage(CbPage);
+ // check existing message with cb internal table;
+ if(err != MSG_ERR_DB_NORECORD)
+ {
+ MSG_DEBUG("already received message: [%d]", CbPage.pageHeader.msgId);
+ return 0;
+ }
+#endif
+
+ if (CbPage.pageHeader.totalPages > 0)
{
for (unsigned int i = 0; i < pageList.size(); i++)
{
@@ -503,11 +677,11 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
return 0;
}
- pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
+ pair<unsigned char, SMS_CBMSG_PAGE_S> newData(CbPage.pageHeader.page, CbPage);
pageList[i].data.insert(newData);
MSG_DEBUG("PAGE DATA : %s", CbPage.pageData);
- MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
+ MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.pageData);
pageList[i].pageCnt++;
pageList[i].totalSize += CbPage.pageLength;
@@ -529,7 +703,7 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S CbPage)
if (bFind == false || CbPage.pageHeader.totalPages == 1)
{
- addToPageLiat(CbPage);
+ addToPageList(CbPage);
return 1;
}
@@ -546,7 +720,7 @@ void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbM
pCbMsg->recvTime = CbPage.pageHeader.recvTime;
cbPageMap::iterator it;
- string tmpStr ("");
+ int offset = 0;
for (unsigned int i = 0; i < pageList.size(); i++)
{
@@ -556,24 +730,29 @@ void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbM
if (pageList[i].msgId == CbPage.pageHeader.msgId)
{
+
for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
{
- tmpStr += it->second;
+ memcpy(pCbMsg->msgData + offset, it->second.pageData, it->second.pageLength);
+ pCbMsg->msgLength += it->second.pageLength;
+ offset = pCbMsg->msgLength;
}
}
}
}
+#if 0
pCbMsg->msgLength = tmpStr.size();
memcpy(pCbMsg->msgData, tmpStr.c_str(), tmpStr.size());
pCbMsg->msgData[tmpStr.size()] = '\0';
MSG_DEBUG("SIZE : [%d] TOTAL MSG : %s", tmpStr.size(), tmpStr.c_str());
+#endif
}
-void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
+void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex)
{
pMsgInfo->msgId = (msg_message_id_t)pCbMsg->msgId;
@@ -582,10 +761,17 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
// Convert Type values
pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
- if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_CBS)
- pMsgInfo->msgType.subType = MSG_CB_SMS;
- else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS)
+ if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_CBS) {
+ int cmas_class = CMAS_class(pCbMsg->msgId);
+
+ if (cmas_class == 0)
+ pMsgInfo->msgType.subType = MSG_CB_SMS;
+ else
+ pMsgInfo->msgType.subType = (MSG_SUB_TYPE_T)cmas_class;
+ }
+ else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS) {
pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
+ }
switch(pCbMsg->classType)
{
@@ -616,11 +802,17 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
// Temporary
pMsgInfo->nAddressCnt = 1;
+ pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
+ pMsgInfo->sim_idx = simIndex;
+
+ // TODO :: MSG ID should be used to get CB message type
+ getDisplayName(pCbMsg->msgId, pMsgInfo->addressList[0].addressVal, simIndex);
+ MSG_SEC_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
- getDisplayName(pCbMsg->msgId, pMsgInfo->addressList[0].addressVal);
- MSG_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
pMsgInfo->msgPort.valid = false;
pMsgInfo->msgPort.dstPort = 0;
@@ -634,6 +826,18 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
+ while (pCbMsg->msgLength > 0) {
+ if (pCbMsg->msgData[pCbMsg->msgLength-1] == ' ' ||
+ pCbMsg->msgData[pCbMsg->msgLength-1] == '\r' ||
+ pCbMsg->msgData[pCbMsg->msgLength-1] == '\n') {
+ pCbMsg->msgLength--;
+ }
+ else {
+ break;
+ }
+ }
+ pCbMsg->msgData[pCbMsg->msgLength] = '\0';
+
MSG_DEBUG("LENGTH %d CB MSG %s", pCbMsg->msgLength, pCbMsg->msgData);
// Convert Data values
@@ -650,7 +854,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
if (MsgCreateFileName(fileName) == false)
THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
- MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
+ MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
@@ -662,11 +866,13 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
memcpy(pMsgInfo->msgText, tmpBuf, pMsgInfo->dataSize);
+ pMsgInfo->dataSize = strlen(pMsgInfo->msgText);
+ MSG_SEC_DEBUG("CB MSG %s", pMsgInfo->msgText);
}
}
-void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
+void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex)
{
pMsgInfo->msgId = (msg_message_id_t)EtwsMsg.pageHeader.msgId;
@@ -691,8 +897,8 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MS
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);
+ getDisplayName(EtwsMsg.pageHeader.msgId, pMsgInfo->addressList[0].addressVal, simIndex);
+ MSG_SEC_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
pMsgInfo->msgPort.valid = false;
pMsgInfo->msgPort.dstPort = 0;
@@ -712,6 +918,8 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
int convertedTextSize = 0;
MSG_LANG_INFO_S langInfo = {0,};
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
+
if (!outBuf || !pCbMsg)
{
MSG_DEBUG ("invalid param.\n");
@@ -724,14 +932,14 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
// Convert Data values
if (pCbMsg->codingScheme == SMS_CHARSET_7BIT)
- convertedTextSize = textCvt.convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
+ convertedTextSize = textCvt->convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
else if (pCbMsg->codingScheme == SMS_CHARSET_UCS2)
- convertedTextSize = textCvt.convertUCS2ToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength);
+ convertedTextSize = textCvt->convertUCS2ToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength);
return convertedTextSize;
}
-void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
+void SmsPluginCbMsgHandler::addToPageList(SMS_CBMSG_PAGE_S CbPage)
{
CB_PAGE_INFO_S tmpInfo;
@@ -744,11 +952,11 @@ void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
tmpInfo.pageCnt = 1;
tmpInfo.totalSize = CbPage.pageLength;
- pair<unsigned char, string> newData(CbPage.pageHeader.page, CbPage.pageData);
+ pair<unsigned char, SMS_CBMSG_PAGE_S> newData(CbPage.pageHeader.page, CbPage);
tmpInfo.data.insert(newData);
MSG_DEBUG("MSG DATA : %s", CbPage.pageData);
- MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.c_str());
+ MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.pageData);
pageList.push_back(tmpInfo);
}
@@ -805,13 +1013,13 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
pDcs->langType = SMS_CBMSG_LANG_ISO639;
-
- if (pMsgData != NULL)
+ MSG_DEBUG("codingScheme: [%d]", pDcs->codingScheme);
+ if (pMsgData[0] && pMsgData[1])
{
pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
- pDcs->iso639Lang[1] = (pMsgData[0] & 0x80) >> 7;
- pDcs->iso639Lang[1] |= (pMsgData[1] & 0x3F) << 1;
- pDcs->iso639Lang[2] = 0x13; /* CR char in GSM 7-bit Alphabet */
+ pDcs->iso639Lang[1] = (pMsgData[0] & 0X80) >> 7;
+ pDcs->iso639Lang[1] |= (pMsgData[1] & 0X3F) << 1;
+ pDcs->iso639Lang[2] = 0x13; /* CR */
}
else
{
@@ -836,29 +1044,49 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
if (dcsData & 0x10)
pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
- pDcs->codingScheme = (SMS_CODING_SCHEME_T)(dcsData & 0x0C);
+ unsigned char tmpScheme = (dcsData & 0x0C) >> 2;
+
+ switch (tmpScheme) {
+ case 0x00:
+ pDcs->codingScheme = SMS_CHARSET_7BIT;
+ break;
+ case 0x01:
+ pDcs->codingScheme = SMS_CHARSET_8BIT;
+ break;
+ case 0x02:
+ pDcs->codingScheme = SMS_CHARSET_UCS2;
+ break;
+ default:
+ MSG_DEBUG("tmpScheme: [%d]", tmpScheme);
+ break;
+ }
}
break;
case 0x09 :
{
pDcs->bUDH = true;
+ pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
+ pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2);
}
break;
- case 0x14 :
+ case 0x0E :
{
pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
}
break;
- case 0x15 :
+ case 0x0F :
{
pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
- pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
+ pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT;
pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
}
break;
+ default:
+ MSG_DEBUG("codingGrp: [0x%x]", codingGrp);
+ break;
}
}
@@ -920,45 +1148,38 @@ unsigned long SmsPluginCbMsgHandler::getRecvTime()
}
-void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName)
+void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName, msg_sim_slot_id_t simIndex)
{
- int MsgIdCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
+ MSG_CB_CHANNEL_S cbChannelInfo = {0,};
+ msg_error_t err = MSG_SUCCESS;
+ MsgDbHandler *dbHandle = getDbHandle();
- char from[128];
- char to[128];
+ err = MsgStoGetCBChannelInfo(dbHandle, &cbChannelInfo, simIndex);
+ MSG_DEBUG("MsgStoGetCBChannelInfo [err = %d]", err);
- for (int i = 0; i < MsgIdCnt; i++)
+ for (int i = 0; i < cbChannelInfo.channelCnt; i++)
{
- memset(from, 0x00, sizeof(from));
- sprintf(from, "%s/%d", CB_CHANNEL_ID_FROM, i);
-
- memset(to, 0x00, sizeof(to));
- sprintf(to, "%s/%d", CB_CHANNEL_ID_TO, i);
-
- if (MsgId >= MsgSettingGetInt(from) && MsgId <= MsgSettingGetInt(to))
+ if (MsgId >= cbChannelInfo.channelInfo[i].from && MsgId <= cbChannelInfo.channelInfo[i].to)
{
MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
#if 0
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
-
+ char strTmp[CB_CHANNEL_NAME_MAX + 1];
memset(strTmp, 0x00, sizeof(strTmp));
- channelName = MsgSettingGetString(keyName);
-
- strncpy(strTmp, channelName, CB_CHANNEL_NAME_MAX);
-
- if (channelName) {
- free(channelName);
- channelName = NULL;
- }
+ strncpy(strTmp, cbChannelInfo.channelInfo[i].name, CB_CHANNEL_NAME_MAX);
if (strlen(strTmp) > 0)
- sprintf(pDisplayName, "[%s]", strTmp);
+ snprintf(pDisplayName, sizeof(strTmp), "[%s]", strTmp);
else
- sprintf(pDisplayName, "[%d]", MsgId);
+ snprintf(pDisplayName, sizeof(unsigned short), "[%d]", MsgId);
#else
- sprintf(pDisplayName, "[%d]", MsgId);
+
+#ifdef MSG_NOTI_INTEGRATION
+ snprintf(pDisplayName, MAX_ADDRESS_VAL_LEN + 1, "CB message");
+#else
+ snprintf(pDisplayName, MAX_ADDRESS_VAL_LEN + 1, "[%d]", MsgId);
+#endif
+
#endif
return;
diff --git a/plugin/sms_plugin/SmsPluginConcatHandler.cpp b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
index 2d10c94..9d05c55 100755
--- a/plugin/sms_plugin/SmsPluginConcatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
@@ -1,31 +1,32 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgCppTypes.h"
#include "MsgUtilFile.h"
+#include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
#include "SmsPluginStorage.h"
#include "SmsPluginTransport.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginWapPushHandler.h"
#include "SmsPluginConcatHandler.h"
+#include "SmsPluginSimMsg.h"
+#include "SmsPluginDSHandler.h"
/*==================================================================================================
IMPLEMENTATION OF SmsPluginConcatHandler - Member Functions
@@ -75,7 +76,7 @@ bool SmsPluginConcatHandler::IsConcatMsg(SMS_USERDATA_S *pUserData)
}
-void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
+void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu)
{
MSG_BEGIN();
@@ -89,6 +90,8 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
SMS_CONCAT_MSG_S msg = {0};
+ msg.simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++) {
if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT) {
msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat8bit.msgRef;
@@ -141,30 +144,80 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
int dataSize = 0;
char* pUserData = NULL;
+ bool simSlotSizeOver = false;
AutoPtr<char> dataBuf(&pUserData);
MSG_MESSAGE_INFO_S msgInfo = {0};
- dataSize = makeConcatUserData(msg.msgRef, &pUserData);
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+ msgInfo.sim_idx = msg.simIndex;
+
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
if (dataSize > 0) {
if (SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(pTpdu->data.deliver.userData)) == true) {
SmsPluginWapPushHandler::instance()->copyDeliverData(&(pTpdu->data.deliver));
- SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize);
+ msgInfo.msgType.mainType = MSG_SMS_TYPE;
+ if (err == MSG_SUCCESS) {
+ SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize, msg.simIndex);
+ }
} else {
convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo);
+ if (msgInfo.msgType.classType == MSG_CLASS_2) {
+ msgInfo.storageId = MSG_STORAGE_SIM;
+ SmsPluginSimMsg::instance()->setSmsTpduTotalSegCount(msg.totalSeg);
+ }
+
+ if (msgInfo.msgPort.valid == true) {
+ if ((msgInfo.msgPort.dstPort >= 0x23F4 && msgInfo.msgPort.dstPort <= 0x23F7) || /** Check unsupported message (Vcalendar WAP push) **/
+ (msgInfo.msgPort.dstPort == 0x1581)) { /** Check unsupported message (ringtone smart message) **/
+ memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "<<Content not supported>>");
+ msgInfo.dataSize = strlen(msgInfo.msgText);
+ msgInfo.msgPort.valid = false;
+ }
+ }
+
if (msgInfo.msgPort.valid == false) {
/** Add Concat Msg into DB */
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+
+ /* check Class2 Normal SMS is longer than SIM slot full size and send DeliveryReport SUCCESS because that Class2 msg cannot be saved on SIM
+ * It MUST be done before calling addClass2Message(thread) beause 10+ page message body ipc file is deleted after SmsPluginTransport::instance()->msgInfoToSubmitData() */
+ if (msgInfo.msgType.subType == MSG_NORMAL_SMS && msgInfo.msgType.classType == MSG_CLASS_2 &&
+ (SmsPluginSimMsg::instance()->checkSimMsgFull(msg.simIndex, segCnt) == true)) {
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_TOTAL_COUNT, msg.simIndex);
+ int totalCnt = MsgSettingGetInt(keyName);
+
+ if (segCnt > totalCnt) {
+ //send DeliveryResport as MSG_SUCCESS and return when total sim storage cnt is less than segment cnt.
+ MSG_INFO("SIM slot total count [%d] is less than total sement count of Class2 message [%d], send delivery report as SUCCESS and save it only PHONE", totalCnt, segCnt);
+
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
+
+ MsgInsertTicker("Message is too large to store as a single message to SIM card.", SMS_MESSAGE_SIZE_OVER_SIM_SLOT_SIZE, false, 0);
+
+ simSlotSizeOver = true;
+ }
+ } else {
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
+ }
}
if (err == MSG_SUCCESS) {
- /** Callback */
- err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+ if (simSlotSizeOver || (msgInfo.msgType.classType != MSG_CLASS_2)) {
+ if (simSlotSizeOver)
+ msgInfo.storageId = MSG_STORAGE_PHONE;
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
+ /** Callback */
+ err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
+ }
}
} else {
MSG_DEBUG("addMessage() Error !! [%d]", err);
@@ -172,11 +225,181 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu)
}
}
- removeFromConcatList(msg.msgRef);
+ removeFromConcatList(msg.msgRef, msg.simIndex);
}
/** Send Deliver Report */
- SmsPluginTransport::instance()->sendDeliverReport(err);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, err);
+
+ MSG_END();
+}
+
+void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList)
+{
+ MSG_BEGIN();
+
+ bool noneConcatTypeHeader = true;
+
+ if (pTpdu->tpduType == SMS_TPDU_DELIVER) {
+ SMS_CONCAT_MSG_S msg = {0};
+
+ msg.simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++) {
+ if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT) {
+ msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat8bit.msgRef;
+ msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat8bit.totalSeg;
+ msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat8bit.seqNum;
+ msg.simId = msgId;
+ memcpy(&(msg.timeStamp.time.absolute), &(pTpdu->data.deliver.timeStamp.time.absolute), sizeof(SMS_TIME_ABS_S));
+ memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
+ memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
+
+
+ /** check noneConcatTypeHeader */
+ noneConcatTypeHeader = false;
+
+ break;
+ } else if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
+ msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat16bit.msgRef;
+ msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat16bit.totalSeg;
+ msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat16bit.seqNum;
+ msg.simId = msgId;
+ memcpy(&(msg.timeStamp.time.absolute), &(pTpdu->data.deliver.timeStamp.time.absolute), sizeof(SMS_TIME_ABS_S));
+ memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
+ memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
+
+ /** check noneConcatTypeHeader */
+ noneConcatTypeHeader = false;
+
+ break;
+ }
+ }
+
+ unsigned char segCnt = checkConcatMsg(&msg, &(pTpdu->data.deliver.userData));
+ MSG_DEBUG("segCnt [%d]", segCnt);
+ MSG_DEBUG("msg.totalSeg [%d]", msg.totalSeg);
+
+ if ((segCnt == msg.totalSeg) || noneConcatTypeHeader) {
+ MSG_DEBUG("RECEIVED LAST CONCAT : %d", segCnt);
+
+ int dataSize = 0;
+ char* pUserData = NULL;
+ AutoPtr<char> dataBuf(&pUserData);
+
+ MSG_MESSAGE_INFO_S msgInfo = {0};
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+ msgInfo.sim_idx = msg.simIndex;
+
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
+
+ if (dataSize > 0) {
+
+ convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo);
+ // set Sim Message ID
+ msgInfo.msgId = msgId;
+
+ // set read status
+ msgInfo.bRead = bRead;
+ // set storage id
+ msgInfo.storageId = MSG_STORAGE_SIM;
+ }
+ for (int index = concatList.size(); index >= 0 ; index--) {
+ if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex) {
+ memcpy(simIdList, concatList[index].simIdList, sizeof(int) * MAX_SIM_SMS_NUM);
+ for (int i = 0; i < 255; ++i)
+ {
+ MSG_DEBUG("sim id [%d]", simIdList[i]);
+ }
+ break;
+ }
+ }
+ removeFromConcatList(msg.msgRef, msg.simIndex);
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+ return;
+ }
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+ } else {
+ SMS_CONCAT_MSG_S msg = {0};
+
+ msg.simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ for (int i = 0; i < pTpdu->data.submit.userData.headerCnt; i++) {
+ if (pTpdu->data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT) {
+ msg.msgRef = (unsigned short)pTpdu->data.submit.userData.header[i].udh.concat8bit.msgRef;
+ msg.totalSeg = pTpdu->data.submit.userData.header[i].udh.concat8bit.totalSeg;
+ msg.seqNum = pTpdu->data.submit.userData.header[i].udh.concat8bit.seqNum;
+ msg.simId = msgId;
+ memcpy(&(msg.originAddress), &(pTpdu->data.submit.destAddress), sizeof(SMS_ADDRESS_S));
+ memcpy(&(msg.dcs), &(pTpdu->data.submit.dcs), sizeof(SMS_DCS_S));
+
+
+ /** check noneConcatTypeHeader */
+ noneConcatTypeHeader = false;
+
+ break;
+ } else if (pTpdu->data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
+ msg.msgRef = (unsigned short)pTpdu->data.submit.userData.header[i].udh.concat16bit.msgRef;
+ msg.totalSeg = pTpdu->data.submit.userData.header[i].udh.concat16bit.totalSeg;
+ msg.seqNum = pTpdu->data.submit.userData.header[i].udh.concat16bit.seqNum;
+ msg.simId = msgId;
+ memcpy(&(msg.originAddress), &(pTpdu->data.submit.destAddress), sizeof(SMS_ADDRESS_S));
+ memcpy(&(msg.dcs), &(pTpdu->data.submit.dcs), sizeof(SMS_DCS_S));
+
+ /** check noneConcatTypeHeader */
+ noneConcatTypeHeader = false;
+
+ break;
+ }
+ }
+
+ unsigned char segCnt = checkConcatMsg(&msg, &(pTpdu->data.submit.userData));
+
+ MSG_DEBUG("segCnt [%d]", segCnt);
+ MSG_DEBUG("msg.totalSeg [%d]", msg.totalSeg);
+
+ if ((segCnt == msg.totalSeg) || noneConcatTypeHeader) {
+ MSG_DEBUG("RECEIVED LAST CONCAT : %d", segCnt);
+
+ int dataSize = 0;
+ char* pUserData = NULL;
+ AutoPtr<char> dataBuf(&pUserData);
+
+ MSG_MESSAGE_INFO_S msgInfo = {0};
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+ msgInfo.sim_idx = msg.simIndex;
+
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
+
+ if (dataSize > 0) {
+ convertConcatToMsginfo(&(pTpdu->data.submit), pUserData, dataSize, &msgInfo);
+
+ // set Sim Message ID
+ msgInfo.msgId = msgId;
+ // set read status
+ msgInfo.bRead = bRead;
+
+ msgInfo.msgType.subType = MSG_CONCAT_SIM_SMS;
+
+ // set storage id
+ msgInfo.storageId = MSG_STORAGE_SIM;
+ }
+ for (int index = concatList.size(); index >= 0 ; index--) {
+ if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex) {
+ memcpy(simIdList, concatList[index].simIdList, sizeof(int) * MAX_SIM_SMS_NUM);
+ break;
+ }
+ }
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+ removeFromConcatList(msg.msgRef, msg.simIndex);
+ return;
+ }
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+ }
MSG_END();
}
@@ -273,7 +496,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
- MSG_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
MSG_DEBUG("msgInfo.bRead : %d", msgInfo.bRead);
@@ -286,9 +509,9 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
MSG_DEBUG("msgInfo.dataSize : %d", msgInfo.dataSize);
if (msgInfo.bTextSms == true)
- MSG_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
+ MSG_SEC_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
else
- MSG_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
+ MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
MSG_DEBUG("###############################################################");
@@ -361,7 +584,7 @@ void SmsPluginConcatHandler::handleBrokenMsg()
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
- MSG_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
MSG_DEBUG("msgInfo.bRead : %d", msgInfo.bRead);
@@ -373,9 +596,9 @@ void SmsPluginConcatHandler::handleBrokenMsg()
MSG_DEBUG("msgInfo.displayTime : %s", ctime(&msgInfo.displayTime));
MSG_DEBUG("msgInfo.dataSize : %d", msgInfo.dataSize);
if (msgInfo.bTextSms == true)
- MSG_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
+ MSG_SEC_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
else
- MSG_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
+ MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
MSG_DEBUG("###############################################################");
//add msgInfo to msg list
@@ -401,12 +624,11 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
bool bFind = false;
for (unsigned int i = 0; i < concatList.size(); i++) {
- if (concatList[i].msgRef == pConcatMsg->msgRef) {
+ if (concatList[i].msgRef == pConcatMsg->msgRef && concatList[i].simIndex == pConcatMsg->simIndex) {
if (concatList[i].data.count(pConcatMsg->seqNum) != 0) {
MSG_DEBUG("The Sequence Number already exists [%d]", pConcatMsg->seqNum);
return 0;
}
-
CONCAT_DATA_S concatData = {0};
memcpy(concatData.data, pUserData->data, pUserData->length);
@@ -414,13 +636,13 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
pair<unsigned char, CONCAT_DATA_S> newData(pConcatMsg->seqNum, concatData);
concatList[i].data.insert(newData);
+ concatList[i].simIdList[concatList[i].segCnt] = pConcatMsg->simId + 1;
MSG_DEBUG("MSG DATA : %s", pUserData->data);
MSG_DEBUG("PAIR DATA [%d] : %s", newData.first, newData.second.data);
concatList[i].segCnt++;
concatList[i].totalSize += pUserData->length;
-
currSegCnt = concatList[i].segCnt;
bFind = true;
@@ -432,16 +654,20 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
/** New Concat Msg */
if (bFind == false) {
SMS_CONCAT_INFO_S tmpInfo;
-
+ memset(tmpInfo.simIdList, 0x00, sizeof(int) * MAX_SIM_SMS_NUM);
tmpInfo.msgRef = pConcatMsg->msgRef;
tmpInfo.totalSeg = pConcatMsg->totalSeg;
tmpInfo.segCnt = 1;
+ tmpInfo.simIdList[0] = pConcatMsg->simId + 1;
+ tmpInfo.simIndex = pConcatMsg->simIndex;
+ tmpInfo.bRead = false;
memcpy(&(tmpInfo.timeStamp.time.absolute), &(pConcatMsg->timeStamp.time.absolute), sizeof(SMS_TIME_ABS_S));
memcpy(&(tmpInfo.originAddress), &(pConcatMsg->originAddress), sizeof(SMS_ADDRESS_S));
memcpy(&(tmpInfo.dcs), &(pConcatMsg->dcs), sizeof(SMS_DCS_S));
tmpInfo.totalSize = pUserData->length;
+ tmpInfo.display_time = time(NULL);
CONCAT_DATA_S concatData = {0};
@@ -463,14 +689,14 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
}
-int SmsPluginConcatHandler::makeConcatUserData(unsigned short MsgRef, char **ppTotalData)
+int SmsPluginConcatHandler::makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData)
{
concatDataMap::iterator it;
int totalSize = 0, offset = 0;
for (unsigned int i = 0; i < concatList.size(); i++) {
- if (concatList[i].msgRef == MsgRef) {
+ if (concatList[i].msgRef == MsgRef && concatList[i].simIndex == simIndex) {
totalSize = concatList[i].totalSize;
if (totalSize <= 0) {
@@ -497,7 +723,7 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
{
/** Convert Type values */
pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
- pMsgInfo->msgType.subType = MSG_NORMAL_SMS;
+ pMsgInfo->msgType.subType = SmsPluginEventHandler::instance()->convertMsgSubType(pTpdu->pid);
/** set folder id */
pMsgInfo->folderId = MSG_INBOX_ID;
@@ -590,6 +816,9 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
pMsgInfo->displayTime = rawtime;
/** Convert Address values */
+ pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
pMsgInfo->nAddressCnt = 1;
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(pMsgInfo->addressList[0].addressVal, pTpdu->originAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -618,6 +847,7 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
memset(tmpBuf, 0x00, sizeof(tmpBuf));
/** Convert Data values */
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
MSG_LANG_INFO_S langInfo = {0,};
@@ -625,14 +855,14 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
langInfo.bLockingShift = false;
pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
- pMsgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
+ pMsgInfo->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
pMsgInfo->encodeType = MSG_ENCODE_8BIT;
memcpy(tmpBuf, pUserData, DataSize);
pMsgInfo->dataSize = DataSize;
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
pMsgInfo->encodeType = MSG_ENCODE_UCS2;
- pMsgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
+ pMsgInfo->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
}
MSG_DEBUG("Data Size [%d]", pMsgInfo->dataSize);
@@ -659,7 +889,7 @@ printf("\n");
if (MsgCreateFileName(fileName) == false)
THROW(MsgException::FILE_ERROR, "######## MsgCreateFileName Fail !!! #######");
- MSG_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
+ MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
THROW(MsgException::FILE_ERROR, "######## MsgWriteIpcFile Fail !!! #######");
@@ -673,6 +903,123 @@ printf("\n");
}
+void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo)
+{
+ /** Convert Type values */
+ pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
+ pMsgInfo->msgType.subType = SmsPluginEventHandler::instance()->convertMsgSubType(pTpdu->pid);
+
+ /** set folder id */
+ pMsgInfo->folderId = MSG_INBOX_ID;
+
+ /** set storage id */
+ pMsgInfo->storageId = MSG_STORAGE_PHONE;
+
+ switch(pTpdu->dcs.msgClass)
+ {
+ case SMS_MSG_CLASS_0:
+ pMsgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ pMsgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ pMsgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ pMsgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
+ }
+
+ pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
+ pMsgInfo->bRead = false;
+ pMsgInfo->bProtected = false;
+ pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
+ pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
+
+
+ time_t rawtime = time(NULL);
+ pMsgInfo->displayTime = rawtime;
+
+ /** Convert Address values */
+ pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+ pMsgInfo->nAddressCnt = 1;
+ pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
+ strncpy(pMsgInfo->addressList[0].addressVal, pTpdu->destAddress.address, MAX_ADDRESS_VAL_LEN);
+
+ pMsgInfo->msgPort.valid = false;
+ pMsgInfo->msgPort.dstPort = 0;
+ pMsgInfo->msgPort.srcPort = 0;
+
+ for (int i = 0; i < pTpdu->userData.headerCnt; i++) {
+ /** Convert UDH values - Port Number */
+ if (pTpdu->userData.header[i].udhType == SMS_UDH_APP_PORT_8BIT) {
+ pMsgInfo->msgPort.valid = true;
+ pMsgInfo->msgPort.dstPort = pTpdu->userData.header[i].udh.appPort8bit.destPort;
+ pMsgInfo->msgPort.srcPort = pTpdu->userData.header[i].udh.appPort8bit.originPort;
+ } else if (pTpdu->userData.header[i].udhType == SMS_UDH_APP_PORT_16BIT) {
+ pMsgInfo->msgPort.valid = true;
+ pMsgInfo->msgPort.dstPort = pTpdu->userData.header[i].udh.appPort16bit.destPort;
+ pMsgInfo->msgPort.srcPort = pTpdu->userData.header[i].udh.appPort16bit.originPort;
+ }
+ }
+
+ //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
+ int bufSize = (DataSize*4) + 1; // For UTF8
+
+ char tmpBuf[bufSize];
+ memset(tmpBuf, 0x00, sizeof(tmpBuf));
+
+ /** Convert Data values */
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
+ if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
+ MSG_LANG_INFO_S langInfo = {0,};
+
+ langInfo.bSingleShift = false;
+ langInfo.bLockingShift = false;
+
+ pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
+ pMsgInfo->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
+ } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
+ pMsgInfo->encodeType = MSG_ENCODE_8BIT;
+ memcpy(tmpBuf, pUserData, DataSize);
+ pMsgInfo->dataSize = DataSize;
+ } else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
+ pMsgInfo->encodeType = MSG_ENCODE_UCS2;
+ pMsgInfo->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
+ }
+
+ MSG_DEBUG("Data Size [%d]", pMsgInfo->dataSize);
+ MSG_DEBUG("Data [%s]", tmpBuf);
+
+ if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) {
+ pMsgInfo->bTextSms = false;
+
+ /** Save Message Data into File */
+ char fileName[MSG_FILENAME_LEN_MAX+1];
+ memset(fileName, 0x00, sizeof(fileName));
+
+ if (MsgCreateFileName(fileName) == false)
+ THROW(MsgException::FILE_ERROR, "######## MsgCreateFileName Fail !!! #######");
+
+ MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]\n", pMsgInfo->dataSize, fileName);
+ if (MsgWriteIpcFile(fileName, tmpBuf, pMsgInfo->dataSize) == false)
+ THROW(MsgException::FILE_ERROR, "######## MsgWriteIpcFile Fail !!! #######");
+
+ strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
+ } else {
+ pMsgInfo->bTextSms = true;
+
+ memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
+ memcpy(pMsgInfo->msgText, tmpBuf, pMsgInfo->dataSize);
+ }
+}
+
#ifdef CONCAT_SIM_MSG_OPERATION
void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo)
{
@@ -837,15 +1184,15 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
memset(pMsgInfo->msgData, 0x00, sizeof(pMsgInfo->msgData));
strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
- MSG_DEBUG("Save Message Data into file : size[%d] name[%s]", pMsgInfo->dataSize, fileName);
+ MSG_SEC_DEBUG("Save Message Data into file : size[%d] name[%s]", pMsgInfo->dataSize, fileName);
}
#endif
-void SmsPluginConcatHandler::removeFromConcatList(unsigned short MsgRef)
+void SmsPluginConcatHandler::removeFromConcatList(unsigned short MsgRef, int simIndex)
{
- for (int index = concatList.size(); index >= 0 ; index--) {
- if (concatList[index].msgRef == MsgRef) {
+ for (int index = concatList.size()-1; index >= 0 ; index--) {
+ if (concatList[index].msgRef == MsgRef && concatList[index].simIndex == simIndex) {
MSG_DEBUG("remove concatlist of the index [%d]", index);
concatList.erase(concatList.begin()+index);
break;
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index 9486d7c..46956d8 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include<time.h>
@@ -24,13 +21,18 @@
#include "MsgDebug.h"
#include "MsgUtilFile.h"
+#include "MsgCppTypes.h"
+#include "MsgContact.h"
#include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
+#include "MsgDevicedWrapper.h"
#include "SmsPluginTransport.h"
#include "SmsPluginSimMsg.h"
#include "SmsPluginStorage.h"
#include "SmsPluginSetting.h"
#include "SmsPluginConcatHandler.h"
#include "SmsPluginEventHandler.h"
+#include "SmsPluginDSHandler.h"
/*==================================================================================================
@@ -46,6 +48,9 @@ SmsPluginEventHandler::SmsPluginEventHandler()
pSimCnt = NULL;
devStatus = false;
+ bUdhMwiMethod = false;
+ udhMwiCnt = 0;
+ devHandle = NULL;
}
@@ -74,13 +79,24 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
{
MSG_DEBUG("NetStatus[%d]", NetStatus);
- SmsPluginTransport::instance()->setNetStatus(NetStatus);
-
if (sentInfo.bLast == true || NetStatus != MSG_NETWORK_SEND_SUCCESS) {
/** Update Msg Status */
- if (sentInfo.reqInfo.msgInfo.msgPort.valid == false){
- SmsPluginStorage::instance()->updateSentMsg(&(sentInfo.reqInfo.msgInfo), NetStatus);
+ if (sentInfo.reqInfo.msgInfo.msgPort.valid == false) {
+// SmsPluginStorage::instance()->updateSentMsg(&(sentInfo.reqInfo.msgInfo), NetStatus);
+
sentInfo.reqInfo.msgInfo.networkStatus = NetStatus;
+
+ if (NetStatus == MSG_NETWORK_SEND_SUCCESS) {
+ //contacts-service is not used for gear
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ MSG_DEBUG("Add phone log");
+ MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo));
+#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; // It should be set after adding phone log.
+ } else {
+ sentInfo.reqInfo.msgInfo.bRead = false;
+ }
+
callbackStorageChange(MSG_STORAGE_CHANGE_UPDATE, &(sentInfo.reqInfo.msgInfo));
}
@@ -88,7 +104,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bKeepCopy [%d]", sentInfo.reqInfo.sendOptInfo.bKeepCopy);
/** Check sending options */
if (sentInfo.reqInfo.sendOptInfo.bSetting && !sentInfo.reqInfo.sendOptInfo.bKeepCopy && NetStatus == MSG_NETWORK_SEND_SUCCESS) {
- SmsPluginStorage::instance()->deleteSmsMessage(sentInfo.reqInfo.msgInfo.msgId);
+// SmsPluginStorage::instance()->deleteSmsMessage(sentInfo.reqInfo.msgInfo.msgId);
callbackStorageChange(MSG_STORAGE_CHANGE_DELETE, &(sentInfo.reqInfo.msgInfo));
}
@@ -106,50 +122,131 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
}
-void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
+void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TPDU_S *pTpdu)
{
+
/** Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
/** initialize msgInfo */
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
- /** check unsupported message */
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+
+
if (pTpdu->tpduType == SMS_TPDU_DELIVER) {
+ /** check unsupported message */
if (pTpdu->data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && pTpdu->data.deliver.pid == 0x11) {
MSG_DEBUG("Unsupported message!!");
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
return;
}
}
- /** check discard & indicator inactive message **/
- if (pTpdu->data.deliver.dcs.bMWI == true &&
- pTpdu->data.deliver.dcs.bIndActive == false &&
- pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD) {
- MSG_DEBUG("Discard and no-indication message!!");
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
- return;
- }
+ bUdhMwiMethod = false;
+ udhMwiCnt = 0;
+
+ if(pTpdu->data.deliver.dcs.msgClass == SMS_MSG_CLASS_2)
+ msgInfo.storageId = MSG_STORAGE_UNKNOWN;
+ else
+ msgInfo.storageId = MSG_STORAGE_PHONE;
+
+ msgInfo.sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
/** convert to msgInfo */
convertTpduToMsginfo(pTpdu, &msgInfo);
+ if (msgInfo.msgPort.valid == true) {
+ if ((msgInfo.msgPort.dstPort >= 0x23F4 && msgInfo.msgPort.dstPort <= 0x23F7) || /** Check unsupported message (Vcard WAP push) **/
+ (msgInfo.msgPort.dstPort == 0x1581)) { /** Check unsupported message (ringtone smart message) **/
+ memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "<Unsupported message>");
+ msgInfo.dataSize = strlen(msgInfo.msgText);
+ msgInfo.msgPort.valid = false;
+ }
+ }
+
+ if (bUdhMwiMethod == false) {
+ /** check MWI and set info to SIM for DCS & Address method */
+ if (pTpdu->tpduType == SMS_TPDU_DELIVER && pTpdu->data.deliver.dcs.bMWI == true) {
+ MSG_DEBUG("MWI message - DCS method");
+
+ if (pTpdu->data.deliver.dcs.bIndActive == false) {
+ SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 0);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
+ return;
+ } else {
+ SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 1);
+
+ /* For address method */
+ if (pTpdu->data.deliver.pid == 0x20 && pTpdu->data.deliver.originAddress.ton == SMS_TON_ALPHANUMERIC) {
+ MSG_DEBUG("MWI message - Address method");
+ char *voiceNumber = NULL;
+ char *voiceAlphaId = NULL;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, msgInfo.sim_idx);
+ voiceNumber = MsgSettingGetString(keyName);
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, msgInfo.sim_idx);
+ voiceAlphaId = MsgSettingGetString(keyName);
+
+ memset(msgInfo.addressList[0].addressVal, 0x00, sizeof(msgInfo.addressList[0].addressVal));
+ memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
+
+ if (voiceNumber) {
+ snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), "%s", voiceNumber);
+ free(voiceNumber);
+ voiceNumber = NULL;
+ }
+
+ if (voiceAlphaId) {
+ snprintf(msgInfo.addressList[0].displayName, sizeof(msgInfo.addressList[0].displayName), "%s", voiceAlphaId);
+ free(voiceAlphaId);
+ voiceAlphaId = NULL;
+ }
+
+ memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "New voice message");
+
+ }
+ }
+
+ if (pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD)
+ msgInfo.bStore = false;
+ }
+ } else {
+ MSG_DEBUG("MWI message - UDH method");
+ if (udhMwiCnt <= 0) {
+ MSG_DEBUG("MWI count is 0");
+ SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 0);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
+ return;
+ }
+ }
+
/** Short Message Type 0 - Just Send Deliver Report */
if (msgInfo.msgType.subType == MSG_TYPE0_SMS) {
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
return;
}
/** Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
- MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
- MSG_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ if (msgInfo.nAddressCnt > 0) {
+ MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].addressVal : %s", msgInfo.addressList[0].addressVal);
+ MSG_SEC_DEBUG("msgInfo.addressList[0].displayName : %s", msgInfo.addressList[0].displayName);
+ }
MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
MSG_DEBUG("msgInfo.bRead : %d", msgInfo.bRead);
MSG_DEBUG("msgInfo.bTextSms : %d", msgInfo.bTextSms);
+ MSG_DEBUG("msgInfo.bStore : %d", msgInfo.bStore);
MSG_DEBUG("msgInfo.direction : %d", msgInfo.direction);
MSG_DEBUG("msgInfo.msgType.mainType : %d", msgInfo.msgType.mainType);
MSG_DEBUG("msgInfo.msgType.subType : %d", msgInfo.msgType.subType);
@@ -158,11 +255,12 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
MSG_DEBUG("msgInfo.msgPort.valid : %d", msgInfo.msgPort.valid);
MSG_DEBUG("msgInfo.encodeType : %d", msgInfo.encodeType);
MSG_DEBUG("msgInfo.dataSize : %d", msgInfo.dataSize);
+ MSG_DEBUG("msgInfo.sim_idx : %d", msgInfo.sim_idx);
if (msgInfo.bTextSms == true) {
- MSG_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
+ MSG_SEC_DEBUG("msgInfo.msgText : %s", msgInfo.msgText);
} else {
- MSG_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
+ MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
}
MSG_DEBUG("###############################################################");
@@ -171,25 +269,42 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS) {
/** Status Report Message */
- err = listener.pfMsgIncomingCb(&msgInfo);
+ err = SmsPluginStorage::instance()->updateMsgDeliverStatus(&msgInfo, pTpdu->data.statusRep.msgRef);
+
+ if (err == MSG_SUCCESS)
+ err = listener.pfMsgIncomingCb(&msgInfo);
+ else
+ MSG_DEBUG("updateMsgDeliverStatus is failed [%d]", err);
/** Handling of Fail Case ?? */
- SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
} else { /** SMS Deliver */
/** Class 2 Msg */
if (msgInfo.msgType.classType == MSG_CLASS_2) {
if (msgInfo.bTextSms == false) { /** Concat Msg cannot be saved in SIM */
msgInfo.msgType.classType = MSG_CLASS_NONE;
msgInfo.storageId = MSG_STORAGE_PHONE;
+ } else {
+ /** set total segment of Class2 message as 1 */
+ SmsPluginSimMsg::instance()->setSmsTpduTotalSegCount(1);
}
}
+ /** Add message to DB */
if (msgInfo.msgPort.valid == false) {
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
}
/** Callback to MSG FW */
- if (msgInfo.msgType.classType != MSG_CLASS_2) {
+ if (msgInfo.msgType.classType == MSG_CLASS_2) {
+ if (((msgInfo.msgType.subType >= MSG_MWI_VOICE_SMS) && (msgInfo.msgType.subType <= MSG_MWI_OTHER_SMS)) &&
+ (msgInfo.bStore == false)) {
+ if (listener.pfMsgIncomingCb(&msgInfo) != MSG_SUCCESS)
+ MSG_DEBUG("listener.pfMsgIncomingCb is failed!");
+
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
+ }
+ } else {
if (err == MSG_SUCCESS) {
MSG_DEBUG("callback to msg fw");
err = listener.pfMsgIncomingCb(&msgInfo);
@@ -203,14 +318,17 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
/** Send Deliver Report */
if (msgInfo.msgType.classType == MSG_CLASS_0)
- SmsPluginTransport::instance()->sendClass0DeliverReport(err);
+ SmsPluginTransport::instance()->sendClass0DeliverReport(handle, err);
else
- SmsPluginTransport::instance()->sendDeliverReport(err);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, err);
}
// Tizen Validation System
char *msisdn = NULL;
- msisdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, msgInfo.sim_idx);
+ msisdn = MsgSettingGetString(keyName);
MSG_SMS_VLD_INFO("%d, SMS Receive, %s->%s, %s", msgInfo.msgId, \
msgInfo.addressList[0].addressVal, \
@@ -218,6 +336,11 @@ void SmsPluginEventHandler::handleMsgIncoming(SMS_TPDU_S *pTpdu)
(err == MSG_SUCCESS)?"Success":"Fail");
MSG_SMS_VLD_TXT("%d, [%s]", msgInfo.msgId, msgInfo.msgText);
+
+ if (msisdn) {
+ free(msisdn);
+ msisdn = NULL;
+ }
}
}
@@ -228,7 +351,7 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
/** set PUSH data */
- memcpy(&pushData.pushHeader, pPushHeader, strlen(pPushHeader));
+ memcpy(pushData.pushHeader, pPushHeader, strlen(pPushHeader));
pushData.pushBodyLen = pushBodyLen;
memcpy(pushData.pushBody, pPushBody, pushBodyLen);
@@ -241,7 +364,13 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
}
-void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen)
+void SmsPluginEventHandler::handleResendMessage(void)
+{
+ listener.pfResendMessageCb();
+}
+
+
+void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen,int simIndex)
{
MSG_SYNCML_MESSAGE_DATA_S syncMLData;
@@ -250,6 +379,8 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms
/** set syncML data */
syncMLData.syncmlType = msgType;
+ syncMLData.simIndex = simIndex;
+
syncMLData.pushBodyLen = PushBodyLen;
memcpy(syncMLData.pushBody, pPushBody, PushBodyLen);
@@ -268,7 +399,7 @@ void SmsPluginEventHandler::handleLBSMsgIncoming(char* pPushHeader, char* pPushB
memset(&lBSData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S));
/** set LBA data */
- memcpy(&lBSData.pushHeader, pPushHeader, strlen(pPushHeader));
+ memcpy(lBSData.pushHeader, pPushHeader, strlen(pPushHeader));
lBSData.pushBodyLen = pushBodyLen;
memcpy(lBSData.pushBody, pPushBody, pushBodyLen);
@@ -277,7 +408,6 @@ void SmsPluginEventHandler::handleLBSMsgIncoming(char* pPushHeader, char* pPushB
listener.pfLBSMsgIncomingCb(&lBSData);
}
-
msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
@@ -292,14 +422,14 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
return err;
}
-msg_error_t SmsPluginEventHandler::callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg)
+msg_error_t SmsPluginEventHandler::callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
/** Callback to MSG FW */
- err = listener.pfCBMsgIncomingCb(pCbMsg);
+ err = listener.pfCBMsgIncomingCb(pCbMsg, pMsgInfo);
MSG_END();
@@ -325,7 +455,6 @@ msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type
void SmsPluginEventHandler::convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo)
{
- memset(msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
switch(pTpdu->tpduType)
{
@@ -351,7 +480,7 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
msgInfo->msgType.subType = convertMsgSubType(pTpdu->pid);
/** set folder id (temporary) */
- msgInfo->folderId = MSG_OUTBOX_ID;
+ msgInfo->folderId = MSG_SENTBOX_ID;
switch(pTpdu->dcs.msgClass)
{
@@ -369,13 +498,14 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
break;
default:
msgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
msgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
msgInfo->bRead = false;
msgInfo->bProtected = false;
msgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
- msgInfo->direction = MSG_DIRECTION_TYPE_MT;
+ msgInfo->direction = MSG_DIRECTION_TYPE_MO;
msgInfo->bTextSms = true;
memset(msgInfo->subject, 0x00, MAX_SUBJECT_LEN+1);
@@ -389,6 +519,10 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
/** Convert Address values */
msgInfo->nAddressCnt = 1;
+
+ msgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(msgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
msgInfo->addressList[addressListCnt].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(msgInfo->addressList[addressListCnt].addressVal, pTpdu->destAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -400,15 +534,16 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
}
/** Convert Data values */
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
- msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+ msgInfo->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
- msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
}
}
@@ -424,7 +559,65 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
/** set folder id (temporary) */
msgInfo->folderId = MSG_INBOX_ID;
- msgInfo->storageId = MSG_STORAGE_PHONE;
+ time_t rawtime = 0;
+ if(msgInfo->storageId == MSG_STORAGE_SIM)
+ {
+ /*** Comment below lines to save local UTC time..... (it could be used later.)
+ ***/
+ if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) {
+
+ MSG_DEBUG("year : %d", pTpdu->timeStamp.time.absolute.year);
+ MSG_DEBUG("month : %d", pTpdu->timeStamp.time.absolute.month);
+ MSG_DEBUG("day : %d", pTpdu->timeStamp.time.absolute.day);
+ MSG_DEBUG("hour : %d", pTpdu->timeStamp.time.absolute.hour);
+ MSG_DEBUG("minute : %d", pTpdu->timeStamp.time.absolute.minute);
+ MSG_DEBUG("second : %d", pTpdu->timeStamp.time.absolute.second);
+ MSG_DEBUG("timezone : %d", pTpdu->timeStamp.time.absolute.timeZone);
+
+ char displayTime[32];
+ struct tm * timeTM;
+
+ struct tm timeinfo;
+ memset(&timeinfo, 0x00, sizeof(tm));
+
+ timeinfo.tm_year = (pTpdu->timeStamp.time.absolute.year + 100);
+ timeinfo.tm_mon = (pTpdu->timeStamp.time.absolute.month - 1);
+ timeinfo.tm_mday = pTpdu->timeStamp.time.absolute.day;
+ timeinfo.tm_hour = pTpdu->timeStamp.time.absolute.hour;
+ timeinfo.tm_min = pTpdu->timeStamp.time.absolute.minute;
+ timeinfo.tm_sec = pTpdu->timeStamp.time.absolute.second;
+ timeinfo.tm_isdst = 0;
+
+ rawtime = mktime(&timeinfo);
+
+ MSG_DEBUG("tzname[0] [%s]", tzname[0]);
+ MSG_DEBUG("tzname[1] [%s]", tzname[1]);
+ MSG_DEBUG("timezone [%d]", timezone);
+ MSG_DEBUG("daylight [%d]", daylight);
+
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeinfo);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+
+ rawtime -= (pTpdu->timeStamp.time.absolute.timeZone * (3600/4));
+
+ timeTM = localtime(&rawtime);
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+
+ rawtime -= timezone;
+
+ timeTM = localtime(&rawtime);
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+ }
+ }
+ else
+ rawtime = time(NULL);
+
+ msgInfo->displayTime = rawtime;
switch(pTpdu->dcs.msgClass)
{
@@ -447,7 +640,16 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
}
if (pTpdu->dcs.bMWI) {
- msgInfo->msgType.subType = (pTpdu->dcs.indType + MSG_MWI_VOICE_SMS);
+ if (pTpdu->dcs.indType == SMS_VOICE_INDICATOR)
+ msgInfo->msgType.subType = MSG_MWI_VOICE_SMS;
+ else if (pTpdu->dcs.indType == SMS_VOICE2_INDICATOR)
+ msgInfo->msgType.subType = MSG_MWI_VOICE2_SMS;
+ else if (pTpdu->dcs.indType == SMS_FAX_INDICATOR)
+ msgInfo->msgType.subType = MSG_MWI_FAX_SMS;
+ else if (pTpdu->dcs.indType == SMS_EMAIL_INDICATOR)
+ msgInfo->msgType.subType = MSG_MWI_EMAIL_SMS;
+ else if (pTpdu->dcs.indType == SMS_OTHER_INDICATOR)
+ msgInfo->msgType.subType = MSG_MWI_OTHER_SMS;
}
msgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -459,66 +661,12 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
memset(msgInfo->subject, 0x00, MAX_SUBJECT_LEN+1);
- time_t rawtime = time(NULL);
-
-/*** Comment below lines to save local UTC time..... (it could be used later.)
-
- if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) {
-
- MSG_DEBUG("year : %d", pTpdu->timeStamp.time.absolute.year);
- MSG_DEBUG("month : %d", pTpdu->timeStamp.time.absolute.month);
- MSG_DEBUG("day : %d", pTpdu->timeStamp.time.absolute.day);
- MSG_DEBUG("hour : %d", pTpdu->timeStamp.time.absolute.hour);
- MSG_DEBUG("minute : %d", pTpdu->timeStamp.time.absolute.minute);
- MSG_DEBUG("second : %d", pTpdu->timeStamp.time.absolute.second);
- MSG_DEBUG("timezone : %d", pTpdu->timeStamp.time.absolute.timeZone);
-
- char displayTime[32];
- struct tm * timeTM;
-
- struct tm timeinfo;
- memset(&timeinfo, 0x00, sizeof(tm));
-
- timeinfo.tm_year = (pTpdu->timeStamp.time.absolute.year + 100);
- timeinfo.tm_mon = (pTpdu->timeStamp.time.absolute.month - 1);
- timeinfo.tm_mday = pTpdu->timeStamp.time.absolute.day;
- timeinfo.tm_hour = pTpdu->timeStamp.time.absolute.hour;
- timeinfo.tm_min = pTpdu->timeStamp.time.absolute.minute;
- timeinfo.tm_sec = pTpdu->timeStamp.time.absolute.second;
- timeinfo.tm_isdst = 0;
-
- rawtime = mktime(&timeinfo);
-
- MSG_DEBUG("tzname[0] [%s]", tzname[0]);
- MSG_DEBUG("tzname[1] [%s]", tzname[1]);
- MSG_DEBUG("timezone [%d]", timezone);
- MSG_DEBUG("daylight [%d]", daylight);
-
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeinfo);
- MSG_DEBUG("displayTime [%s]", displayTime);
-
- rawtime -= (pTpdu->timeStamp.time.absolute.timeZone * (3600/4));
-
- timeTM = localtime(&rawtime);
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
- MSG_DEBUG("displayTime [%s]", displayTime);
-
- rawtime -= timezone;
-
- timeTM = localtime(&rawtime);
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
- MSG_DEBUG("displayTime [%s]", displayTime);
- }
-
-***/
-
- msgInfo->displayTime = rawtime;
-
/** Convert Address values */
msgInfo->nAddressCnt = 1;
+
+ msgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(msgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
msgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(msgInfo->addressList[0].addressVal, pTpdu->originAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -540,25 +688,29 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
msgInfo->msgType.subType = (pTpdu->userData.header[i].udh.specialInd.msgInd+MSG_MWI_VOICE_SMS);
msgInfo->bStore = pTpdu->userData.header[i].udh.specialInd.bStore;
+ bUdhMwiMethod = true;
+
if (pTpdu->dcs.codingGroup == SMS_GROUP_DISCARD)
msgInfo->bStore = false;
- MSG_DEBUG("Message waiting number : [%d]", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
- SmsPluginSetting::instance()->setMwiInfo(msgInfo->msgType.subType, pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ udhMwiCnt = pTpdu->userData.header[i].udh.specialInd.waitMsgNum;
+ MSG_DEBUG("Message waiting number : [%d]", udhMwiCnt);
+
+ SmsPluginSetting::instance()->setMwiInfo(msgInfo->sim_idx, msgInfo->msgType.subType, udhMwiCnt);
- if (pTpdu->userData.length == 0) {
+ if (udhMwiCnt > 0 && (msgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && msgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
switch (msgInfo->msgType.subType) {
case MSG_MWI_VOICE_SMS :
- sprintf(msgInfo->msgText, "%d new voice message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%d", udhMwiCnt);
break;
case MSG_MWI_FAX_SMS :
- sprintf(msgInfo->msgText, "%d new fax message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%d new fax message", udhMwiCnt);
break;
case MSG_MWI_EMAIL_SMS :
- sprintf(msgInfo->msgText, "%d new email message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%d new email message", udhMwiCnt);
break;
default :
- sprintf(msgInfo->msgText, "%d new special message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%d new special message", udhMwiCnt);
break;
}
msgInfo->dataSize = strlen(msgInfo->msgText);
@@ -566,6 +718,10 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
}
} else if (pTpdu->userData.header[i].udhType == SMS_UDH_ALTERNATE_REPLY_ADDRESS) {
strncpy(msgInfo->addressList[0].addressVal, pTpdu->userData.header[i].udh.alternateAddress.address, MAX_ADDRESS_VAL_LEN);
+ } else if (pTpdu->userData.header[i].udhType >= SMS_UDH_EMS_FIRST && pTpdu->userData.header[i].udhType <= SMS_UDH_EMS_LAST) {
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "Unsupported Message");
+ msgInfo->dataSize = strlen(msgInfo->msgText);
+ return;
}
}
@@ -598,6 +754,7 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
}
/** Convert Data values */
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
MSG_LANG_INFO_S langInfo = {0,};
@@ -615,17 +772,17 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
}
msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
- msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+ msgInfo->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
msgInfo->encodeType = MSG_ENCODE_8BIT;
memcpy(msgInfo->msgText, pTpdu->userData.data, sizeof(pTpdu->userData.data));
msgInfo->dataSize = pTpdu->userData.length;
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
msgInfo->encodeType = MSG_ENCODE_UCS2;
- msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_EUCKR) {
msgInfo->encodeType = MSG_ENCODE_8BIT;
- msgInfo->dataSize = textCvt.convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt->convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
return;
}
@@ -643,7 +800,9 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
msgInfo->folderId = MSG_INBOX_ID;
/** set storage id */
- msgInfo->storageId = MSG_STORAGE_PHONE;
+ if (msgInfo->storageId == MSG_STORAGE_UNKNOWN) {
+ msgInfo->storageId = MSG_STORAGE_PHONE;
+ }
switch(pTpdu->dcs.msgClass)
{
@@ -666,9 +825,20 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
MSG_DEBUG("delivery status : [%d]", pTpdu->status);
- if (pTpdu->status == SMS_STATUS_RECEIVE_SUCCESS) {
+ if (pTpdu->status == SMS_STATUS_RECEIVE_SUCCESS)
+ {
msgInfo->networkStatus = MSG_NETWORK_DELIVER_SUCCESS;
- } else {
+ }
+ else if(pTpdu->status == SMS_STATUS_TRY_REQUEST_PENDING)
+ {
+ msgInfo->networkStatus = MSG_NETWORK_DELIVER_PENDING;
+ }
+ else if(pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED)
+ {
+ msgInfo->networkStatus = MSG_NETWORK_DELIVER_EXPIRED;
+ }
+ else
+ {
msgInfo->networkStatus = MSG_NETWORK_DELIVER_FAIL;
}
@@ -740,6 +910,10 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
/** Convert Address values */
msgInfo->nAddressCnt = 1;
+
+ msgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(msgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
msgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(msgInfo->addressList[0].addressVal, pTpdu->recipAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -764,13 +938,13 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
msgInfo->dataSize = 0;
if (pTpdu->status <= SMS_STATUS_SMSC_SPECIFIC_LAST) {
- strncpy(msgInfo->msgText, "Message delivered.", MAX_MSG_TEXT_LEN);
+ strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MESSAGE_DELIVERED", MAX_MSG_TEXT_LEN);
msgInfo->dataSize = strlen(msgInfo->msgText);
} else if (pTpdu->status == SMS_STATUS_TEMP_SERVICE_REJECTED) {
- strncpy(msgInfo->msgText, "Message delivery rejected.", MAX_MSG_TEXT_LEN);
+ strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MMSDELIVERYMSGREJECTED", MAX_MSG_TEXT_LEN);
msgInfo->dataSize = strlen(msgInfo->msgText);
} else if (pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED) {
- strncpy(msgInfo->msgText, "Message delivery expired.", MAX_MSG_TEXT_LEN);
+ strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MESSAGE_HAS_EXPIRED", MAX_MSG_TEXT_LEN);
msgInfo->dataSize = strlen(msgInfo->msgText);
} else {
strncpy(msgInfo->msgText, "Message delivery failed.", MAX_MSG_TEXT_LEN);
@@ -818,27 +992,72 @@ void SmsPluginEventHandler::SetSentInfo(SMS_SENT_INFO_S *pSentInfo)
}
-void SmsPluginEventHandler::setDeviceStatus()
+void SmsPluginEventHandler::setDeviceStatus(struct tapi_handle *handle)
{
- mx.lock();
- devStatus = true;
- cv.signal();
- mx.unlock();
+ if (handle == devHandle) {
+ mx.lock();
+ devStatus = true;
+ cv.signal();
+ mx.unlock();
+ }
}
-bool SmsPluginEventHandler::getDeviceStatus()
+bool SmsPluginEventHandler::getDeviceStatus(struct tapi_handle *handle)
{
int ret = 0;
mx.lock();
-
- ret = cv.timedwait(mx.pMutex(), 16);
+ devHandle = handle;
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
if (ret == ETIMEDOUT) {
- MSG_DEBUG("WARNING: DEVICE STATUS TIME-OUT");
+ MSG_WARN("WARNING: DEVICE STATUS TIME-OUT");
devStatus = false;
}
+ devHandle = NULL;
mx.unlock();
return devStatus;
}
+
+
+msg_error_t SmsPluginEventHandler::handleSimMsg(MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList, msg_message_id_t *retMsgId, int listSize)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ /** Callback to MSG FW */
+ err = listener.pfSimMsgIncomingCb(pMsgInfo, simIdList, retMsgId, listSize);
+
+ MSG_END();
+
+ return err;
+}
+
+msg_error_t SmsPluginEventHandler::updateIMSI(int sim_idx)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ /** Callback to MSG FW */
+ err = listener.pfSimInitImsiCb(sim_idx);
+
+ MSG_END();
+
+ return err;
+}
+
+void SmsPluginEventHandler::handleSimMemoryFull(int simIndex)
+{
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ bool bSimSst = true;
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SERVICE_TABLE, simIndex);
+ if (MsgSettingGetBool(keyName, &bSimSst) != MSG_SUCCESS)
+ MSG_ERR("MsgSettingGetBool [%s] failed", keyName);
+
+ if (bSimSst == true)
+ MsgInsertTicker("Sim memory full. Delete some items", SMS_MESSAGE_SIM_MESSAGE_FULL, true, 0);
+}
diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp
index 5ce369e..05cf72c 100755
--- a/plugin/sms_plugin/SmsPluginMain.cpp
+++ b/plugin/sms_plugin/SmsPluginMain.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <errno.h>
@@ -32,6 +29,8 @@
#include "SmsPluginEventHandler.h"
#include "SmsPluginUAManager.h"
#include "SmsPluginMain.h"
+#include "SmsPluginDSHandler.h"
+#include <gio/gio.h>
extern "C"
{
@@ -42,29 +41,27 @@ extern "C"
#include <ITapiNetText.h>
}
-struct tapi_handle *pTapiHandle = NULL;
+#define BUS_NAME "org.tizen.system.deviced"
+#define PATH_NAME "/Org/Tizen/System/DeviceD/Lowmem"
+#define INTERFACE_NAME BUS_NAME".lowmem"
+#define MEMBER_NAME "Full"
+
+GDBusConnection *gdbus_conn = NULL;
+GDBusProxy *gdbus_proxy = NULL;
+gint subs_id = 0;
+
+bool isMemAvailable = true;
Mutex mx;
CndVar cv;
+
+void MsgResourceMonitorInit(void);
+void MsgResourceMonitorDeinit(void);
+
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
-static void MsgTapiInitCB(keynode_t *key, void* data)
-{
- MSG_DEBUG("MsgTapiInitCB is called.");
-
- bool bTelRdy = false;
- bTelRdy = vconf_keynode_get_bool(key);
-
- MSG_DEBUG("bTelRdy [%d]", bTelRdy);
-
- if (bTelRdy) {
- mx.lock();
- cv.signal();
- mx.unlock();
- }
-}
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
@@ -78,19 +75,15 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
pPluginHandle->pfInitialize = SmsPlgInitialize;
pPluginHandle->pfFinalize = SmsPlgFinalize;
pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
- pPluginHandle->pfCheckSimStatus = SmsPlgCheckSimStatus;
- pPluginHandle->pfCheckDeviceStatus = SmsPlgCheckDeviceStatus;
pPluginHandle->pfSubmitRequest = SmsPlgSubmitRequest;
- pPluginHandle->pfInitSimMessage = SmsPlgInitSimMessage;
pPluginHandle->pfSaveSimMessage = SmsPlgSaveSimMessage;
pPluginHandle->pfDeleteSimMessage = SmsPlgDeleteSimMessage;
pPluginHandle->pfSetReadStatus = SmsPlgSetReadStatus;
pPluginHandle->pfSetMemoryStatus = SmsPlgSetMemoryStatus;
- pPluginHandle->pfInitConfigData = SmsPlgInitConfigData;
pPluginHandle->pfSetConfigData = SmsPlgSetConfigData;
pPluginHandle->pfGetConfigData = SmsPlgGetConfigData;
-
- pPluginHandle->pfRestoreMsg = NULL;
+ pPluginHandle->pfAddMessage = SmsPlgAddMessage;
+ pPluginHandle->pfGetDefaultNetworkSimId = SmsPlgGetDefaultNetworkSimId;
MSG_DEBUG("SMS plugin: create handler OK");
MSG_DEBUG ("SMS plugin %p", pPluginHandle);
@@ -118,71 +111,50 @@ msg_error_t SmsPlgInitialize()
{
MSG_BEGIN();
- MSG_DEBUG("set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND.");
- if (MsgSettingSetInt(MSG_SIM_CHANGED, MSG_SIM_STATUS_NOT_FOUND) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetInt is failed!!");
-
bool bReady = false;
- MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
- MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady);
- int ret = 0;
+ for (int i = 0; i < 100; i++) {
+ MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
+ MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady ? 1 : 0);
- if(!bReady) {
- MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_READY, MsgTapiInitCB);
- mx.lock();
- ret = cv.timedwait(mx.pMutex(), 90);
- mx.unlock();
- }
+ if (bReady)
+ break;
- try
- {
- if (ret != ETIMEDOUT) {
- pTapiHandle = tel_init(NULL);
- SmsPluginCallback::instance()->registerEvent();
- } else {
- MSG_DEBUG("MsgTapiInitCB is time out.");
- }
- }
- catch (MsgException& e)
- {
- MSG_FATAL("%s", e.what());
- return MSG_ERR_PLUGIN_REGEVENT;
- }
- catch (exception& e)
- {
- MSG_FATAL("%s", e.what());
- return MSG_ERR_PLUGIN_REGEVENT;
+ sleep(1);
}
- MSG_END();
-
- return MSG_SUCCESS;
-}
-
-
-msg_error_t SmsPlgFinalize()
-{
- MSG_BEGIN();
-
- if (!pTapiHandle)
+ if (!bReady) {
+ MSG_ERR("Fail to wait telephony init complete.");
return MSG_ERR_PLUGIN_TAPIINIT;
+ }
- SmsPluginCallback::instance()->deRegisterEvent();
+ int simCnt = 0;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
- tel_deinit(pTapiHandle);
+ SmsPluginDSHandler::instance()->initTelHandle();
+ simCnt = SmsPluginDSHandler::instance()->getTelHandleCount();
- MSG_END();
+ MSG_DEBUG("simCnt [%d]", simCnt);
- return MSG_SUCCESS;
-}
+ for (int i = 1; i <= simCnt; i++) {
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, i);
+ MSG_DEBUG("set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND.");
+ if (MsgSettingSetInt(keyName, MSG_SIM_STATUS_NOT_FOUND) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
+ }
+ SmsPluginCallback::instance()->registerEvent();
-msg_error_t SmsPlgRegisterListener(MSG_PLUGIN_LISTENER_S *pListener)
-{
- MSG_BEGIN();
+ for(int i=1; i <= simCnt; ++i)
+ {
+ struct tapi_handle *handle;
+ handle = SmsPluginDSHandler::instance()->getTelHandle(i);
+ SmsPluginSetting::instance()->setSimChangeStatus(handle, true);
+ }
- SmsPluginEventHandler::instance()->registerListener(pListener);
+ // set resource monitor
+ MsgResourceMonitorInit();
MSG_END();
@@ -190,102 +162,15 @@ msg_error_t SmsPlgRegisterListener(MSG_PLUGIN_LISTENER_S *pListener)
}
-msg_error_t SmsPlgCheckSimStatus(MSG_SIM_STATUS_T *pStatus)
+msg_error_t SmsPlgFinalize()
{
MSG_BEGIN();
- if (!pTapiHandle)
- return MSG_ERR_PLUGIN_TAPIINIT;
-
- int tryNum = 0, tapiRet = TAPI_API_SUCCESS;
+ MsgResourceMonitorDeinit();
- TelSimCardStatus_t status = TAPI_SIM_STATUS_CARD_ERROR;
- int cardChanged = 0;
-
- // initialize pStatus.
- *pStatus = MSG_SIM_STATUS_NOT_FOUND;
-
- // Check SIM Status
- while (1)
- {
- if (tryNum > 30) return MSG_ERR_PLUGIN_TAPIINIT;
-
- tapiRet = tel_get_sim_init_info(pTapiHandle, &status, &cardChanged);
-
- if (tapiRet == TAPI_API_SUCCESS) {
- if (status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED || status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED) {
- MSG_DEBUG("PIN or PUK is required [%d]", status);
-
- sleep(3);
-
- continue;
- }
-
- if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
- MSG_DEBUG("SIM status is OK [%d]", status);
-
- MSG_DEBUG("SIM Changed [%d]", cardChanged);
-
- if (cardChanged == 1)
- *pStatus = MSG_SIM_STATUS_CHANGED;
- else
- *pStatus = MSG_SIM_STATUS_NORMAL;
-
- break;
- } else if (status == TAPI_SIM_STATUS_CARD_NOT_PRESENT) {
- MSG_DEBUG("SIM is not present [%d]", status);
- break;
- } else {
- MSG_DEBUG("SIM status is not OK [%d]", status);
- tryNum++;
-
- sleep(3);
- }
- } else if (tapiRet == TAPI_API_SIM_NOT_FOUND) {
- MSG_DEBUG("tel_get_sim_init_info() result is TAPI_API_SIM_NOT_FOUND");
- break;
- } else {
- MSG_DEBUG("tel_get_sim_init_info() result is unknown!!!!!!!!!! [%d]", tapiRet);
- tryNum++;
-
- sleep(3);
- }
- }
-
-
- char imsi[7];
- memset(imsi, 0x00, sizeof(imsi));
-
- // Get IMSI
- if (*pStatus != MSG_SIM_STATUS_NOT_FOUND)
- {
- // Get IMSI
- TelSimImsiInfo_t imsiInfo;
- memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
-
- tapiRet = tel_get_sim_imsi(pTapiHandle, &imsiInfo);
-
- if (tapiRet == TAPI_API_SUCCESS)
- {
- MSG_DEBUG("tel_get_sim_imsi() Success - MCC [%s], MNC [%s]", imsiInfo.szMcc, imsiInfo.szMnc);
-
- sprintf(imsi, "%03d%03d", atoi(imsiInfo.szMcc), atoi(imsiInfo.szMnc));
-
- MSG_DEBUG("IMSI [%d]", atoi(imsi));
- }
- else
- {
- MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
-
- MsgSettingSetBool(MSG_NATIONAL_SIM, false);
- }
- }
- else
- {
- MsgSettingSetBool(MSG_NATIONAL_SIM, false);
- }
+ SmsPluginCallback::instance()->deRegisterEvent();
- MsgSettingSetString(MSG_SIM_IMSI, imsi);
+ SmsPluginDSHandler::instance()->deinitTelHandle();
MSG_END();
@@ -293,36 +178,13 @@ msg_error_t SmsPlgCheckSimStatus(MSG_SIM_STATUS_T *pStatus)
}
-msg_error_t SmsPlgCheckDeviceStatus()
+msg_error_t SmsPlgRegisterListener(MSG_PLUGIN_LISTENER_S *pListener)
{
MSG_BEGIN();
- if (!pTapiHandle)
- return MSG_ERR_PLUGIN_TAPIINIT;
-
- int status = 0, tapiRet = TAPI_API_SUCCESS;
-
- tapiRet = tel_check_sms_device_status(pTapiHandle, &status);
-
- if (tapiRet != TAPI_API_SUCCESS) {
- MSG_DEBUG("tel_check_sms_device_status() Error! [%d], Status [%d]", tapiRet, status);
- return MSG_ERR_PLUGIN_TAPI_FAILED;
- }
-
- if (status == 1) {
- MSG_DEBUG("Device Is Ready");
- return MSG_SUCCESS;
- } else if (status == 0) {
- MSG_DEBUG("Device Is Not Ready.. Waiting For Ready Callback");
+ SmsPluginEventHandler::instance()->registerListener(pListener);
- if (SmsPluginEventHandler::instance()->getDeviceStatus() == true) {
- MSG_DEBUG("Device Is Ready");
- return MSG_SUCCESS;
- } else {
- MSG_DEBUG("Device Is Not Ready.");
- return MSG_ERR_PLUGIN_TAPI_FAILED;
- }
- }
+ MSG_END();
return MSG_SUCCESS;
}
@@ -335,11 +197,19 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
// Add Submit SMS into DB
if (pReqInfo->msgInfo.msgId == 0) {
if (pReqInfo->msgInfo.msgPort.valid == false) {
- err = SmsPluginStorage::instance()->addMessage(&(pReqInfo->msgInfo));
+ err = SmsPluginStorage::instance()->checkMessage(&(pReqInfo->msgInfo));
+
if (err != MSG_SUCCESS) {
- MSG_DEBUG("######## addMessage Fail !!");
+ MSG_DEBUG("######## checkMessage Fail !! [err=%d]", err);
return MSG_ERR_PLUGIN_STORAGE;
}
+
+ err = SmsPluginStorage::instance()->addSmsMessage(&(pReqInfo->msgInfo));
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("######## addSmsMessage Fail !! [err=%d]", err);
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
+
if (SmsPluginStorage::instance()->addSmsSendOption(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)) != MSG_SUCCESS) {
MSG_DEBUG("######## addSmsSendOption Fail !!");
return MSG_ERR_PLUGIN_STORAGE;
@@ -348,7 +218,9 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
}
// Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+ char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+ sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx);
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
if (simStatus == MSG_SIM_STATUS_NOT_FOUND)
{
@@ -382,19 +254,24 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
}
-msg_error_t SmsPlgInitSimMessage()
+msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
{
// Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pMsgInfo->sim_idx);
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
return MSG_ERR_NO_SIM;
}
+ msg_error_t err = MSG_SUCCESS;
+
try
{
- SmsPluginSimMsg::instance()->initSimMessage();
+ err = SmsPluginSimMsg::instance()->saveSimMessage(pMsgInfo, pSimIdList);
}
catch (MsgException& e)
{
@@ -407,32 +284,16 @@ msg_error_t SmsPlgInitSimMessage()
return MSG_ERR_PLUGIN_STORAGE;
}
- return MSG_SUCCESS;
-}
-
-
-msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
-{
- // Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-
- if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
- MSG_DEBUG("SIM is not present..");
- return MSG_ERR_NO_SIM;
- }
-
- msg_error_t err = MSG_SUCCESS;
-
- err = SmsPluginSimMsg::instance()->saveSimMessage(pMsgInfo, pSimIdList);
-
return err;
}
-msg_error_t SmsPlgDeleteSimMessage(msg_sim_id_t SimMsgId)
+msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
// Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+ char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
+ sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, sim_idx);
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
@@ -441,7 +302,7 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_id_t SimMsgId)
try
{
- SmsPluginSimMsg::instance()->deleteSimMessage(SimMsgId);
+ SmsPluginSimMsg::instance()->deleteSimMessage(sim_idx, SimMsgId);
}
catch (MsgException& e)
{
@@ -458,10 +319,12 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_id_t SimMsgId)
}
-msg_error_t SmsPlgSetReadStatus(msg_sim_id_t SimMsgId)
+msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
// Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+ char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
+ sprintf(keyName, "%s/%d", MSG_SIM_CHANGED, sim_idx);
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
@@ -470,7 +333,7 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_id_t SimMsgId)
try
{
- SmsPluginSimMsg::instance()->setReadStatus(SimMsgId);
+ SmsPluginSimMsg::instance()->setReadStatus(sim_idx, SimMsgId);
}
catch (MsgException& e)
{
@@ -487,10 +350,14 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_id_t SimMsgId)
}
-msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
+msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
{
// Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, simIndex);
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
@@ -507,7 +374,9 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
MSG_DEBUG("Set Status : [%d]", status);
- tapiRet = tel_set_sms_memory_status(pTapiHandle, status, TapiEventMemoryStatus, NULL);
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+
+ tapiRet = tel_set_sms_memory_status(handle, status, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -522,19 +391,32 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
}
-msg_error_t SmsPlgInitConfigData(MSG_SIM_STATUS_T SimStatus)
+msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
{
- // Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-
- if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
- MSG_DEBUG("SIM is not present..");
- return MSG_ERR_NO_SIM;
+ try
+ {
+ SmsPluginSetting::instance()->setConfigData(pSetting);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_PLUGIN_SETTING;
+ }
+ catch (exception& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_PLUGIN_SETTING;
}
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
+{
try
{
- SmsPluginSetting::instance()->initConfigData(SimStatus);
+ SmsPluginSetting::instance()->getConfigData(pSetting);
}
catch (MsgException& e)
{
@@ -551,19 +433,15 @@ msg_error_t SmsPlgInitConfigData(MSG_SIM_STATUS_T SimStatus)
}
-msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
+msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char* pFileData)
{
- // Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-
- if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
- MSG_DEBUG("SIM is not present..");
- return MSG_ERR_NO_SIM;
- }
+ int *simIdList = (int*)pFileData;
try
{
- SmsPluginSetting::instance()->setConfigData(pSetting);
+ SmsPluginStorage::instance()->addSmsSendOption(pMsgInfo, pSendOptInfo);
+ if (simIdList)
+ SmsPluginStorage::instance()->addSimMessage(pMsgInfo, simIdList);
}
catch (MsgException& e)
{
@@ -580,19 +458,12 @@ msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
}
-msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
+msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId)
{
- // Check SIM is present or not
- MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-
- if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
- MSG_DEBUG("SIM is not present..");
- return MSG_ERR_NO_SIM;
- }
try
{
- SmsPluginSetting::instance()->getConfigData(pSetting);
+ SmsPluginDSHandler::instance()->getDefaultNetworkSimId(simId);
}
catch (MsgException& e)
{
@@ -608,3 +479,103 @@ msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
return MSG_SUCCESS;
}
+
+static void on_change_received(GDBusConnection *connection, const gchar *sender_name,
+ const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+ GVariant *parameters, gpointer user_data)
+{
+ MSG_DEBUG("signal_name = [%s]", signal_name);
+
+ if (g_strcmp0(signal_name, MEMBER_NAME) == 0) {
+ gint memStatus;
+ g_variant_get(parameters, "(i)", &memStatus);
+ MSG_DEBUG("memStatus = [%d]", memStatus);
+ if(memStatus == 0) {
+ int sim_count = SmsPluginDSHandler::instance()->getTelHandleCount();
+
+ for (int i = 0; i < sim_count; i++) {
+ SmsPlgSetMemoryStatus(i, MSG_SUCCESS);
+ }
+ }
+ }
+}
+
+void MsgResourceMonitorInit(void)
+{
+ MSG_BEGIN();
+
+ GError *error = NULL;
+
+ if (gdbus_conn) {
+ g_object_unref(gdbus_conn);
+ gdbus_conn = NULL;
+ }
+
+ gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_FATAL("g_bus_get_sync() failed : %s", error->message);
+ g_error_free(error);
+ error = NULL;
+ goto _DBUS_ERROR;
+ }
+
+ if (gdbus_proxy) {
+ g_object_unref(gdbus_proxy);
+ gdbus_proxy = NULL;
+ }
+
+ gdbus_proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BUS_NAME, PATH_NAME, INTERFACE_NAME, NULL, &error);
+ if (error) {
+ MSG_FATAL("g_dbus_proxy_new_sync() failed : %s", error->message);
+ g_error_free(error);
+ error = NULL;
+ goto _DBUS_ERROR;
+ }
+
+ subs_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL,
+ INTERFACE_NAME, MEMBER_NAME, PATH_NAME,
+ NULL, G_DBUS_SIGNAL_FLAGS_NONE,
+ on_change_received,
+ NULL, NULL);
+ MSG_END();
+ return;
+
+_DBUS_ERROR:
+ if (gdbus_conn) {
+ g_object_unref(gdbus_conn);
+ gdbus_conn = NULL;
+ }
+
+ if (gdbus_proxy) {
+ g_object_unref(gdbus_proxy);
+ gdbus_proxy = NULL;
+ }
+
+ MSG_END();
+ return;
+
+}
+
+
+void MsgResourceMonitorDeinit(void)
+{
+ MSG_BEGIN();
+
+ if (subs_id) {
+ g_dbus_connection_signal_unsubscribe(gdbus_conn, subs_id);
+ subs_id = 0;
+ }
+
+ if (gdbus_conn) {
+ g_object_unref(gdbus_conn);
+ gdbus_conn = NULL;
+ }
+
+ if (gdbus_proxy) {
+ g_object_unref(gdbus_proxy);
+ gdbus_proxy = NULL;
+ }
+
+ MSG_END();
+}
diff --git a/plugin/sms_plugin/SmsPluginParamCodec.cpp b/plugin/sms_plugin/SmsPluginParamCodec.cpp
index 1d76614..ca1e7e7 100755
--- a/plugin/sms_plugin/SmsPluginParamCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginParamCodec.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <stdio.h>
@@ -264,7 +261,7 @@ int SmsPluginParamCodec::encodeSMSC(const SMS_ADDRESS_S *pAddress, unsigned char
int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S *pAddress)
{
int offset = 0, addrLen = 0, bcdLen = 0;
- MsgTextConvert textCvt;
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
memset(pAddress->address, 0x00, sizeof(pAddress->address));
addrLen = (int)pTpdu[offset++];
@@ -287,22 +284,23 @@ MSG_DEBUG("npi [%d]", pAddress->npi);
char* tmpAddress = new char[MAX_ADDRESS_LEN];
int tmplength = 0;
- tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), bcdLen, 0, tmpAddress);
+ tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), (addrLen*4 )/7, 0, tmpAddress);
MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
- textCvt.convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
+ textCvt->convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
if (tmpAddress)
delete[] tmpAddress;
}
else if (pAddress->ton == SMS_TON_INTERNATIONAL)
{
- (pAddress->address)[0] = '+';
convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[1]));
+ if (pAddress->address[1] != '\0')
+ pAddress->address[0] = '+';
}
else
{
@@ -418,7 +416,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
pDCS->bMWI = true;
- pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? false:true;
+ pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
}
else
@@ -530,3 +528,25 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
return offset;
}
+bool SmsPluginParamCodec::checkCphsVmiMsg(const unsigned char *pTpdu, int *setType, int *indType)
+{
+ bool ret = false;
+
+ int offset = 0;
+ int addrLen = 0;
+
+ addrLen = (int)pTpdu[offset++];
+
+ if (addrLen == 0x04 && pTpdu[offset++] == 0xD0) {
+ if (pTpdu[offset] == 0x11 || pTpdu[offset] == 0x10) {
+ MSG_DEBUG("####### VMI msg ######");
+ *setType = (int)(pTpdu[offset] & 0x01); // 0 : clear, 1 : set
+
+ *indType = (int)(pTpdu[offset+1] & 0x01); // 0 : indicator 1, 1 : indicator 2
+
+ ret = true;
+ }
+ }
+
+ return ret;
+}
diff --git a/plugin/sms_plugin/SmsPluginSatHandler.cpp b/plugin/sms_plugin/SmsPluginSatHandler.cpp
index 831a0a7..ab75e1a 100755
--- a/plugin/sms_plugin/SmsPluginSatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginSatHandler.cpp
@@ -1,33 +1,35 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
+#include <errno.h>
#include "MsgDebug.h"
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
+#include "MsgUtilStorage.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginUDCodec.h"
+#include "SmsPluginTpduCodec.h"
#include "SmsPluginSetting.h"
#include "SmsPluginTransport.h"
#include "SmsPluginCallback.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginSatHandler.h"
+#include "SmsPluginDSHandler.h"
extern "C"
{
@@ -38,7 +40,6 @@ extern "C"
#include <ITapiSat.h>
}
-extern struct tapi_handle *pTapiHandle;
/*==================================================================================================
IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
==================================================================================================*/
@@ -49,7 +50,6 @@ SmsPluginSatHandler::SmsPluginSatHandler()
{
commandId = 0;
- bSendSms = false;
bInitSim = false;
bSMSPChanged = false;
bCBMIChanged = false;
@@ -71,7 +71,7 @@ SmsPluginSatHandler* SmsPluginSatHandler::instance()
}
-void SmsPluginSatHandler::refreshSms(void *pData)
+void SmsPluginSatHandler::refreshSms(struct tapi_handle *handle, void *pData)
{
/*
TelSatRefreshInd_t* pRefreshData = (TelSatRefreshInd_t*)pData;
@@ -138,12 +138,10 @@ void SmsPluginSatHandler::refreshSms(void *pData)
}
-void SmsPluginSatHandler::sendSms(void *pData)
+void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
{
TelSatSendSmsIndSmsData_t* pSmsData = (TelSatSendSmsIndSmsData_t*)pData;
- bSendSms = true;
-
commandId = pSmsData->commandId;
MSG_DEBUG("commandId [%d]", commandId);
@@ -159,9 +157,16 @@ void SmsPluginSatHandler::sendSms(void *pData)
// Modify Parameters, Pack User Data
tpduLen = handleSatTpdu(tpdu, pSmsData->smsTpdu.dataLen, pSmsData->bIsPackingRequired);
- if (tpduLen <= 0 || tpduLen > MAX_TPDU_DATA_LEN)
- {
- sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
+ if (tpduLen <= 0) {
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
+ return;
+ } //else if (tpduLen > MAX_TPDU_DATA_LEN) {
+ else if (tpduLen > MAX_SAT_TPDU_LEN) { //CID 358478: replacing check against MAX_TPDU_DATA_LEN (255) with check
+ // against MAX_SAT_TPDU_LEN (175).
+ // as mentioned above "The TPDU Maximum Length at SAT side is 175".
+ // Earlier MAX_TPDU_DATA_LEN was increased from 165 to 255 which creates confusion for prevent tool.
+ // Prevent tool thinks that it can take value of 255 and cause buffer overflow during memcpy below.
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
return;
}
@@ -172,31 +177,33 @@ void SmsPluginSatHandler::sendSms(void *pData)
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, tpdu, tpduLen);
- pkgInfo.szData[tpduLen - 1] = '\0';
+ pkgInfo.szData[tpduLen] = '\0';
pkgInfo.MsgLength = tpduLen;
+ pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
// Set SMSC Address
- SMS_ADDRESS_S smsc;
+ SMS_ADDRESS_S smsc = {0,};
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
if (pSmsData->address.diallingNumberLen > 0)
{
smsc.ton = pSmsData->address.ton;
smsc.npi = pSmsData->address.npi;
- memcpy(smsc.address, pSmsData->address.diallingNumber, pSmsData->address.diallingNumberLen);
- smsc.address[pSmsData->address.diallingNumberLen] = '\0';
+ snprintf(smsc.address, sizeof(smsc.address), "%s", pSmsData->address.diallingNumber);
- MSG_DEBUG("SCA TON[%d], NPI[%d], LEN[%d], ADDR[%s]", smsc.ton, smsc.npi, strlen(smsc.address), smsc.address);
+ MSG_SEC_DEBUG("SCA TON[%d], NPI[%d], LEN[%d], ADDR[%s]", smsc.ton, smsc.npi, strlen(smsc.address), smsc.address);
}
else
{
// Set SMSC Options
- SmsPluginTransport::instance()->setSmscOptions(&smsc);
+ SmsPluginTransport::instance()->setSmscOptions(simIndex, &smsc);
}
unsigned char smscAddr[MAX_SMSC_LEN];
- memset(smscAddr, 0x00, sizeof(smscAddr));
+ int smscLen = 0;
- int smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
+ memset(smscAddr, 0x00, sizeof(smscAddr));
+ smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
if (smscLen <= 0) return;
@@ -208,24 +215,45 @@ void SmsPluginSatHandler::sendSms(void *pData)
int tapiRet = TAPI_API_SUCCESS;
// Send SMS
- tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, 0, TapiEventSentStatus, NULL);
+ tapiRet = tel_send_sms(handle, &pkgInfo, 0, TapiEventSatSmsSentStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
MSG_DEBUG("######## TelTapiSmsSend Success !!! return : %d #######", tapiRet);
+
}
else
{
MSG_DEBUG("######## TelTapiSmsSend Fail !!! return : %d #######", tapiRet);
- sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
}
}
-void SmsPluginSatHandler::ctrlSms(void *pData)
+void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, void *pData)
{
+ if (!pData) {
+ MSG_DEBUG("pData is NULL");
+ return;
+ }
+
TelSatMoSmCtrlIndData_t* pCtrlData = (TelSatMoSmCtrlIndData_t*)pData;
+#if 0 // sangkoo 13.11.28
+ if (bSendSmsbySat == true) {// Send SMS By SAT
+ MSG_DEBUG("Event Noti for sending message by SAT : result = [%d]", pCtrlData->moSmsCtrlResult);
+ } else { // Send SMS By APP
+ SmsPluginTransport::instance()->setMoCtrlStatus(pCtrlData);
+ }
+#else
+ if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED) {
+ MsgInsertTicker("Sending message failed : blocked by call control", NULL, true, 0);
+ }
+#endif
+
+ return;
+
+#if 0
if (bSendSms == true) // Send SMS By SAT
{
if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED)
@@ -261,29 +289,43 @@ void SmsPluginSatHandler::ctrlSms(void *pData)
// Call Event Handler
SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
}
+#endif
}
-void SmsPluginSatHandler::ctrlSms(msg_network_status_t netStatus)
+void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, SMS_NETWORK_STATUS_T smsStatus)
{
- if (bSendSms == true) // Send SMS By SAT
- {
- if (netStatus == MSG_NETWORK_SEND_SUCCESS)
- {
- MSG_DEBUG("Sending SMS by SAT is OK");
-
- sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
- }
- else if (netStatus == MSG_NETWORK_SEND_FAIL)
- {
- MSG_DEBUG("Sending SMS by SAT is failed");
+ MSG_DEBUG("SMS network status = [%d]", smsStatus);
+
+ if (smsStatus == SMS_NETWORK_SEND_SUCCESS) {
+ MSG_DEBUG("Sending SMS by SAT is OK");
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
+ } else if (smsStatus == SMS_NETWORK_SEND_FAIL) {
+ MSG_ERR("Sending SMS by SAT is failed");
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SMS_RP_ERROR);
+ } else if (smsStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING){
+ MSG_ERR("Sending SMS by SAT is failed, but result is 'success'");
+ //sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_ERROR_REQUIRED_VALUES_ARE_MISSING);
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
+ } else if (smsStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED){
+ MSG_ERR("Sending SMS is failed by MO control");
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM);
+ } else if (smsStatus == SMS_NETWORK_SEND_FAIL_NO_ROUTING){
+ MSG_ERR("Sending SMS is failed by no routing");
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_NETWORK_UNABLE_TO_PROCESS_COMMAND);
+ } else { /*Default case*/
+ MSG_ERR("Sending SMS by SAT is failed");
+ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SMS_RP_ERROR);
+ }
- sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SMS_RP_ERROR);
- }
+#if 0 //P150109-07114 : no ticker and sound for sending SAT sms failure case.
+ if (smsStatus != SMS_NETWORK_SEND_SUCCESS) {
+ MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, 0);
}
+#endif
}
-
+#if 0
void SmsPluginSatHandler::finishSimMsgInit(msg_error_t Err)
{
// SAT Handler is initializing SIM now
@@ -354,11 +396,11 @@ void SmsPluginSatHandler::initSMSCList()
MSG_DEBUG("pid[%d]", settingData.option.smscList.smscData[i].pid);
// MSG_DEBUG("dcs[%d]", settingData.option.smscList.smscData[i].dcs);
MSG_DEBUG("val_period[%d]", settingData.option.smscList.smscData[i].valPeriod);
- MSG_DEBUG("name[%s]", settingData.option.smscList.smscData[i].name);
+ MSG_SEC_DEBUG("name[%s]", settingData.option.smscList.smscData[i].name);
MSG_DEBUG("ton[%d]", settingData.option.smscList.smscData[i].smscAddr.ton);
MSG_DEBUG("npi[%d]", settingData.option.smscList.smscData[i].smscAddr.npi);
- MSG_DEBUG("address[%s]", settingData.option.smscList.smscData[i].smscAddr.address);
+ MSG_SEC_DEBUG("address[%s]", settingData.option.smscList.smscData[i].smscAddr.address);
}
if (MsgSettingSetInt(SMSC_SELECTED, settingData.option.smscList.selected) != MSG_SUCCESS)
@@ -373,51 +415,51 @@ void SmsPluginSatHandler::initSMSCList()
return;
}
- char keyName[128];
+ char keyName[MAX_VCONFKEY_NAME_LEN];
msg_error_t err = MSG_SUCCESS;
for (int i = 0; i < settingData.option.smscList.totalCnt; i++)
{
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_PID, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_PID, i);
if ((err = MsgSettingSetInt(keyName, (int)settingData.option.smscList.smscData[i].pid)) != MSG_SUCCESS)
break;
#if 0
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_DCS, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_DCS, i);
if ((err = MsgSettingSetInt(keyName, (int)settingData.option.smscList.smscData[i].dcs)) != MSG_SUCCESS)
break;
#endif
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_VAL_PERIOD, i);
if ((err = MsgSettingSetInt(keyName, (int)settingData.option.smscList.smscData[i].valPeriod)) != MSG_SUCCESS)
break;
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_NAME, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_NAME, i);
if ((err = MsgSettingSetString(keyName, settingData.option.smscList.smscData[i].name)) != MSG_SUCCESS)
break;
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_TON, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_TON, i);
if ((err = MsgSettingSetInt(keyName, (int)settingData.option.smscList.smscData[i].smscAddr.ton)) != MSG_SUCCESS)
break;
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_NPI, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_NPI, i);
if ((err = MsgSettingSetInt(keyName, (int)settingData.option.smscList.smscData[i].smscAddr.npi)) != MSG_SUCCESS)
break;
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_ADDRESS, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_ADDRESS, i);
if ((err = MsgSettingSetString(keyName, settingData.option.smscList.smscData[i].smscAddr.address)) != MSG_SUCCESS)
break;
@@ -434,6 +476,9 @@ void SmsPluginSatHandler::initCBConfig()
{
MSG_SETTING_S settingData;
+ msg_error_t err = MSG_SUCCESS;
+ MsgDbHandler *dbHandle = getDbHandle();
+
settingData.type = MSG_CBMSG_OPT;
// Get Data From SIM
@@ -451,48 +496,15 @@ void SmsPluginSatHandler::initCBConfig()
return;
}
- if (MsgSettingSetInt(CB_CHANNEL_COUNT, settingData.option.cbMsgOpt.channelData.channelCnt) != MSG_SUCCESS)
- {
- THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", CB_CHANNEL_COUNT);
- return;
- }
-
- char keyName[128];
- msg_error_t err = MSG_SUCCESS;
-
- for (int i = 0; i < settingData.option.cbMsgOpt.channelData.channelCnt; i++)
- {
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
-
- if ((err = MsgSettingSetBool(keyName, settingData.option.cbMsgOpt.channelData.channelInfo[i].bActivate)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_FROM, i);
-
- if ((err = MsgSettingSetInt(keyName, settingData.option.cbMsgOpt.channelData.channelInfo[i].from)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_TO, i);
-
- if ((err = MsgSettingSetInt(keyName, settingData.option.cbMsgOpt.channelData.channelInfo[i].to)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
-
- if ((err = MsgSettingSetString(keyName, settingData.option.cbMsgOpt.channelData.channelInfo[i].name)) != MSG_SUCCESS)
- break;
- }
+ err = MsgStoAddCBChannelInfo(dbHandle, &(settingData.option.cbMsgOpt.channelData), settingData.option.cbMsgOpt.simIndex);
+ MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err);
if (err != MSG_SUCCESS)
{
- THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", keyName);
+ THROW(MsgException::SMS_PLG_ERROR, "Error to set config data");
}
}
-
+#endif
int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduLen, int bIsPackingRequired)
{
@@ -585,9 +597,10 @@ MSG_DEBUG("user data : [%s]", userData.data);
}
-void SmsPluginSatHandler::sendResult(SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
+void SmsPluginSatHandler::sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
{
TelSatAppsRetInfo_t satRetInfo;
+ memset(&satRetInfo, 0, sizeof(TelSatAppsRetInfo_t));
satRetInfo.commandId = commandId;
@@ -609,7 +622,7 @@ void SmsPluginSatHandler::sendResult(SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
int tapiRet = TAPI_API_SUCCESS;
- tapiRet = tel_send_sat_app_exec_result(pTapiHandle, &satRetInfo);
+ tapiRet = tel_send_sat_app_exec_result(handle, &satRetInfo);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -620,9 +633,7 @@ void SmsPluginSatHandler::sendResult(SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
MSG_DEBUG("TelTapiSatSendAppExecutionResult() FAIL [%d]", tapiRet);
}
- bSendSms = false;
bInitSim = false;
bSMSPChanged = false;
bCBMIChanged = false;
}
-
diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp
index 92ddf8f..32bf2d5 100755
--- a/plugin/sms_plugin/SmsPluginSetting.cpp
+++ b/plugin/sms_plugin/SmsPluginSetting.cpp
@@ -1,34 +1,40 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <errno.h>
+#include <pthread.h>
#include "MsgDebug.h"
+#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
#include "MsgNotificationWrapper.h"
#include "MsgSoundPlayer.h"
+#include "MsgContact.h"
+#include "MsgUtilStorage.h"
+#include "MsgTextConvert.h"
+#include "MsgDevicedWrapper.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginCallback.h"
+#include "SmsPluginEventHandler.h"
+#include "SmsPluginSimMsg.h"
+#include "SmsPluginMain.h"
#include "SmsPluginSetting.h"
-
+#include "SmsPluginDSHandler.h"
extern "C"
{
@@ -37,12 +43,16 @@ extern "C"
#include <TapiUtility.h>
#include <ITapiNetText.h>
#include <ITapiSim.h>
+ #include <ITapiModem.h>
}
-extern struct tapi_handle *pTapiHandle;
+/*==================================================================================================
+ INTERNAL FUNCTION
+==================================================================================================*/
+
/*==================================================================================================
- IMPLEMENTATION OF SmsPluginSetting - Member Functions
+ IMPLEMENTATION OF SmsPluginSetting - Member Functions
==================================================================================================*/
SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
@@ -50,13 +60,22 @@ SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
SmsPluginSetting::SmsPluginSetting()
{
// Initialize member variables
- memset(&smscData, 0x00, sizeof(MSG_SMSC_DATA_S));
- memset(&cbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
- memset(&simMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ for (int i = 0; i <= MAX_TELEPHONY_HANDLE_CNT; i++) {
+ memset(&smscList[i], 0x00, sizeof(MSG_SMSC_LIST_S));
+ memset(&smscData[i], 0x00, sizeof(MSG_SMSC_DATA_S));
+ memset(&cbOpt[i], 0x00, sizeof(MSG_CBMSG_OPT_S));
+ memset(&simMailboxList[i], 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ memset(&simMwiInfo[i], 0x00, sizeof(SMS_SIM_MWI_INFO_S));
+ simStatus[i] = MSG_SIM_STATUS_NOT_FOUND;
+ }
+ memset(&meImei, 0x00, sizeof(meImei));
bTapiResult = false;
paramCnt = 0;
selectedParam = 0;
+
+ for (int i = 0; i < MAX_TELEPHONY_HANDLE_CNT; i++)
+ bMbdnEnable[i] = false;
}
@@ -76,26 +95,137 @@ SmsPluginSetting* SmsPluginSetting::instance()
}
-void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
+void* SmsPluginSetting::initSimInfo(void *data)
+{
+ static Mutex mm;
+ MutexLocker lock(mm);
+
+ SmsPluginSetting::instance()->processInitSimInfo(data);
+
+ return NULL;
+}
+
+void* SmsPluginSetting::processInitSimInfo(void *data)
+{
+ MSG_BEGIN();
+
+ //Handle sim info initialization separately
+ struct tapi_handle *handle = (struct tapi_handle *)data;
+ instance()->updateSimStatus(handle);
+
+ MSG_END();
+ return NULL;
+}
+
+
+void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
{
MSG_BEGIN();
- msg_error_t err = MSG_SUCCESS;
+ if (!handle) {
+ MSG_DEBUG("handle is NULL.");
+ return;
+ }
+
+ int status = 0;
+ int tapiRet = TAPI_API_SUCCESS;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ // Get IMSI
+ TelSimImsiInfo_t imsiInfo;
+ memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
+
+ tapiRet = tel_get_sim_imsi(handle, &imsiInfo);
+ if (tapiRet != TAPI_API_SUCCESS) {
+ MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_NATIONAL_SIM, simIndex);
+ MsgSettingSetBool(keyName, false);
+ }
+
+ /* Save Subcriber ID */
+ char *subscriberId = NULL;
+ memset(keyName, 0x00, sizeof(keyName));
+
+ if (SmsPluginDSHandler::instance()->getSubscriberId(simIndex, &subscriberId) != MSG_SUCCESS) {
+ MSG_DEBUG("getSubscriberId() is failed");
+ } else {
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SUBS_ID, simIndex);
+ MsgSettingSetString(keyName, subscriberId);
+ }
+
+ g_free(subscriberId); subscriberId = NULL;
+
+ /* Check device status */
+ tapiRet = tel_check_sms_device_status(handle, &status);
+
+ if (tapiRet != TAPI_API_SUCCESS) {
+ MSG_DEBUG("tel_check_sms_device_status() Error! [%d], Status [%d]", tapiRet, status);
+ return;
+ }
+
+ if (status == TAPI_NETTEXT_READY_STATUS_3GPP) {
+ MSG_DEBUG("Device Is Ready");
+ } else {
+ MSG_DEBUG("Device Is Not Ready.. Waiting For Ready Callback");
+
+ if (SmsPluginEventHandler::instance()->getDeviceStatus(handle) == true) {
+ MSG_DEBUG("Device Is Ready");
+ } else {
+ MSG_DEBUG("Device Is Not Ready.");
+ return;
+ }
+ }
+
+ // init config data.
+ initConfigData(handle);
+
+ try
+ {
+ // init sim messages.
+ SmsPluginSimMsg::instance()->initSimMessage(handle);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return;
+ }
+
+
+ MSG_END();
+
+ return;
+}
+
+
+void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
+{
+ MSG_BEGIN();
+
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+
+ int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ /*==================== SMSC setting ====================*/
// Init SMS Parameter
int paramCnt = 0;
int failCnt = 0;
+ bool bSelectedFound = false;
+ bool bAPReceive = false;
- paramCnt = getParamCount();
+ paramCnt = getParamCount(handle);
- MSG_DEBUG("Parameter Count [%d]", paramCnt);
+ MSG_INFO("Parameter Count [%d]", paramCnt);
MSG_SMSC_DATA_S tmpSmscData = {};
- MSG_SMSC_LIST_S tmpSmscList = {};
+ MSG_SMSC_LIST_S tmpSmscList = {0,};
for (int index = 0; index < paramCnt; index++)
{
- if (getParam(index, &tmpSmscData) == false) {
+ memset(&tmpSmscData, 0x00, sizeof(MSG_SMSC_DATA_S));
+ if (getParam(handle, index, &tmpSmscData) == false) {
failCnt++;
continue;
}
@@ -104,75 +234,130 @@ void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
MSG_DEBUG("pid[%d]", tmpSmscList.smscData[index].pid);
MSG_DEBUG("val_period[%d]", tmpSmscList.smscData[index].valPeriod);
- MSG_DEBUG("name[%s]", tmpSmscList.smscData[index].name);
+ MSG_SEC_DEBUG("name[%s]", tmpSmscList.smscData[index].name);
MSG_DEBUG("ton[%d]", tmpSmscList.smscData[index].smscAddr.ton);
MSG_DEBUG("npi[%d]", tmpSmscList.smscData[index].smscAddr.npi);
- MSG_DEBUG("address[%s]", tmpSmscList.smscData[index].smscAddr.address);
+ MSG_SEC_DEBUG("address[%s]", tmpSmscList.smscData[index].smscAddr.address);
+
+ //First smsc is selected index
+ if (!bSelectedFound) {
+ tmpSmscList.selected = selectedParam;
+ bSelectedFound = !bSelectedFound;
+ }
}
tmpSmscList.totalCnt = (paramCnt - failCnt);
-// below is commented to be the first smsc is selected.
-// tmpSmscList.selected = selectedParam;
+ tmpSmscList.simIndex = sim_idx;
if (paramCnt > 0) {
- err = addSMSCList(&tmpSmscList);
-
- if (err == MSG_SUCCESS) {
- MSG_DEBUG("######## Add SMSC List Success !!! #######");
- } else {
- MSG_DEBUG("######## Add SMSC List Fail !!! return : %d #######", err);
- }
+ MSG_DEBUG("######## Add SMSC ist #######");
+ addSMSCList(&tmpSmscList);
}
- // Init CB Config
- if (SimStatus == MSG_SIM_STATUS_CHANGED) {
- MSG_DEBUG("simStatus == MSG_SIM_STATUS_CHANGED");
+ /*==================== CB configuration ====================*/
+ if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND)
+ {
+ MSG_DEBUG("simStatus == [%d]", simStatus[sim_idx]);
- MSG_CBMSG_OPT_S cbMsgOpt = {};
+ MSG_CBMSG_OPT_S cbMsgOpt = {0,};
+ cbMsgOpt.simIndex = sim_idx;
if (getCbConfig(&cbMsgOpt) == true) {
- err = addCbOpt(&cbMsgOpt);
+ cbMsgOpt.simIndex = sim_idx;
- if (err == MSG_SUCCESS) {
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, sim_idx);
+ MsgSettingGetBool(keyName, &bAPReceive);
+
+ if (cbMsgOpt.bReceive == false && bAPReceive == false) {
+ MSG_DEBUG("CB is off in CP and in AP. No need to send CB request to CP. ");
+ }
+ else {
MSG_DEBUG("######## Add CB Option Success !!! #######");
+ MSG_SETTING_S cbSetting;
+ getCbOpt(&cbSetting, sim_idx);
+ setCbConfig(&(cbSetting.option.cbMsgOpt));
+ }
+ } else {
+ MSG_WARN("######## getCbConfig Fail !!! #######");
+
+#if 0
+ // CSC doesn't support CB Info any longer
+ if (MsgCscGetCBInfo(&cbMsgOpt) == true) {
+ err = addCbOpt(&cbMsgOpt);
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("######## Add CB Option From CSC Success !!! #######");
+ } else {
+ MSG_DEBUG("######## Add CB Option from CSC Fail !!! return : %d #######", err);
+ }
} else {
- MSG_DEBUG("######## Add CB Option Fail !!! return : %d #######", err);
+ MSG_DEBUG("######## MsgCscGetCBInfo Fail !!! #######");
}
+#endif
}
- } else if (SimStatus == MSG_SIM_STATUS_NORMAL) {
- MSG_DEBUG("simStatus == MSG_SIM_STATUS_NORMAL");
- // Set CB Data into SIM in case of same SIM
- MSG_SETTING_S cbSetting;
- cbSetting.type = MSG_CBMSG_OPT;
+ /*==================== Default Voice mail Setting ====================*/
+ if (simStatus[sim_idx] == MSG_SIM_STATUS_CHANGED) {
+ char keyName[MAX_VCONFKEY_NAME_LEN];
- getCbOpt(&cbSetting);
+ MSG_DEBUG("=================SIM CHANGED===================");
- setCbConfig(&(cbSetting.option.cbMsgOpt));
- }
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+ if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_NUMBER) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetString is failed!!");
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, sim_idx);
+ if (MsgSettingSetInt(keyName, 0) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, sim_idx);
+ if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_ALPHA_ID) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetString is failed!!");
+
+ MsgDeleteNoti(MSG_NOTI_TYPE_VOICE_1, sim_idx);
+ MsgDeleteNoti(MSG_NOTI_TYPE_VOICE_2, sim_idx);
+ }
- if (SimStatus != MSG_SIM_STATUS_NOT_FOUND)
- {
- MSG_VOICEMAIL_OPT_S tmpVoiceMail;
- memset(&tmpVoiceMail, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
- if (getVoiceMailInfo(&tmpVoiceMail) == true) {
+ /*==================== Voice mail information update ====================*/
+ if (getVoiceMailInfo(handle) == true) {
MSG_DEBUG("######## getVoiceMailInfo Success !!! #######");
} else {
- MSG_DEBUG("######## getVoiceMailInfo Fail !!! #######");
+ MSG_WARN("######## getVoiceMailInfo Fail !!! #######");
}
- if (getMwiInfo() == true) {
+ /*==================== Voice mail count update ====================*/
+ if (getMwiInfo(handle) == true) {
MSG_DEBUG("######## getMwiInfo Success !!! #######");
} else {
- MSG_DEBUG("######## getMwiInfo Fail !!! #######");
+ MSG_WARN("######## getMwiInfo Fail !!! #######");
+
+ // Get MWI from vconf and insert notification
+ int mwiCnt = 0;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, sim_idx);
+ if ((mwiCnt = MsgSettingGetInt(keyName)) > 0)
+ deliverVoiceMsgNoti(sim_idx, mwiCnt);
}
- if (getMsisdnInfo() == true) {
+ /*==================== MSISDN update ====================*/
+ if (getMsisdnInfo(handle) == true) {
MSG_DEBUG("######## getMsisdnInfo Success !!! #######");
} else {
- MSG_DEBUG("######## getMsisdnInfo Fail !!! #######");
+ MSG_WARN("######## getMsisdnInfo Fail !!! #######");
+ }
+
+ /*==================== SST(SIM Service Table) update ====================*/
+ if (getSimServiceTable(handle) == true) {
+ MSG_DEBUG("######## getSimServiceTable Success !!! #######");
+ } else {
+ MSG_WARN("######## getSimServiceTable Fail !!! #######");
}
}
@@ -180,6 +365,28 @@ void SmsPluginSetting::initConfigData(MSG_SIM_STATUS_T SimStatus)
}
+void SmsPluginSetting::SimRefreshCb(struct tapi_handle *handle)
+{
+ pthread_t thd;
+
+ if (pthread_create(&thd, NULL, &init_config_data, handle) < 0) {
+ MSG_DEBUG("pthread_create() error");
+ }
+
+ pthread_detach(thd);
+
+}
+
+
+void* SmsPluginSetting::init_config_data(void *data)
+{
+ struct tapi_handle *handle = (struct tapi_handle *)data;
+
+ instance()->initConfigData(handle);
+ return NULL;
+}
+
+
void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
{
MSG_DEBUG("Setting Type : [%d]", pSetting->type);
@@ -193,9 +400,13 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
#endif
case MSG_SMSC_LIST :
setParamList(&pSetting->option.smscList);
+ addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList));
+// setSmscInfo(&pSetting->option.smscList);
break;
case MSG_CBMSG_OPT :
- setCbConfig(&pSetting->option.cbMsgOpt);
+ if (setCbConfig(&pSetting->option.cbMsgOpt) == false) {
+ THROW(MsgException::SMS_PLG_ERROR, "Failed to set config.");
+ }
break;
case MSG_VOICEMAIL_OPT:
setVoiceMailInfo(&pSetting->option.voiceMailOpt);
@@ -214,11 +425,14 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
switch (pSetting->type)
{
case MSG_SMSC_LIST :
- getParamList(&pSetting->option.smscList);
+// getParamList(&pSetting->option.smscList);
+ getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList));
break;
case MSG_CBMSG_OPT :
- getCbConfig(&pSetting->option.cbMsgOpt);
+ if (getCbConfig(&pSetting->option.cbMsgOpt) == false) {
+ THROW(MsgException::SMS_PLG_ERROR, "Get CB config option failed.");
+ }
break;
default :
@@ -228,10 +442,13 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
}
-msg_error_t SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
+void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
{
- msg_error_t err = MSG_SUCCESS;
+ MSG_BEGIN();
+
+ int sim_index = -1;
+ MSG_DEBUG("SIM index[%d]", pSmscList->simIndex);
MSG_DEBUG("total_count[%d]", pSmscList->totalCnt);
MSG_DEBUG("selected index[%d]", pSmscList->selected);
@@ -239,81 +456,67 @@ msg_error_t SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
{
MSG_DEBUG("pid[%d]", pSmscList->smscData[i].pid);
MSG_DEBUG("val_period[%d]", pSmscList->smscData[i].valPeriod);
- MSG_DEBUG("name[%s]", pSmscList->smscData[i].name);
+ MSG_SEC_DEBUG("name[%s]", pSmscList->smscData[i].name);
MSG_DEBUG("ton[%d]", pSmscList->smscData[i].smscAddr.ton);
MSG_DEBUG("npi[%d]", pSmscList->smscData[i].smscAddr.npi);
- MSG_DEBUG("address[%s]", pSmscList->smscData[i].smscAddr.address);
+ MSG_SEC_DEBUG("address[%s]", pSmscList->smscData[i].smscAddr.address);
}
- char keyName[128];
+ sim_index = pSmscList->simIndex;
- if (MsgSettingSetInt(SMSC_TOTAL_COUNT, pSmscList->totalCnt) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", SMSC_TOTAL_COUNT);
- return MSG_ERR_SET_SETTING;
- }
-
- if (MsgSettingSetInt(SMSC_SELECTED, pSmscList->selected) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", SMSC_SELECTED);
- return MSG_ERR_SET_SETTING;
- }
+ smscList[sim_index].simIndex = pSmscList->simIndex;
+ smscList[sim_index].totalCnt = pSmscList->totalCnt;
+ smscList[sim_index].selected = pSmscList->selected;
for (int i = 0; i < pSmscList->totalCnt; i++) {
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_PID, i);
-
- if ((err = MsgSettingSetInt(keyName, (int)pSmscList->smscData[i].pid)) != MSG_SUCCESS)
- break;
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, i);
+ smscList[sim_index].smscData[i].pid = pSmscList->smscData[i].pid;
+ smscList[sim_index].smscData[i].valPeriod = pSmscList->smscData[i].valPeriod;
- if ((err = MsgSettingSetInt(keyName, (int)pSmscList->smscData[i].valPeriod)) != MSG_SUCCESS)
- break;
+ memset(smscList[sim_index].smscData[i].name, 0x00, SMSC_NAME_MAX+1);
+ memcpy(smscList[sim_index].smscData[i].name, pSmscList->smscData[i].name, SMSC_NAME_MAX);
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_NAME, i);
-
- if ((err = MsgSettingSetString(keyName, pSmscList->smscData[i].name)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_TON, i);
+ memset(smscList[sim_index].smscData[i].smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
+ memcpy(smscList[sim_index].smscData[i].smscAddr.address, pSmscList->smscData[i].smscAddr.address, SMSC_ADDR_MAX);
if (pSmscList->smscData[i].smscAddr.address[0] == '+')
- pSmscList->smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
+ smscList[sim_index].smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
else
- pSmscList->smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
-
- if ((err = MsgSettingSetInt(keyName, (int)pSmscList->smscData[i].smscAddr.ton)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_NPI, i);
+ smscList[sim_index].smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
- pSmscList->smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
+ smscList[sim_index].smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
+ }
- if ((err = MsgSettingSetInt(keyName, (int)pSmscList->smscData[i].smscAddr.npi)) != MSG_SUCCESS)
- break;
+ MSG_END();
+}
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_ADDRESS, i);
- if ((err = MsgSettingSetString(keyName, pSmscList->smscData[i].smscAddr.address)) != MSG_SUCCESS)
- break;
+void SmsPluginSetting::getSmscListInfo(int simIndex, MSG_SMSC_LIST_S *pSmscList)
+{
+ if (pSmscList == NULL) {
+ MSG_DEBUG("pSmscList is NULL!");
+ return;
}
- if (err != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", keyName);
+ if (simIndex <= 0) {
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
}
- return err;
+ if (simIndex == -1)
+ memset(pSmscList, 0x00, sizeof(MSG_SMSC_LIST_S));
+ else
+ memcpy(pSmscList, &smscList[simIndex], sizeof(MSG_SMSC_LIST_S));
+
+ return;
}
msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
{
msg_error_t err = MSG_SUCCESS;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
MSG_DEBUG("Receive [%d], Max SIM Count [%d]", pCbOpt->bReceive, pCbOpt->maxSimCnt);
@@ -324,99 +527,63 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
MSG_DEBUG("Channel FROM [%d], Channel TO [%d]", pCbOpt->channelData.channelInfo[i].from, pCbOpt->channelData.channelInfo[i].to);
}
+#if 0
// Set Setting Data into Vconf
- if (MsgSettingSetBool(CB_RECEIVE, pCbOpt->bReceive) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, pCbOpt->simIndex);
+ if (MsgSettingSetBool(keyName, pCbOpt->bReceive) != MSG_SUCCESS) {
+ MSG_DEBUG("Error to set config data [%s]", keyName);
return MSG_ERR_SET_SETTING;
}
+#endif
- if (MsgSettingSetInt(CB_MAX_SIM_COUNT, pCbOpt->maxSimCnt) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", CB_MAX_SIM_COUNT);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, pCbOpt->simIndex);
+ if (MsgSettingSetInt(keyName, pCbOpt->maxSimCnt) != MSG_SUCCESS) {
+ MSG_DEBUG("Error to set config data [%s]", keyName);
return MSG_ERR_SET_SETTING;
}
- if (MsgSettingSetInt(CB_CHANNEL_COUNT, pCbOpt->channelData.channelCnt) != MSG_SUCCESS) {
- MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT);
+#if 0
+ MsgDbHandler *dbHandle = getDbHandle();
+ err = MsgStoAddCBChannelInfo(dbHandle, &pCbOpt->channelData);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoGetCBChannelInfo is failed [%d]", err);
return MSG_ERR_SET_SETTING;
}
-
- char keyName[128];
-
- for (int i = 0; i < pCbOpt->channelData.channelCnt; i++) {
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
-
- if ((err = MsgSettingSetBool(keyName, pCbOpt->channelData.channelInfo[i].bActivate)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_FROM, i);
-
- if ((err = MsgSettingSetInt(keyName, pCbOpt->channelData.channelInfo[i].from)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_TO, i);
-
- if ((err = MsgSettingSetInt(keyName, pCbOpt->channelData.channelInfo[i].to)) != MSG_SUCCESS)
- break;
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
-
- if ((err = MsgSettingSetString(keyName, pCbOpt->channelData.channelInfo[i].name)) != MSG_SUCCESS)
- break;
- }
+#endif
return err;
}
-void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting)
+void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting, int simIndex)
{
- char keyName[128];
- char *tmpValue = NULL;
-
- memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S));
-
- MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive);
-
- pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
-
- pSetting->option.cbMsgOpt.channelData.channelCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
-
- for (int i = 0; i < pSetting->option.cbMsgOpt.channelData.channelCnt; i++) {
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ACTIVATE, i);
-
- MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.channelData.channelInfo[i].bActivate);
-
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_FROM, i);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
- pSetting->option.cbMsgOpt.channelData.channelInfo[i].from = MsgSettingGetInt(keyName);
+ msg_error_t err = MSG_SUCCESS;
+ MsgDbHandler *dbHandle = getDbHandle();
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_ID_TO, i);
+ memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S));
- pSetting->option.cbMsgOpt.channelData.channelInfo[i].to = MsgSettingGetInt(keyName);
+ pSetting->type = MSG_CBMSG_OPT;
+ pSetting->option.cbMsgOpt.simIndex = simIndex;
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_CHANNEL_NAME, i);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex);
+ MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bReceive);
- tmpValue = MsgSettingGetString(keyName);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex);
+ pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(keyName);
- if (tmpValue != NULL)
- {
- strncpy(pSetting->option.cbMsgOpt.channelData.channelInfo[i].name, tmpValue, CB_CHANNEL_NAME_MAX);
- free(tmpValue);
- tmpValue = NULL;
- }
- }
+ err = MsgStoGetCBChannelInfo(dbHandle, &pSetting->option.cbMsgOpt.channelData, simIndex);
+ if (err != MSG_SUCCESS)
+ MSG_ERR("MsgStoGetCBChannelInfo : err=[%d]", err);
for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) {
memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", CB_LANGUAGE, i);
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_LANGUAGE, i);
MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]);
}
@@ -428,72 +595,78 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
{
MSG_BEGIN();
+ MutexLocker lock(mx);
+
TelSmsParams_t smsParam = {0};
int ret = TAPI_API_SUCCESS;
- for (int index = 0; index < pSMSCList->totalCnt; index++) {
- /*Setting the SMSP Record index value*/
- smsParam.RecordIndex = (unsigned char)index;
+ int index = pSMSCList->index;
+ MSG_DEBUG("SMSC Index to be set in SIM = %d", index);
- /*Setting the SMSP Record Length value = 28 + alphaId_len*/
- smsParam.RecordLen = 28 + strlen(pSMSCList->smscData[index].name);
+ /*Setting the SMSP Record index value*/
+ smsParam.RecordIndex = (unsigned char)index;
- /*Setting the SMSP Alpha ID value*/
- smsParam.AlphaIdLen = strlen(pSMSCList->smscData[index].name);
- MSG_DEBUG("AlphaIdLen = %ld", smsParam.AlphaIdLen);
+ /*Setting the SMSP Record Length value = 28 + alphaId_len*/
+ smsParam.RecordLen = 28 + strlen(pSMSCList->smscData[index].name);
- if (smsParam.AlphaIdLen > 0 && smsParam.AlphaIdLen <= SMSC_NAME_MAX) {
- memcpy(smsParam.szAlphaId, pSMSCList->smscData[index].name, smsParam.AlphaIdLen);
- smsParam.szAlphaId[smsParam.AlphaIdLen] = '\0';
- MSG_DEBUG("szAlphaId = %s", smsParam.szAlphaId);
- }
+ /*Setting the SMSP Alpha ID value*/
+ smsParam.AlphaIdLen = strlen(pSMSCList->smscData[index].name);
+ MSG_DEBUG("AlphaIdLen = %ld", smsParam.AlphaIdLen);
- smsParam.ParamIndicator = 0x00;
+ if (smsParam.AlphaIdLen > 0 && smsParam.AlphaIdLen <= SMSC_NAME_MAX) {
+ memcpy(smsParam.szAlphaId, pSMSCList->smscData[index].name, smsParam.AlphaIdLen);
+ smsParam.szAlphaId[smsParam.AlphaIdLen] = '\0';
+ MSG_DEBUG("szAlphaId = %s", smsParam.szAlphaId);
+ }
- if (strlen(pSMSCList->smscData[index].smscAddr.address) > 0) {
- smsParam.ParamIndicator |= 0x02 ; //enable 2nd Bit
- MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
+ smsParam.ParamIndicator = 0x00;
- if (pSMSCList->smscData[index].smscAddr.address[0] == '+')
- smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_INTERNATIONAL;
- else
- smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_NATIONAL;
+ if (strlen(pSMSCList->smscData[index].smscAddr.address) > 0) {
+ smsParam.ParamIndicator |= 0x02 ; //enable 2nd Bit
+ MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
- smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+ if (pSMSCList->smscData[index].smscAddr.address[0] == '+')
+ smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_INTERNATIONAL;
+ else
+ smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_NATIONAL;
- MSG_DEBUG("SMSC TON = [%d] NPI = [%d]", smsParam.TpSvcCntrAddr.Ton, smsParam.TpSvcCntrAddr.Npi);
+ smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
- MSG_DEBUG("address = %s", pSMSCList->smscData[index].smscAddr.address);
+ MSG_DEBUG("SMSC TON = [%d] NPI = [%d]", smsParam.TpSvcCntrAddr.Ton, smsParam.TpSvcCntrAddr.Npi);
- smsParam.TpSvcCntrAddr.DialNumLen = SmsPluginParamCodec::encodeSMSC(pSMSCList->smscData[index].smscAddr.address, smsParam.TpSvcCntrAddr.szDiallingNum);
- } else {
- MSG_DEBUG("SMSC Addr is not present");
- }
+ MSG_SEC_DEBUG("address = %s", pSMSCList->smscData[index].smscAddr.address);
- /*Setting the PID value*/
- smsParam.ParamIndicator |= 0x04 ; //enable 3nd Bit
- MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
+ smsParam.TpSvcCntrAddr.DialNumLen = SmsPluginParamCodec::encodeSMSC(pSMSCList->smscData[index].smscAddr.address, smsParam.TpSvcCntrAddr.szDiallingNum);
+ } else {
+ MSG_DEBUG("SMSC Addr is not present");
+ }
- smsParam.TpProtocolId = (unsigned short)convertPid(pSMSCList->smscData[index].pid);
+ /*Setting the PID value*/
+ smsParam.ParamIndicator |= 0x04 ; //enable 3nd Bit
+ MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
- /*Setting the ValidityPeriod value*/
- smsParam.ParamIndicator |= 0x10 ; //enable 5nd Bit
- MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
+ smsParam.TpProtocolId = (unsigned short)convertPid(pSMSCList->smscData[index].pid);
- smsParam.TpValidityPeriod = (unsigned short)pSMSCList->smscData[index].valPeriod;
+ /*Setting the ValidityPeriod value*/
+ smsParam.ParamIndicator |= 0x10 ; //enable 5nd Bit
+ MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
- smsParam.ParamIndicator = ~(smsParam.ParamIndicator);
- MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
+ smsParam.TpValidityPeriod = (unsigned short)pSMSCList->smscData[index].valPeriod;
- ret = tel_set_sms_parameters(pTapiHandle, (const TelSmsParams_t*)&smsParam, TapiEventSetConfigData, NULL);
+ smsParam.ParamIndicator = ~(smsParam.ParamIndicator);
+ MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
- if (ret != TAPI_API_SUCCESS)
- THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_parameters() Error. [%d]", ret);
+ /* Get TAPI handle */
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
- if (!getResultFromSim())
- THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_parameters() Result Error.");
- }
+ ret = tel_set_sms_parameters(handle, (const TelSmsParams_t*)&smsParam, TapiEventSetConfigData, NULL);
+
+ if (ret != TAPI_API_SUCCESS)
+ THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_parameters() Error. [%d]", ret);
+
+ if (!getResultFromSim())
+ THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_parameters() Result Error.");
MSG_END();
}
@@ -505,7 +678,9 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
int paramCnt = 0;
- paramCnt = getParamCount();
+ MSG_SEC_DEBUG("SIM index [%d]", pSMSCList->simIndex);
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
+ paramCnt = getParamCount(handle);
MSG_DEBUG("Parameter Count [%d]", paramCnt);
@@ -514,7 +689,7 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
MSG_SMSC_DATA_S tmpSmscData = {};
for (int index = 0; index < paramCnt; index++) {
- ret = tel_get_sms_parameters(pTapiHandle, index, TapiEventGetParam, NULL);
+ ret = tel_get_sms_parameters(handle, index, TapiEventGetParam, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sms_parameters() Success !!! #######");
@@ -522,21 +697,21 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
THROW(MsgException::SMS_PLG_ERROR, "######## tel_get_sms_parameters() Fail !!! return : %d #######", ret);
}
- if (getParamEvent(&tmpSmscData) == true) {
+ if (getParamEvent(handle, &tmpSmscData) == true) {
MSG_DEBUG("######## Get Parameter was Successful !!! #######");
- } else {
- THROW(MsgException::SMS_PLG_ERROR, "######## Get Parameter was Failed !!! #######");
- }
- memcpy(&(pSMSCList->smscData[index]), &tmpSmscData, sizeof(MSG_SMSC_DATA_S));
+ memcpy(&(pSMSCList->smscData[index]), &tmpSmscData, sizeof(MSG_SMSC_DATA_S));
- MSG_DEBUG("pid[%d]", pSMSCList->smscData[index].pid);
- MSG_DEBUG("val_period[%d]", pSMSCList->smscData[index].valPeriod);
- MSG_DEBUG("name[%s]", pSMSCList->smscData[index].name);
+ MSG_DEBUG("pid[%d]", pSMSCList->smscData[index].pid);
+ MSG_DEBUG("val_period[%d]", pSMSCList->smscData[index].valPeriod);
+ MSG_SEC_DEBUG("name[%s]", pSMSCList->smscData[index].name);
- MSG_DEBUG("ton[%d]", pSMSCList->smscData[index].smscAddr.ton);
- MSG_DEBUG("npi[%d]", pSMSCList->smscData[index].smscAddr.npi);
- MSG_DEBUG("address[%s]", pSMSCList->smscData[index].smscAddr.address);
+ MSG_DEBUG("ton[%d]", pSMSCList->smscData[index].smscAddr.ton);
+ MSG_DEBUG("npi[%d]", pSMSCList->smscData[index].smscAddr.npi);
+ MSG_SEC_DEBUG("address[%s]", pSMSCList->smscData[index].smscAddr.address);
+ } else {
+ MSG_DEBUG("######## Get Parameter was Failed !!! #######");
+ }
}
pSMSCList->totalCnt = paramCnt;
@@ -548,11 +723,11 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
}
-int SmsPluginSetting::getParamCount()
+int SmsPluginSetting::getParamCount(struct tapi_handle *handle)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sms_parameter_count(pTapiHandle, TapiEventGetParamCnt, NULL);
+ ret = tel_get_sms_parameter_count(handle, TapiEventGetParamCnt, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sms_parameter_count() Success !!! #######");
@@ -564,23 +739,23 @@ int SmsPluginSetting::getParamCount()
}
-bool SmsPluginSetting::getParam(int Index, MSG_SMSC_DATA_S *pSmscData)
+bool SmsPluginSetting::getParam(struct tapi_handle *handle, int Index, MSG_SMSC_DATA_S *pSmscData)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sms_parameters(pTapiHandle, Index, TapiEventGetParam, NULL);
+ ret = tel_get_sms_parameters(handle, Index, TapiEventGetParam, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sms_parameters() Success !!! #######");
} else {
- MSG_DEBUG("######## tel_get_sms_parameters() Fail !!! return : %d #######", ret);
+ MSG_ERR("######## tel_get_sms_parameters() Fail !!! return : %d #######", ret);
return false;
}
- if (getParamEvent(pSmscData) == true) {
+ if (getParamEvent(handle, pSmscData) == true) {
MSG_DEBUG("######## Get Parameter was Successful !!! #######");
} else {
- MSG_DEBUG("######## Get Parameter was Failed !!! #######");
+ MSG_ERR("######## Get Parameter was Failed !!! #######");
return false;
}
@@ -588,40 +763,172 @@ bool SmsPluginSetting::getParam(int Index, MSG_SMSC_DATA_S *pSmscData)
}
-bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
+void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList)
{
+ MSG_BEGIN();
+
+ MutexLocker lock(mx);
+
int ret = TAPI_API_SUCCESS;
- TelSmsCbConfig_t cbConfig = {};
+ struct tapi_handle *handle = NULL;
- cbConfig.CBEnabled = (int)pCbOpt->bReceive;
- cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
- cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt;
- cbConfig.MsgIdRangeCount = pCbOpt->channelData.channelCnt;
+ handle = SmsPluginDSHandler::instance()->getTelHandle(pSmscList->simIndex);
- for (int i = 0; i < cbConfig.MsgIdRangeCount; i++) {
- cbConfig.MsgIDs[i].Net3gpp.Selected = (unsigned short)pCbOpt->channelData.channelInfo[i].bActivate;
- cbConfig.MsgIDs[i].Net3gpp.FromMsgId = (unsigned short)pCbOpt->channelData.channelInfo[i].from;
- cbConfig.MsgIDs[i].Net3gpp.ToMsgId = (unsigned short)pCbOpt->channelData.channelInfo[i].to;
+ int select_id = pSmscList->selected;
+ const MSG_SMSC_DATA_S *pSmscData = (const MSG_SMSC_DATA_S *)&(pSmscList->smscData[select_id]);
- MSG_DEBUG("FROM: %d, TO: %d", cbConfig.MsgIDs[i].Net3gpp.FromMsgId, cbConfig.MsgIDs[i].Net3gpp.ToMsgId);
- }
- MSG_DEBUG("CBEnabled: %d, range_count: %d", cbConfig.CBEnabled, cbConfig.MsgIdRangeCount);
+ MSG_DEBUG("Select SMSC id = [%d]", select_id);
- ret = tel_set_sms_cb_config(pTapiHandle, &cbConfig, TapiEventSetConfigData, NULL);
+ TelSmsAddressInfo_t sca;
+ memset(&sca, 0x00, sizeof(TelSmsAddressInfo_t));
- if (ret == TAPI_API_SUCCESS) {
- MSG_DEBUG("######## tel_set_sms_cb_config() Success !!! #######");
+ if (strlen(pSmscData->smscAddr.address) > 0) {
+
+ if (pSmscData->smscAddr.address[0] == '+')
+ sca.Ton = TAPI_SIM_TON_INTERNATIONAL;
+ else
+ sca.Ton = TAPI_SIM_TON_NATIONAL;
+
+ sca.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+
+ MSG_SEC_DEBUG("SMSC TON = [%d], NPI = [%d], Address = [%s]", sca.Ton, sca.Npi, pSmscData->smscAddr.address);
+
+ sca.DialNumLen = SmsPluginParamCodec::encodeSMSC(pSmscData->smscAddr.address, sca.szDiallingNum);
} else {
- MSG_DEBUG("######## tel_set_sms_cb_config() Fail !!! return : %d #######", ret);
- return false;
+ MSG_DEBUG("SMSC Addr is not present");
}
- if (getResultFromSim() == true) {
- MSG_DEBUG("######## Set Cb Config was Successful !!! #######");
+ ret = tel_set_sms_sca(handle, (const TelSmsAddressInfo_t *)&sca, 0, TapiEventSetSmscInfo, NULL);
+
+ if (ret != TAPI_API_SUCCESS)
+ THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_sca() Error. [%d]", ret);
+
+ if (!getResultFromSim())
+ THROW(MsgException::SMS_PLG_ERROR, "tel_set_sms_sca() Result Error.");
+
+ MSG_END();
+}
+
+
+bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
+{
+ struct tapi_handle *handle = NULL;
+ int simCnt = SmsPluginDSHandler::instance()->getTelHandleCount();
+
+ TelSmsCbConfig_t cbConfig = {};
+
+ int cbEnabled = 0;
+ int ret = TAPI_API_SUCCESS;
+
+ if (pCbOpt->bReceive == true)
+ cbEnabled = 2;// Need to get a Enumeration from TAPI, currently it is not available
+
+ MSG_DEBUG("simIndex:%d, cbEnabled:%d", pCbOpt->simIndex, cbEnabled);
+
+ if (pCbOpt->simIndex == 0) {
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NOT_FOUND;
+
+ for (int i = 1; i <= simCnt; i++) {
+ MutexLocker lock(mx);
+
+ //if (i == pCbOpt->simIndex)
+ // continue;
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, i);
+ simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
+
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
+ MSG_DEBUG("SIM %d is not present..", i);
+ continue;
+ }
+
+ handle = SmsPluginDSHandler::instance()->getTelHandle(i);
+ memset(&cbConfig, 0x00, sizeof(TelSmsCbConfig_t));
+
+ MSG_SETTING_S cbSetting;
+ getCbOpt(&cbSetting, i);
+
+ cbConfig.CBEnabled = cbEnabled;
+ cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
+
+ /*cbConfig.CBEnabled = (int)pCbOpt->bReceive;
+ cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
+ cbConfig.MsgIdMaxCount = cbSetting.option.cbMsgOpt.maxSimCnt;
+ cbConfig.MsgIdRangeCount = cbSetting.option.cbMsgOpt.channelData.channelCnt;
+
+ for (int i = 0; i < cbConfig.MsgIdRangeCount; i++) {
+ cbConfig.MsgIDs[i].Net3gpp.Selected = (unsigned short)cbSetting.option.cbMsgOpt.channelData.channelInfo[i].bActivate;
+ cbConfig.MsgIDs[i].Net3gpp.FromMsgId = (unsigned short)cbSetting.option.cbMsgOpt.channelData.channelInfo[i].from;
+ cbConfig.MsgIDs[i].Net3gpp.ToMsgId = (unsigned short)cbSetting.option.cbMsgOpt.channelData.channelInfo[i].to;
+ }*/
+
+ ret = tel_set_sms_cb_config(handle, &cbConfig, TapiEventSetConfigData, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_set_sms_cb_config() Success !!! #######");
+ } else {
+ MSG_ERR("######## tel_set_sms_cb_config() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getResultFromSim() == true) {
+ MSG_DEBUG("######## Set Cb Config was Successful !!! #######");
+ } else {
+ MSG_ERR("######## Set Cb Config was Failed !!! #######");
+ return false;
+ }
+
+ msg_error_t err = MSG_SUCCESS;
+ MsgDbHandler *dbHandle = getDbHandle();
+ err = MsgStoAddCBChannelInfo(dbHandle, const_cast<MSG_CB_CHANNEL_S*>(&pCbOpt->channelData),i);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoAddCBChannelInfo is failed [%d]", err);
+ return MSG_ERR_SET_SETTING;
+ }
+ }
+
+ MSG_DEBUG("SIM Index = [0], Set CB Receive is done");
+ return true;
} else {
- MSG_DEBUG("######## Set Cb Config was Failed !!! #######");
- return false;
+ MutexLocker lock(mx);
+
+ handle = SmsPluginDSHandler::instance()->getTelHandle(pCbOpt->simIndex);
+
+ memset(&cbConfig, 0x00, sizeof(TelSmsCbConfig_t));
+ cbConfig.CBEnabled = cbEnabled;
+ cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
+ /* cbConfig.CBEnabled = (int)pCbOpt->bReceive;
+ cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
+ cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt;
+ cbConfig.MsgIdRangeCount = pCbOpt->channelData.channelCnt;
+
+ for (int i = 0; i < cbConfig.MsgIdRangeCount; i++) {
+ cbConfig.MsgIDs[i].Net3gpp.Selected = (unsigned short)pCbOpt->channelData.channelInfo[i].bActivate;
+ cbConfig.MsgIDs[i].Net3gpp.FromMsgId = (unsigned short)pCbOpt->channelData.channelInfo[i].from;
+ cbConfig.MsgIDs[i].Net3gpp.ToMsgId = (unsigned short)pCbOpt->channelData.channelInfo[i].to;
+
+ MSG_DEBUG("FROM: %d, TO: %d", cbConfig.MsgIDs[i].Net3gpp.FromMsgId, cbConfig.MsgIDs[i].Net3gpp.ToMsgId);
+ }
+ MSG_DEBUG("CBEnabled: %d, range_count: %d", cbConfig.CBEnabled, cbConfig.MsgIdRangeCount);*/
+
+ ret = tel_set_sms_cb_config(handle, &cbConfig, TapiEventSetConfigData, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_set_sms_cb_config() Success !!! #######");
+ } else {
+ MSG_ERR("######## tel_set_sms_cb_config() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getResultFromSim() == true) {
+ MSG_DEBUG("######## Set Cb Config was Successful !!! #######");
+ } else {
+ MSG_ERR("######## Set Cb Config was Failed !!! #######");
+ return false;
+ }
}
return true;
@@ -632,138 +939,296 @@ bool SmsPluginSetting::getCbConfig(MSG_CBMSG_OPT_S *pCbOpt)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sms_cb_config(pTapiHandle, TapiEventGetCBConfig, NULL);
+ struct tapi_handle *handle = NULL;
+
+ if (pCbOpt->simIndex == 0) {
+ MSG_DEBUG("SIM Index for getCBConfig = 0, CANNOT get cbconfig from SIM 0");
+ return false;
+ }
+
+ handle = SmsPluginDSHandler::instance()->getTelHandle(pCbOpt->simIndex);
+
+ ret = tel_get_sms_cb_config(handle, TapiEventGetCBConfig, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sms_cb_config() Success !!! #######");
} else {
- MSG_DEBUG("######## tel_get_sms_cb_config() Fail !!! return : %d #######", ret);
+ MSG_ERR("######## tel_get_sms_cb_config() Fail !!! return : %d #######", ret);
return false;
}
if (getCbConfigEvent(pCbOpt) == true) {
MSG_DEBUG("######## Get Cb Config was Successful !!! #######");
} else {
- MSG_DEBUG("######## Get Cb Config was Failed !!! #######");
+ MSG_ERR("######## Get Cb Config was Failed !!! #######");
return false;
}
return true;
}
+
void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
{
+ MutexLocker lock(mx);
+
int ret = TAPI_API_SUCCESS;
+ bool *bShowError = NULL; //When invalid voicemail data exists on SIM, update error should not be handled.
+
+ int simIndex = pVoiceOpt->simIndex;
+
+ if (bMbdnEnable[simIndex] == false) {
+ MSG_DEBUG("MBDN service is disable.");
+ return;
+ }
TelSimMailBoxNumber_t mailboxInfo = {0,};
+ bool bExistVoicetype = false;
+ int i = 0;
- for (int i = 0; i < simMailboxList.count; i++) {
- if (simMailboxList.list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
- memset(&simMailboxList.list[i].num, 0x00, sizeof(simMailboxList.list[i].num));
- snprintf(simMailboxList.list[i].num, sizeof(simMailboxList.list[i].num), "%s", pVoiceOpt->mailNumber);
- MSG_DEBUG("Mailbox number config [%s]", simMailboxList.list[i].num);
-
- mailboxInfo.b_cphs = simMailboxList.list[i].b_cphs;
- mailboxInfo.alpha_id_max_len = simMailboxList.list[i].alpha_id_max_len;
- mailboxInfo.mb_type = (TelSimMailboxType_t)simMailboxList.list[i].mb_type;
- mailboxInfo.profile_num = simMailboxList.list[i].profile_num;
- mailboxInfo.rec_index = simMailboxList.list[i].rec_index;
- mailboxInfo.ton = (TelSimTypeOfNum_t)simMailboxList.list[i].ton;
- mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)simMailboxList.list[i].npi;
- snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", simMailboxList.list[i].alpha_id);
- snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", simMailboxList.list[i].num);
- mailboxInfo.cc_id = simMailboxList.list[i].cc_id;
- mailboxInfo.ext1_id = simMailboxList.list[i].ext1_id;
+ if (simMailboxList[simIndex].count < 0) { /* Not available */
+ return;
+ }
- break;
+ bShowError = (bool*)calloc(1, sizeof(bool));
+ if (!bShowError)
+ return;
+
+ if (simMailboxList[simIndex].count == 0) {
+ char num[MAX_PHONE_NUMBER_LEN + 1] = {0,};
+
+ mailboxInfo.mb_type = TAPI_SIM_MAILBOX_VOICE;
+ mailboxInfo.rec_index = 1;
+ mailboxInfo.ton = TAPI_SIM_TON_UNKNOWN;
+
+ snprintf(num, sizeof(num), "%s", pVoiceOpt->mailNumber);
+ MSG_DEBUG("Mailbox number config [%s]", num);
+
+ if (num[0] == '+') {
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", &(num[1]));
+ mailboxInfo.ton = TAPI_SIM_TON_INTERNATIONAL;
+ } else {
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", num);
+ }
+
+ MSG_SEC_DEBUG("Mailbox number to save sim [%s]", mailboxInfo.num);
+
+ *bShowError = false;
+
+ } else {
+ for (i = 0; i < simMailboxList[simIndex].count; i++) {
+ if (simMailboxList[simIndex].list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+ bExistVoicetype = true;
+ break;
+ }
}
+
+ if (bExistVoicetype == false) {
+ *bShowError = false;
+ /* There is no mailbox information for voicemail type on SIM. */
+ for (i = 0; i < simMailboxList[simIndex].count; i++) {
+ if (simMailboxList[simIndex].list[i].mb_type < TAPI_SIM_MAILBOX_VOICE || simMailboxList[simIndex].list[i].mb_type > TAPI_SIM_MAILBOX_OTHER) {
+ simMailboxList[simIndex].list[i].mb_type = TAPI_SIM_MAILBOX_VOICE;
+ break;
+ }
+ }
+ }
+
+ /* if strlen of voicemail number retrieved from SIM is zero, error is not shown */
+ if(simMailboxList[simIndex].list[i].num_len == 0) {
+ MSG_DEBUG("In SIM voicemail does not exist");
+ *bShowError = false;
+ }
+
+ MSG_INFO("bShowError = %d", *bShowError);
+
+ memset(&simMailboxList[simIndex].list[i].num, 0x00, sizeof(simMailboxList[simIndex].list[i].num));
+ snprintf(simMailboxList[simIndex].list[i].num, sizeof(simMailboxList[simIndex].list[i].num), "%s", pVoiceOpt->mailNumber);
+ MSG_DEBUG("Mailbox number config [%s]", simMailboxList[simIndex].list[i].num);
+
+ mailboxInfo.b_cphs = simMailboxList[simIndex].list[i].b_cphs;
+ mailboxInfo.alpha_id_max_len = simMailboxList[simIndex].list[i].alpha_id_max_len;
+ mailboxInfo.mb_type = (TelSimMailboxType_t)simMailboxList[simIndex].list[i].mb_type;
+ mailboxInfo.profile_num = simMailboxList[simIndex].list[i].profile_num;
+ mailboxInfo.rec_index = (simMailboxList[simIndex].list[i].rec_index == 0) ? 1 : simMailboxList[simIndex].list[i].rec_index;
+ mailboxInfo.ton = (TelSimTypeOfNum_t)simMailboxList[simIndex].list[i].ton;
+ mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)simMailboxList[simIndex].list[i].npi;
+ snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", simMailboxList[simIndex].list[i].alpha_id);
+
+ if (simMailboxList[simIndex].list[i].num[0] == '+') {
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", &(simMailboxList[simIndex].list[i].num[1]));
+ mailboxInfo.ton = TAPI_SIM_TON_INTERNATIONAL;
+ } else {
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", simMailboxList[simIndex].list[i].num);
+ }
+ MSG_DEBUG("Mailbox number to save sim [%s]", mailboxInfo.num);
+
+ mailboxInfo.cc_id = simMailboxList[simIndex].list[i].cc_id;
+ mailboxInfo.ext1_id = simMailboxList[simIndex].list[i].ext1_id;
}
- ret = tel_set_sim_mailbox_info(pTapiHandle, &mailboxInfo, TapiEventSetMailboxInfo, NULL);
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+
+ ret = tel_set_sim_mailbox_info(handle, &mailboxInfo, TapiEventSetMailboxInfo, (void*)bShowError);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_set_sim_mailbox_info() Success !!! #######");
} else {
- MSG_DEBUG("######## tel_set_sim_mailbox_info() Fail !!! return : %d #######", ret);
+ MSG_ERR("######## tel_set_sim_mailbox_info() Fail !!! return : %d #######", ret);
}
if (getResultFromSim() == true) {
MSG_DEBUG("######## Set mailbox info Success !!! #######");
} else {
+ if(bShowError)
+ free(bShowError);
THROW(MsgException::SMS_PLG_ERROR, "######## Set mailbox info Failed !!!#######");
+ MSG_ERR("######## Set mailbox info Failed !!! #######");
}
+ if(bShowError)
+ free(bShowError);
+
return;
}
-bool SmsPluginSetting::getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+
+bool SmsPluginSetting::getVoiceMailInfo(struct tapi_handle *handle)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sim_mailbox_info(pTapiHandle, TapiEventGetMailboxInfo, NULL);
+ ret = tel_get_sim_mailbox_info(handle, TapiEventGetMailboxInfo, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sim_mailbox_info() Success !!! #######");
} else {
- MSG_DEBUG("######## tel_get_sim_mailbox_info() Fail !!! return : %d #######", ret);
+ MSG_ERR("######## tel_get_sim_mailbox_info() Fail !!! return : %d #######", ret);
return false;
}
- if (getMailboxInfoEvent(pVoiceOpt) == true) {
- MSG_DEBUG("######## Get MWI info was Successful !!! #######");
+ if (getMailboxInfoEvent() == true) {
+ MSG_DEBUG("######## Get mailbox info was Successful !!! #######");
} else {
- MSG_DEBUG("######## Get MWI info was Failed !!! #######");
+ MSG_ERR("######## Get mailbox info was Failed !!! #######");
return false;
}
return true;
}
-void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
+
+void SmsPluginSetting::getMeImei(char *pImei)
{
- if (type < MSG_MWI_VOICE_SMS || type > MSG_MWI_OTHER_SMS) {
- MSG_DEBUG("Invalid parameter");
+ int ret = TAPI_API_SUCCESS;
+
+ struct tapi_handle *handle = NULL;
+ handle = SmsPluginDSHandler::instance()->getTelHandle(1);
+
+ if (handle == NULL) {
+ MSG_DEBUG("Tapi Handle is NULL!");
return;
}
- int ret = TAPI_API_SUCCESS;
+ ret = tel_get_misc_me_imei(handle, TapiEventGetMeImei, NULL);
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_SEC_DEBUG("######## tel_get_misc_me_imei() Success !!! #######");
+
+ if (getResultImei(pImei) == true) {
+ MSG_SEC_DEBUG("######## Get ME IMEI was Successful !!! #######");
+ } else {
+ MSG_SEC_DEBUG("######## Get ME IMEI was Failed !!! #######");
+ }
+ } else {
+ MSG_SEC_DEBUG("######## tel_get_misc_me_imei() Fail !!! return : %d #######", ret);
+ }
+}
+
+
+void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
+{
+ MSG_DEBUG("SET MWI INFO, type=[%d]", type);
+ MSG_DEBUG("SET MWI INFO, count=[%d]", count);
+
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, simIndex);
+
+ if (MsgSettingSetInt(keyName, count) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
+
+ if (count <= 0) {
+ if (type == MSG_MWI_VOICE_SMS)
+ MsgDeleteNoti(MSG_NOTI_TYPE_VOICE_1, simIndex);
+ else if (type == MSG_MWI_VOICE2_SMS)
+ MsgDeleteNoti(MSG_NOTI_TYPE_VOICE_2, simIndex);
+ }
+
+ if (bMbdnEnable[simIndex] == false) {
+ MSG_DEBUG("MBDN service is disable.");
+ return;
+ }
+
+ int ret = TAPI_API_SUCCESS;
TelSimMessageWaitingReq_t mwReq = {0,};
- if (simMwiInfo.b_cphs) {
+ MSG_DEBUG("SET MWI INFO, CPHS? [%s]", simMwiInfo[simIndex].b_cphs?"Yes":"No");
+
+ if (simMwiInfo[simIndex].b_cphs) {
if (type == MSG_MWI_VOICE_SMS)
- simMwiInfo.cphs_mwi.b_voice1 = true;
+ simMwiInfo[simIndex].cphs_mwi.b_voice1 = (count > 0 ? 1:0);
+ else if (type == MSG_MWI_VOICE2_SMS)
+ simMwiInfo[simIndex].cphs_mwi.b_voice2 = (count > 0 ? 1:0);
else if (type == MSG_MWI_FAX_SMS)
- simMwiInfo.cphs_mwi.b_fax = true;
- else
+ simMwiInfo[simIndex].cphs_mwi.b_fax = (count > 0 ? 1:0);
+ else {
MSG_DEBUG("There is no type [%d] in CPHS.", type);
+ return;
+ }
+
+ mwReq.mw_data_u.cphs_mw.b_voice1 = simMwiInfo[simIndex].cphs_mwi.b_voice1;
+ mwReq.mw_data_u.cphs_mw.b_voice2 = simMwiInfo[simIndex].cphs_mwi.b_voice2;
+ mwReq.mw_data_u.cphs_mw.b_fax = simMwiInfo[simIndex].cphs_mwi.b_fax;
+ mwReq.mw_data_u.cphs_mw.b_data = simMwiInfo[simIndex].cphs_mwi.b_data;
+
+ MSG_DEBUG("MWI voice 1 = [%d]", mwReq.mw_data_u.cphs_mw.b_voice1);
+ MSG_DEBUG("MWI voice 2 = [%d]", mwReq.mw_data_u.cphs_mw.b_voice2);
+ MSG_DEBUG("MWI fax = [%d]", mwReq.mw_data_u.cphs_mw.b_fax);
+ MSG_DEBUG("MWI data = [%d]", mwReq.mw_data_u.cphs_mw.b_data);
- mwReq.mw_data_u.cphs_mw.b_voice1 = simMwiInfo.cphs_mwi.b_voice1;
- mwReq.mw_data_u.cphs_mw.b_voice2 = simMwiInfo.cphs_mwi.b_voice2;
- mwReq.mw_data_u.cphs_mw.b_fax = simMwiInfo.cphs_mwi.b_fax;
- mwReq.mw_data_u.cphs_mw.b_data = simMwiInfo.cphs_mwi.b_data;
} else {
if (type == MSG_MWI_VOICE_SMS)
- simMwiInfo.mwi_list.mw_info[0].voice_count = count;
+ simMwiInfo[simIndex].mwi_list.mw_info[0].voice_count = count;
else if (type == MSG_MWI_FAX_SMS)
- simMwiInfo.mwi_list.mw_info[0].fax_count = count;
+ simMwiInfo[simIndex].mwi_list.mw_info[0].fax_count = count;
else if (type == MSG_MWI_EMAIL_SMS)
- simMwiInfo.mwi_list.mw_info[0].email_count = count;
+ simMwiInfo[simIndex].mwi_list.mw_info[0].email_count = count;
else // MSG_MWI_OTHER_SMS
- simMwiInfo.mwi_list.mw_info[0].other_count = count;
-
- mwReq.mw_data_u.mw.rec_index = simMwiInfo.mwi_list.mw_info[0].rec_index;
- mwReq.mw_data_u.mw.indicator_status = simMwiInfo.mwi_list.mw_info[0].indicator_status;
- mwReq.mw_data_u.mw.voice_count = simMwiInfo.mwi_list.mw_info[0].voice_count;
- mwReq.mw_data_u.mw.fax_count = simMwiInfo.mwi_list.mw_info[0].fax_count;
- mwReq.mw_data_u.mw.email_count = simMwiInfo.mwi_list.mw_info[0].email_count;
- mwReq.mw_data_u.mw.other_count = simMwiInfo.mwi_list.mw_info[0].other_count;
- mwReq.mw_data_u.mw.video_count = simMwiInfo.mwi_list.mw_info[0].video_count;
+ simMwiInfo[simIndex].mwi_list.mw_info[0].other_count = count;
+
+ mwReq.mw_data_u.mw.rec_index = simMwiInfo[simIndex].mwi_list.mw_info[0].rec_index;
+ mwReq.mw_data_u.mw.indicator_status = simMwiInfo[simIndex].mwi_list.mw_info[0].indicator_status;
+ mwReq.mw_data_u.mw.voice_count = simMwiInfo[simIndex].mwi_list.mw_info[0].voice_count;
+ mwReq.mw_data_u.mw.fax_count = simMwiInfo[simIndex].mwi_list.mw_info[0].fax_count;
+ mwReq.mw_data_u.mw.email_count = simMwiInfo[simIndex].mwi_list.mw_info[0].email_count;
+ mwReq.mw_data_u.mw.other_count = simMwiInfo[simIndex].mwi_list.mw_info[0].other_count;
+ mwReq.mw_data_u.mw.video_count = simMwiInfo[simIndex].mwi_list.mw_info[0].video_count;
+
+ MSG_DEBUG("MWI record index = [%d]", mwReq.mw_data_u.mw.rec_index);
+ MSG_DEBUG("MWI ind status = [%d]", mwReq.mw_data_u.mw.indicator_status);
+ MSG_DEBUG("MWI voice = [%d]", mwReq.mw_data_u.mw.voice_count);
+ MSG_DEBUG("MWI fax = [%d]", mwReq.mw_data_u.mw.fax_count);
+ MSG_DEBUG("MWI email = [%d]", mwReq.mw_data_u.mw.email_count);
+ MSG_DEBUG("MWI other = [%d]", mwReq.mw_data_u.mw.other_count);
+ MSG_DEBUG("MWI video = [%d]", mwReq.mw_data_u.mw.video_count);
}
- mwReq.b_cphs = simMwiInfo.b_cphs;
+ mwReq.b_cphs = simMwiInfo[simIndex].b_cphs;
- ret = tel_set_sim_messagewaiting_info(pTapiHandle, &mwReq, TapiEventSetMwiInfo, NULL);
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+
+ ret = tel_set_sim_messagewaiting_info(handle, &mwReq, TapiEventSetMwiInfo, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Success !!! #######");
@@ -775,11 +1240,13 @@ void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
}
-bool SmsPluginSetting::getMwiInfo(void)
+bool SmsPluginSetting::getMwiInfo(struct tapi_handle *handle)
{
+ MutexLocker lock(mx);
+
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sim_messagewaiting_info(pTapiHandle, TapiEventGetMwiInfo, NULL);
+ ret = tel_get_sim_messagewaiting_info(handle, TapiEventGetMwiInfo, NULL);
if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_get_sim_messagewaiting_info() Success !!! #######");
@@ -799,22 +1266,55 @@ bool SmsPluginSetting::getMwiInfo(void)
}
-bool SmsPluginSetting::getMsisdnInfo(void)
+bool SmsPluginSetting::getMsisdnInfo(struct tapi_handle *handle)
{
+ MutexLocker lock(mx);
+
int ret = TAPI_API_SUCCESS;
- bool result = true;
- ret = tel_get_sim_msisdn(pTapiHandle, TapiEventGetMsisdnInfo, NULL);
+ ret = tel_get_sim_msisdn(handle, TapiEventGetMsisdnInfo, NULL);
if (ret == TAPI_API_SUCCESS) {
- result = true;
MSG_DEBUG("######## tel_get_sim_msisdn() Success !!! #######");
} else {
- result = false;
MSG_DEBUG("######## tel_get_sim_msisdn() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getResultFromSim() == true) {
+ MSG_DEBUG("######## Get Sim msisdn was Successful !!! #######");
+ } else {
+ MSG_DEBUG("######## Get Sim msisdn was Failed !!! #######");
+ return false;
}
- return result;
+ return true;
+}
+
+
+bool SmsPluginSetting::getSimServiceTable(struct tapi_handle *handle)
+{
+ MutexLocker lock(mx);
+
+ int ret = TAPI_API_SUCCESS;
+
+ ret = tel_get_sim_service_table(handle, TapiEventGetSimServiceTable, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_get_sim_service_table() Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_get_sim_service_table() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getResultFromSim() == true) {
+ MSG_DEBUG("######## Get SST info was Successful !!! #######");
+ } else {
+ MSG_DEBUG("######## Get SST info was Failed !!! #######");
+ return false;
+ }
+
+ return true;
}
@@ -836,12 +1336,12 @@ int SmsPluginSetting::getParamCntEvent()
mx.lock();
- ret = cv.timedwait(mx.pMutex(), 10);
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
mx.unlock();
if (ret == ETIMEDOUT) {
- MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+ MSG_ERR("WARNING: TAPI callback TIME-OUT");
return 0;
}
@@ -849,20 +1349,22 @@ int SmsPluginSetting::getParamCntEvent()
}
-void SmsPluginSetting::setParamEvent(const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess)
+void SmsPluginSetting::setParamEvent(struct tapi_handle *handle, const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess)
{
mx.lock();
bTapiResult = bSuccess;
- memset(&smscData, 0x00, sizeof(MSG_SMSC_DATA_S));
+ int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ memset(&smscData[sim_idx], 0x00, sizeof(MSG_SMSC_DATA_S));
if (bTapiResult == true) {
MSG_DEBUG("Success to get parameter data");
selectedParam = RecordIdx;
- memcpy(&smscData, pSmscData, sizeof(MSG_SMSC_DATA_S));
+ memcpy(&smscData[sim_idx], pSmscData, sizeof(MSG_SMSC_DATA_S));
}
cv.signal();
@@ -871,14 +1373,14 @@ void SmsPluginSetting::setParamEvent(const MSG_SMSC_DATA_S *pSmscData, int Recor
}
-bool SmsPluginSetting::getParamEvent(MSG_SMSC_DATA_S *pSmscData)
+bool SmsPluginSetting::getParamEvent(struct tapi_handle *handle, MSG_SMSC_DATA_S *pSmscData)
{
int ret = 0;
mx.lock();
bTapiResult = false;
- ret = cv.timedwait(mx.pMutex(), 10);
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
mx.unlock();
@@ -890,25 +1392,35 @@ bool SmsPluginSetting::getParamEvent(MSG_SMSC_DATA_S *pSmscData)
memset(pSmscData, 0x00, sizeof(MSG_SMSC_DATA_S));
if (bTapiResult == true) {
- memcpy(pSmscData, &smscData, sizeof(MSG_SMSC_DATA_S));
+ int index = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ memcpy(pSmscData, &smscData[index], sizeof(MSG_SMSC_DATA_S));
}
return bTapiResult;
}
-void SmsPluginSetting::setCbConfigEvent(const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess)
+void SmsPluginSetting::setCbConfigEvent(struct tapi_handle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess)
{
mx.lock();
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+
bTapiResult = bSuccess;
- memset(&cbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ memset(&cbOpt[simIndex], 0x00, sizeof(MSG_CBMSG_OPT_S));
if (bTapiResult == true) {
MSG_DEBUG("Success to get cb config data");
- memcpy(&cbOpt, pCbOpt, sizeof(MSG_CBMSG_OPT_S));
+ memcpy(&cbOpt[simIndex], pCbOpt, sizeof(MSG_CBMSG_OPT_S));
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex);
+ if (MsgSettingSetInt(keyName, pCbOpt->maxSimCnt) != MSG_SUCCESS) {
+ MSG_DEBUG("Error to set config data [%s]", keyName);
+ }
}
cv.signal();
@@ -924,7 +1436,7 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
mx.lock();
bTapiResult = false;
- ret = cv.timedwait(mx.pMutex(), 10);
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
mx.unlock();
@@ -933,51 +1445,102 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
return false;
}
+ int simIndex = pCbOpt->simIndex;
+
memset(pCbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
if (bTapiResult == true) {
- memcpy(pCbOpt, &cbOpt, sizeof(MSG_CBMSG_OPT_S));
+ memcpy(pCbOpt, &cbOpt[simIndex], sizeof(MSG_CBMSG_OPT_S));
}
return bTapiResult;
}
-void SmsPluginSetting::setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess)
+void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess, bool bMbdn)
{
mx.lock();
bTapiResult = bSuccess;
- memset(&simMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ bMbdnEnable[simIndex] = bMbdn;
+
+ memset(&simMailboxList[simIndex], 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
if (bTapiResult == true) {
int i = 0;
+ bool bExistMailboxType = false;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
if (pMailboxList && pMailboxList->count > 0) {
- memcpy(&simMailboxList, pMailboxList, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ memcpy(&simMailboxList[simIndex], pMailboxList, sizeof(SMS_SIM_MAILBOX_LIST_S));
/* Temp :: Save voicemail number with VOICE1 line number */
for (i = 0; i < pMailboxList->count ; i++) {
- MSG_DEBUG("Mailbox list[%d] type=[%d] address = [%s]", i, pMailboxList->list[i].mb_type, pMailboxList->list[i].num);
+ MSG_SEC_DEBUG("Mailbox list[%d] type=[%d]", i, pMailboxList->list[i].mb_type);
+
if (pMailboxList->list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
- char mailNumber[MAX_PHONE_NUMBER_LEN+1];
- memset(mailNumber, 0x00 , sizeof(mailNumber));
- if (simMailboxList.list[i].ton == MSG_TON_INTERNATIONAL && simMailboxList.list[i].num[0] != '+') {
- snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "+%s", simMailboxList.list[i].num);
- MSG_DEBUG("MSG_TON_INTERNATIONAL [%s]", mailNumber);
- } else {
- snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "%s", simMailboxList.list[i].num);
- MSG_DEBUG("[%s]", mailNumber);
- }
+ bExistMailboxType = true;
+ break;
+ }
+ }
- if (mailNumber[0] != '\0') {
- if (MsgSettingSetString(VOICEMAIL_NUMBER, mailNumber) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetString is failed!!");
+ if (bExistMailboxType == false) {
+ MSG_DEBUG("There is no voice mailbox type.");
+ for (i = 0; i < simMailboxList[simIndex].count; i++) {
+ if (pMailboxList->list[i].mb_type < TAPI_SIM_MAILBOX_VOICE || pMailboxList->list[i].mb_type > TAPI_SIM_MAILBOX_OTHER) {
+ pMailboxList->list[i].mb_type = TAPI_SIM_MAILBOX_VOICE;
+ break;
}
- break;
}
}
+
+ char mailNumber[MAX_PHONE_NUMBER_LEN+1];
+ memset(mailNumber, 0x00 , sizeof(mailNumber));
+
+ MSG_SEC_DEBUG("Mailbox list[%d] ton=[%d], address=[%s], alpha_id=[%s]", \
+ i, simMailboxList[simIndex].list[i].ton, simMailboxList[simIndex].list[i].num, \
+ simMailboxList[simIndex].list[i].alpha_id);
+
+ if (simMailboxList[simIndex].list[i].ton == MSG_TON_INTERNATIONAL && simMailboxList[simIndex].list[i].num[0] != '+') {
+ snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "+%s", simMailboxList[simIndex].list[i].num);
+ MSG_DEBUG("MSG_TON_INTERNATIONAL [%s]", mailNumber);
+ } else {
+ snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "%s", simMailboxList[simIndex].list[i].num);
+ MSG_DEBUG("[%s]", mailNumber);
+ }
+
+ if (mailNumber[0] != '\0') {
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, simIndex);
+ if (MsgSettingSetString(keyName, mailNumber) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetString is failed!!");
+ }
+
+ if (simMailboxList[simIndex].list[i].alpha_id[0] != '\0') {
+ char unpackAlphaId[MAX_SIM_XDN_ALPHA_ID_LEN+8];
+ int tmpLen = 0;
+ MSG_LANG_INFO_S langInfo = {0,};
+
+ memset(unpackAlphaId, 0x00, sizeof(unpackAlphaId));
+
+ langInfo.bSingleShift = false;
+ langInfo.bLockingShift = false;
+
+ tmpLen = strlen(simMailboxList[simIndex].list[i].alpha_id);
+
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
+ textCvt->convertGSM7bitToUTF8((unsigned char*)unpackAlphaId, sizeof(unpackAlphaId), (unsigned char*)simMailboxList[simIndex].list[i].alpha_id, tmpLen, &langInfo);
+
+ MSG_DEBUG("UTF8 ALPHA_ID = [%s]", unpackAlphaId);
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, simIndex);
+ if (MsgSettingSetString(keyName, unpackAlphaId) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetString is failed!!");
+ }
}
}
@@ -986,14 +1549,14 @@ void SmsPluginSetting::setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pMailboxList,
mx.unlock();
}
-bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+bool SmsPluginSetting::getMailboxInfoEvent()
{
int ret = 0;
mx.lock();
bTapiResult = false;
- ret = cv.timedwait(mx.pMutex(), 10);
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
mx.unlock();
@@ -1002,80 +1565,65 @@ bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
return false;
}
- memset(pVoiceOpt, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
-
- if (bTapiResult == true) {
- for(int i = 0; i < simMailboxList.count; i++) {
- if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
- if (simMailboxList.list[i].ton == MSG_TON_INTERNATIONAL && simMailboxList.list[i].num[0] != '+') {
- snprintf(pVoiceOpt->mailNumber, sizeof(pVoiceOpt->mailNumber), "+%s", simMailboxList.list[i].num);
- } else {
- snprintf(pVoiceOpt->mailNumber, sizeof(pVoiceOpt->mailNumber), "%s", simMailboxList.list[i].num);
- }
-
- break;
- }
- }
- }
-
return bTapiResult;
}
-void SmsPluginSetting::setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess)
+void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess)
{
+ MSG_BEGIN();
+
mx.lock();
bTapiResult = bSuccess;
- memset(&simMwiInfo, 0x00, sizeof(SMS_SIM_MWI_INFO_S));
+ int index = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ memset(&simMwiInfo[index], 0x00, sizeof(SMS_SIM_MWI_INFO_S));
if (bTapiResult == true) {
- int mwi_cnt = 0;
- int index = 0;
+ int mwiCnt = 0;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
- memcpy(&simMwiInfo, pMwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+ memcpy(&simMwiInfo[index], pMwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
- /* Save MW count with VOICE line number */
- for(int i = 0; i < simMailboxList.count; i++) {
+ /* Save MW count with VOICE line1 number */
+ if (simMwiInfo[index].b_cphs == true) {
+ mwiCnt = simMwiInfo[index].cphs_mwi.b_voice1;
+ } else {
+ mwiCnt = simMwiInfo[index].mwi_list.mw_info[0].voice_count; // Normal case
+ }
+ // TODO :: Add operation for voice mail of line 2
- if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, index);
+ if (MsgSettingSetInt(keyName, mwiCnt) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
- index = simMailboxList.list[i].profile_num - 1;
- if (index < 0) {
- MSG_DEBUG("SIM profile number is invalid.");
- break;
- }
+ MSG_DEBUG("MWI count = [%d]", mwiCnt);
- MSG_DEBUG("SIM MWI profile number=[%d], index=[%d]", simMailboxList.list[i].profile_num, index);
+ if (mwiCnt > 0) {
+ deliverVoiceMsgNoti(index, mwiCnt);
+ }
+ }
- if (simMwiInfo.b_cphs == false) { // Normal case
- mwi_cnt = simMwiInfo.mwi_list.mw_info[index].voice_count;
- } else { // CPHS case
- /* For CPHS case, mwi_cnt value is boolean */
- mwi_cnt = simMwiInfo.cphs_mwi.b_voice1;
- }
+ cv.signal();
- if (MsgSettingSetInt(VOICEMAIL_COUNT, mwi_cnt) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetInt is failed!!");
+ mx.unlock();
- if (mwi_cnt > 0) {
- MSG_MESSAGE_INFO_S msgInfo = {0,};
+ MSG_END();
+}
- msgInfo.displayTime = time(NULL);
- snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), \
- "%s", simMailboxList.list[i].num);
- memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
- msgInfo.msgType.mainType = MSG_SMS_TYPE;
- msgInfo.msgType.subType = MSG_MWI_VOICE_SMS;
- snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new voice message", mwi_cnt);
+void SmsPluginSetting::setResultImei(bool bResult, char *pImei)
+{
+ mx.lock();
- MsgSoundPlayStart(false);
- MsgInsertNoti(&msgInfo);
- }
- break;
- }
- }
+ bTapiResult = bResult;
+
+ memset(&meImei, 0x00, sizeof(meImei));
+
+ if (bTapiResult == true && pImei) {
+ snprintf(meImei, sizeof(meImei), "%s", pImei);
}
cv.signal();
@@ -1083,6 +1631,30 @@ void SmsPluginSetting::setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSucce
mx.unlock();
}
+
+bool SmsPluginSetting::getResultImei(char *pImei)
+{
+ int ret = 0;
+
+ mx.lock();
+
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
+
+ mx.unlock();
+
+ if (ret == ETIMEDOUT) {
+ MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+ return false;
+ }
+
+ if (bTapiResult == true && pImei) {
+ snprintf(pImei, sizeof(meImei), "%s", meImei);
+ }
+
+ return bTapiResult;
+}
+
+
void SmsPluginSetting::setResultFromSim(bool bResult)
{
mx.lock();
@@ -1099,11 +1671,13 @@ bool SmsPluginSetting::getResultFromSim()
{
int ret = 0;
- mx.lock();
+ MSG_DEBUG("getResultFromSim() is called .");
- ret = cv.timedwait(mx.pMutex(), 10);
+ //mx.lock(); // Caller of this function MUST acquire the mutex before calling the TAPI API
- mx.unlock();
+ ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
+
+ //mx.unlock();
if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
@@ -1146,3 +1720,110 @@ SMS_PID_T SmsPluginSetting::convertPid(MSG_SMS_PID_T pid)
return retPid;
}
+
+void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt)
+{
+ MSG_BEGIN();
+
+ MSG_MESSAGE_INFO_S msgInfo = {0,};
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+
+ msgInfo.addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(msgInfo.addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
+ msgInfo.nAddressCnt = 1;
+
+ msgInfo.displayTime = time(NULL);
+
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ char *voiceNum = NULL;
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, simIndex);
+ voiceNum = MsgSettingGetString(keyName);
+
+ if (voiceNum) {
+ snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal),
+ "%s", voiceNum);
+ free(voiceNum);
+ voiceNum = NULL;
+ }
+ memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
+ msgInfo.msgType.mainType = MSG_SMS_TYPE;
+ msgInfo.msgType.subType = MSG_MWI_VOICE_SMS;
+ msgInfo.sim_idx = simIndex;
+
+#if 0
+ if (simMwiInfo.b_cphs == false) { // Normal case
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new voice message", mwiCnt);
+ } else {
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "New voice message");
+ }
+#else
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d", mwiCnt);
+#endif
+
+#if 0
+ if (SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo) != MSG_SUCCESS)
+ MSG_DEBUG("callbackIncoming is failed.");
+#else
+ MsgInsertNotification(&msgInfo);
+ MsgChangePmState();
+#endif
+
+ MSG_END();
+}
+
+
+void SmsPluginSetting::setSimChangeStatus(struct tapi_handle *handle, bool bInitializing)
+{
+ MSG_BEGIN();
+
+ int tapiRet = TAPI_API_SUCCESS;
+ TelSimCardStatus_t status = TAPI_SIM_STATUS_CARD_ERROR;
+
+ int cardChanged = 0;
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ pthread_t thd;
+ char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+
+ tapiRet = tel_get_sim_init_info(handle, &status, &cardChanged);
+ MSG_INFO("Tapi Ret=[%d], SIM index [%d], SIM status [%d], CardChanged [%d]", tapiRet, simIndex, status, cardChanged);
+
+ if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
+ if (simStatus[simIndex] == MSG_SIM_STATUS_NOT_FOUND) {
+ if (cardChanged == 1) {
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, simIndex);
+ MsgSettingSetInt(keyName, MSG_SIM_STATUS_CHANGED);
+ simStatus[simIndex] = MSG_SIM_STATUS_CHANGED;
+ } else {
+ snprintf(keyName, sizeof(keyName),"%s/%d", MSG_SIM_CHANGED, simIndex);
+ MsgSettingSetInt(keyName, MSG_SIM_STATUS_NORMAL);
+ simStatus[simIndex] = MSG_SIM_STATUS_NORMAL;
+ }
+// tel_handle_list.push_back(handle);
+ // Modified to call initSimInfo for SIM separately
+ MSG_DEBUG("calling initSimInfo");
+ if (pthread_create(&thd, NULL, &initSimInfo, handle) < 0) {
+ MSG_DEBUG("pthread_create() error");
+ }
+ pthread_detach(thd);
+
+ } else {
+ MSG_DEBUG("SIM init was already done!");
+ }
+ } else {
+ MSG_DEBUG("It doesn't initialize yet!!");
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, simIndex);
+ MSG_DEBUG("Set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND");
+ if (MsgSettingSetInt(keyName, MSG_SIM_STATUS_NOT_FOUND) != MSG_SUCCESS)
+ MSG_DEBUG("Fail to set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND");
+
+ simStatus[simIndex] = MSG_SIM_STATUS_NOT_FOUND;
+
+ }
+
+ MSG_END();
+}
diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp
index cbec877..6ba9ac3 100755
--- a/plugin/sms_plugin/SmsPluginSimMsg.cpp
+++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <errno.h>
@@ -29,9 +26,12 @@
#include "SmsPluginStorage.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginCallback.h"
+#include "MsgUtilStorage.h"
+#include "MsgNotificationWrapper.h"
+
#include "SmsPluginSimMsg.h"
+#include "SmsPluginDSHandler.h"
-extern struct tapi_handle *pTapiHandle;
/*==================================================================================================
IMPLEMENTATION OF SmsPluginSimMsg - Member Functions
@@ -43,10 +43,12 @@ SmsPluginSimMsg::SmsPluginSimMsg()
{
// Initialize member variables
simMsgId = 0;
+ delSimMsgId = -1;
usedCnt = 0;
totalCnt = 0;
bTapiResult = false;
memset(&simMsgDataInfo, 0x00, sizeof(simMsgDataInfo));
+ memset(simIdList, 0, sizeof(int) * MAX_SIM_SMS_NUM);
}
@@ -66,28 +68,64 @@ SmsPluginSimMsg* SmsPluginSimMsg::instance()
}
-void SmsPluginSimMsg::initSimMessage()
+void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
{
MSG_BEGIN();
+ char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
+ int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
+ // Set SIM count of vconf to 0
+ if (MsgSettingSetInt(keyName, 0) != MSG_SUCCESS) {
+ MSG_DEBUG("Error to set config data [%s]", keyName);
+ }
+ memset(keyName, 0, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
+
+ if (MsgSettingSetInt(keyName, 0) != MSG_SUCCESS) {
+ MSG_DEBUG("Error to set config data [%s]", keyName);
+ }
+
MSG_SIM_COUNT_S tmpMsgCnt;
memset(&tmpMsgCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
-
- getSimMsgCount(&tmpMsgCnt);
+ getSimMsgCount(handle, &tmpMsgCnt);
MSG_MESSAGE_INFO_S tmpMsgInfo;
- memset(&tmpMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ int simIdList[MAX_SIM_SMS_NUM];
+ int unreadSimMsg = 0;
for (int i = 0; i < tmpMsgCnt.usedCount; i++)
{
+ memset(&tmpMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ memset(simIdList, 0, sizeof(int) * MAX_SIM_SMS_NUM);
+
// Get SIM Msg
- if (getSimMsg(tmpMsgCnt.indexList[i], &tmpMsgInfo) == false)
+ if (getSimMsg(handle, tmpMsgCnt.indexList[i], &tmpMsgInfo, simIdList) == false)
continue;
- if (SmsPluginStorage::instance()->addSimMessage(&tmpMsgInfo) != MSG_SUCCESS)
- {
- MSG_DEBUG("Fail to addSimMessage()");
+ if (tmpMsgInfo.bRead == false)
+ unreadSimMsg++;
+
+ if (SmsPluginEventHandler::instance()->handleSimMsg(&tmpMsgInfo, simIdList, NULL, MAX_SIM_SMS_NUM) < 0) {
+ MSG_DEBUG("Fail to handleSimMsg()");
}
+
+ if (tmpMsgInfo.addressList) {
+ free(tmpMsgInfo.addressList);
+ tmpMsgInfo.addressList = NULL;
+ }
+ }
+
+ MSG_DEBUG("Unread SIM message count = [%d]", unreadSimMsg);
+#ifndef MSG_NOTI_INTEGRATION
+ if (unreadSimMsg > 0) {
+ MsgRefreshNotification(MSG_NOTI_TYPE_SIM, true, false);
+ }
+#endif
+
+ if (SmsPluginEventHandler::instance()->updateIMSI(sim_idx) != MSG_SUCCESS) {
+ MSG_ERR("Fail to handleSimMsg()");
}
MSG_END();
@@ -96,206 +134,349 @@ void SmsPluginSimMsg::initSimMessage()
msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
{
+ bool bSimSst = true;
+
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SERVICE_TABLE, pMsgInfo->sim_idx);
+ if (MsgSettingGetBool(keyName, &bSimSst) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
+ /* No return, default value is true. */
+
+ if (bSimSst == false)
+ return MSG_ERR_STORE_RESTRICT;
+
// Reset Out Parameter
pSimIdList->count = 0;
SMS_TPDU_S tpdu;
memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
-
- tpdu.tpduType = SMS_TPDU_DELIVER;
-
- // Set SMS TPDU Options
- setSmsOptions(&(tpdu.data.deliver));
-
- // Set TimeStamp
- convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
-
- // Set SMSC Options
- SMS_ADDRESS_S smsc;
- memset(&smsc, 0x00, sizeof(SMS_ADDRESS_S));
- SmsPluginTransport::instance()->setSmscOptions(&smsc);
-
- // Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S
- SMS_SUBMIT_DATA_S submitData;
- memset(&submitData, 0x00, sizeof(SMS_SUBMIT_DATA_S));
- SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.deliver.dcs.codingScheme), 0);
-
- // Check sim message full.
- if (checkSimMsgFull(submitData.segCount) == true)
+ if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO)
{
- MSG_DEBUG("SIM storage is full.");
-
- return MSG_ERR_SIM_STORAGE_FULL;
+ tpdu.tpduType = SMS_TPDU_SUBMIT;
+ tpdu.data.submit.dcs.msgClass = SMS_MSG_CLASS_NONE;
+ //SmsPluginTransport::instance()->setSmsSendOptions(&(tpdu.data.submit));
+ tpdu.data.submit.vpf = SMS_VPF_NOT_PRESENT;
+ }
+ else
+ {
+ tpdu.tpduType = SMS_TPDU_DELIVER;
+ setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
+ // Set TimeStamp
+ convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
}
- tpdu.data.deliver.userData.headerCnt = 0;
+ for(int i=0; i <pMsgInfo->nAddressCnt; ++i)
+ {
+ SMS_SUBMIT_DATA_S submitData;
+ memset(&submitData, 0x00, sizeof(SMS_SUBMIT_DATA_S));
+ int bufLen = 0;
+ char buf[MAX_TPDU_DATA_LEN];
- if (submitData.segCount > 1)
- tpdu.data.deliver.bHeaderInd = true;
+ if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) // SUBMIT MSG
+ {
+ SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
- int bufLen = 0;
+ int addLen = strlen(submitData.destAddress.address);
- char buf[MAX_TPDU_DATA_LEN];
+ tpdu.data.submit.destAddress.ton = submitData.destAddress.ton;
+ tpdu.data.submit.destAddress.npi = submitData.destAddress.npi;
- int addLen = strlen(submitData.destAddress.address);
+ if (addLen < MAX_ADDRESS_LEN) {
+ memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, addLen);
+ tpdu.data.submit.destAddress.address[addLen] = '\0';
+ } else {
+ memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
+ }
- tpdu.data.deliver.originAddress.ton = submitData.destAddress.ton;
- tpdu.data.deliver.originAddress.npi = submitData.destAddress.npi;
+ } else { // DELIVER MSG
+ SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.deliver.dcs.codingScheme), i);
- memcpy(tpdu.data.deliver.originAddress.address, submitData.destAddress.address, addLen);
- tpdu.data.deliver.originAddress.address[addLen] = '\0';
+ int addLen = strlen(submitData.destAddress.address);
- for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
- {
- tpdu.data.deliver.userData.length = submitData.userData[segCnt].length;
- memcpy(tpdu.data.deliver.userData.data, submitData.userData[segCnt].data, submitData.userData[segCnt].length);
+ tpdu.data.deliver.originAddress.ton = submitData.destAddress.ton;
+ tpdu.data.deliver.originAddress.npi = submitData.destAddress.npi;
- memset(buf, 0x00, sizeof(buf));
+ if (addLen < MAX_ADDRESS_LEN) {
+ memcpy(tpdu.data.deliver.originAddress.address, submitData.destAddress.address, addLen);
+ tpdu.data.deliver.originAddress.address[addLen] = '\0';
+ } else {
+ memcpy(tpdu.data.deliver.originAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ tpdu.data.deliver.originAddress.address[MAX_ADDRESS_LEN] = '\0';
+ }
+ }
- // Encode SMS-DELIVER TPDU
- bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
+ // Check sim message full.
+ if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
+ {
+ MSG_DEBUG("SIM storage is full.");
+ MsgInsertTicker("Sim memory full. Delete some items", SMS_MESSAGE_SIM_MESSAGE_FULL, true, 0);
- // Make Telephony Structure
- TelSmsData_t simSmsData;
- memset((void*)&simSmsData, 0x00, sizeof(simSmsData));
+ return MSG_ERR_SIM_STORAGE_FULL;
+ }
- // Set TPDU data
- memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
+ if(submitData.segCount > 1)
+ {
+ if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ // SUBMIT MSG
+ tpdu.data.submit.bHeaderInd = true;
+ } else {
+ tpdu.data.deliver.bHeaderInd = true;
+ }
- simSmsData.SmsData.szData[bufLen] = 0;
- simSmsData.SmsData.MsgLength = bufLen;
+ }
-#ifdef MSG_FOR_DEBUG
- MSG_DEBUG("Sim Message.");
- for (int j = 0; j < simSmsData.SmsData.MsgLength; j++)
+ for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
{
- MSG_DEBUG("[%02x]", simSmsData.SmsData.szData[j]);
- }
-#endif
+ if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){
+ memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
+ } else {
+ memcpy(&(tpdu.data.deliver.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
+ }
- MSG_DEBUG("Read Status [%d]", pMsgInfo->bRead);
+ memset(buf, 0x00, sizeof(buf));
+
+ // Encode SMS-DELIVER TPDU
+ bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
+
+ // Make Telephony Structure
+ TelSmsData_t simSmsData;
+ memset((void*)&simSmsData, 0x00, sizeof(simSmsData));
+
+ // Set TPDU data
+ memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
+
+ simSmsData.SmsData.szData[bufLen] = 0;
+ simSmsData.SmsData.MsgLength = bufLen;
+ simSmsData.SmsData.format = TAPI_NETTEXT_NETTYPE_3GPP;
+
+ if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MT) { // MT messages
+ if (pMsgInfo->bRead == true)
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_READ;
+ else
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
+ } else { // MO messages
+ if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS)
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_SENT;
+ else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS)
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_DELIVERED;
+ else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL)
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_DELIVERY_UNCONFIRMED;
+ else
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNSENT;
+ }
- if (pMsgInfo->bRead == true)
- simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_READ;
- else
- simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
+ // Save SMS in SIM
+ int ret = 0;
- // Save SMS in SIM
- int ret = 0;
+ ret = tel_write_sms_in_sim(handle, &simSmsData, TapiEventSaveSimMsg, NULL);
- ret = tel_write_sms_in_sim(pTapiHandle, &simSmsData, TapiEventSaveSimMsg, NULL);
+ if (ret == TAPI_API_SUCCESS)
+ {
+ MSG_DEBUG("######## tel_write_sms_in_sim Success !!!#######");
+ }
+ else
+ {
+ MSG_DEBUG("######## tel_write_sms_in_sim Fail !!! return : [%d] #######", ret);
- if (ret == TAPI_API_SUCCESS)
- {
- MSG_DEBUG("######## tel_write_sms_in_sim Success !!!#######");
- }
- else
- {
- MSG_DEBUG("######## tel_write_sms_in_sim Fail !!! return : [%d] #######", ret);
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
- return MSG_ERR_PLUGIN_STORAGE;
- }
+ msg_sim_id_t SimId = 0;
- msg_sim_id_t SimId = 0;
+ bool bResult = false;
- bool bResult = false;
+ bResult = getSimEvent(&SimId);
- bResult = getSimEvent(&SimId);
+ int usedCnt = 0;
- int usedCnt = 0;
+ if (bResult == true)
+ {
+ MSG_DEBUG("######## Saving Msg was Successful !!! SIM ID : [%d] #######", SimId);
- if (bResult == true)
- {
- MSG_DEBUG("######## Saving Msg was Successful !!! SIM ID : [%d] #######", SimId);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_USED_COUNT, pMsgInfo->sim_idx);
+ usedCnt = MsgSettingGetInt(keyName);
- usedCnt = MsgSettingGetInt(SIM_USED_COUNT);
+ usedCnt++;
- usedCnt++;
+ if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
+ {
+ MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
+ }
- if (MsgSettingSetInt(SIM_USED_COUNT, usedCnt) != MSG_SUCCESS)
- {
- MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
+ pSimIdList->simId[pSimIdList->count] = SimId;
+ pSimIdList->count++;
}
+ else
+ {
+ MSG_DEBUG("######## Saving Msg was Failed !!! SIM ID : [%d] #######", SimId);
- pSimIdList->simId[pSimIdList->count] = SimId;
- pSimIdList->count++;
- }
- else
- {
- MSG_DEBUG("######## Saving Msg was Failed !!! SIM ID : [%d] #######", SimId);
-
- return MSG_ERR_PLUGIN_STORAGE;
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
}
}
-
return MSG_SUCCESS;
}
msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInfo)
{
+
+ msg_error_t err = MSG_SUCCESS;
+ bool bSimSst = true;
+ int tapiRet = TAPI_API_SUCCESS;
+ int simId = -1;
+ int replaceSimId = -1;
+ int replaceMsgId = 0;
+
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
+
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SERVICE_TABLE, pMsgInfo->sim_idx);
+ if (MsgSettingGetBool(keyName, &bSimSst) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
+ /* No return, default value is true. */
+
+ if (bSimSst == false)
+ {
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
+ return MSG_SUCCESS;
+ }
+
// Reset Flag
SMS_TPDU_S tpdu;
tpdu.tpduType = SMS_TPDU_DELIVER;
+ convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
+
// Set SMS TPDU Options
- setSmsOptions(&(tpdu.data.deliver));
+ setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
- // Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S to get segment count
SMS_SUBMIT_DATA_S submitData;
+ int bufLen = 0;
+ char buf[MAX_TPDU_DATA_LEN];
+
SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.deliver.dcs.codingScheme), 0);
- // Check sim message full.
- if (checkSimMsgFull(submitData.segCount) == true)
- {
- MSG_DEBUG("SIM storage is full.");
+ if (pMsgInfo->msgType.subType >= MSG_REPLACE_TYPE1_SMS && pMsgInfo->msgType.subType <= MSG_REPLACE_TYPE7_SMS) {
+ err = SmsPluginStorage::instance()->getReplaceSimMsg(pMsgInfo, &replaceMsgId, &replaceSimId);
+ MSG_DEBUG("getReplaceSimMsg(): err=[%d], Replace Sim Id = [%d], Replace message id = [%d]", err, replaceSimId, replaceMsgId);
+ if (replaceMsgId < 0)
+ replaceMsgId = 0;
+ }
- SmsPluginTransport::instance()->sendDeliverReport(MSG_ERR_SIM_STORAGE_FULL);
+ // Check SIM ID
+ if (replaceSimId < 0) { // Normal message type
+ // Check sim message full.
+ if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
+ {
+ MSG_DEBUG("SIM storage is full.");
- return MSG_ERR_SIM_STORAGE_FULL;
- }
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_ERR_SIM_STORAGE_FULL);
- // Create TelSmsData_t data
- TelSmsData_t simSmsData = {0,};
+ return MSG_ERR_SIM_STORAGE_FULL;
+ }
- memcpy(&simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca));
- memcpy(&simSmsData.SmsData.szData, &simMsgDataInfo.szData, sizeof(simSmsData.SmsData.szData)-1);
- simSmsData.SmsData.MsgLength = simMsgDataInfo.msgLength;
+ int addLen = strlen(submitData.destAddress.address);
- // Set message status
- simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
+ tpdu.data.deliver.originAddress.ton = submitData.destAddress.ton;
+ tpdu.data.deliver.originAddress.npi = submitData.destAddress.npi;
- // Save Class 2 Msg in SIM
- int tapiRet = TAPI_API_SUCCESS;
+ if (addLen < MAX_ADDRESS_LEN) {
+ memcpy(tpdu.data.deliver.originAddress.address, submitData.destAddress.address, addLen);
+ tpdu.data.deliver.originAddress.address[addLen] = '\0';
+ } else {
+ memcpy(tpdu.data.deliver.originAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ tpdu.data.deliver.originAddress.address[MAX_ADDRESS_LEN] = '\0';
+ }
- tapiRet = tel_write_sms_in_sim(pTapiHandle, &simSmsData, TapiEventSaveClass2Msg, NULL);
+ if (submitData.segCount > 1)
+ tpdu.data.deliver.bHeaderInd = true;
+ } else { // Replace message type
+ tapiRet = tel_delete_sms_in_sim(handle, replaceSimId, TapiEventDeleteSimMsg, NULL);
- if (tapiRet == TAPI_API_SUCCESS)
- {
- memset(&simMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
- memcpy(&simMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
+ if (tapiRet == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_delete_sms_in_sim Success !!! #######");
+
+ simId = -1;
+ if(getDelSimEvent(&simId) == true) {
+ err = SmsPluginStorage::instance()->deleteSimMessage(pMsgInfo->sim_idx, replaceSimId);
+ }
+ MSG_DEBUG("tel_delete_sms_in_sim() : Err=[%d], Replace Sim Id=[%d], Result Sim id=[%d]", err, replaceSimId, simId);
- MSG_DEBUG("######## tel_write_sms_in_sim Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_delete_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
+ }
}
- else
- {
- MSG_DEBUG("######## tel_write_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
- SmsPluginTransport::instance()->sendDeliverReport(MSG_ERR_STORAGE_ERROR);
+ for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
+ // Create TelSmsData_t data
+ TelSmsData_t simSmsData = {0,};
+
+ if (submitData.segCount == 1) {
+ memcpy(&simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca));
+ memcpy(&simSmsData.SmsData.szData, &simMsgDataInfo.szData, sizeof(simSmsData.SmsData.szData)-1);
+ simSmsData.SmsData.MsgLength = simMsgDataInfo.msgLength;
+
+ } else {
+ memcpy(&(tpdu.data.deliver.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
+
+ memset(buf, 0x00, sizeof(buf));
+
+ // Encode SMS-DELIVER TPDU
+ bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
+
+ // Set TPDU data
+ memcpy((void*)simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca));
+ memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
+ simSmsData.SmsData.szData[bufLen] = 0;
+ simSmsData.SmsData.MsgLength = bufLen;
+ }
+
+ simSmsData.SmsData.format = TAPI_NETTEXT_NETTYPE_3GPP;
+ simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
+
+ MSG_MESSAGE_INFO_S *tmpSimMsgInfo = (MSG_MESSAGE_INFO_S *)calloc(1, sizeof(MSG_MESSAGE_INFO_S));
+ memcpy(tmpSimMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
+
+ tmpSimMsgInfo->msgId = replaceMsgId;
+
+ tmpSimMsgInfo->addressList = NULL;
+ tmpSimMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memcpy(&tmpSimMsgInfo->addressList[0], &pMsgInfo->addressList[0], sizeof(MSG_ADDRESS_INFO_S));
+
+ tapiRet = tel_write_sms_in_sim(handle, &simSmsData, TapiEventSaveClass2Msg, tmpSimMsgInfo);
- return MSG_ERR_PLUGIN_STORAGE;
+ if (tapiRet == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_write_sms_in_sim Success !!!, segNum = [%d] #######", segCnt);
+ } else {
+ MSG_DEBUG("######## tel_write_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
+
+ SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_ERR_STORAGE_ERROR);
+
+ return MSG_ERR_PLUGIN_STORAGE;
+ }
+
+ msg_sim_id_t retSimId;
+ if (!getSimEvent(&retSimId))
+ return MSG_ERR_PLUGIN_STORAGE;
}
return MSG_SUCCESS;
}
-void SmsPluginSimMsg::deleteSimMessage(msg_sim_id_t SimMsgId)
+void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
int tapiRet = TAPI_API_SUCCESS;
- tapiRet = tel_delete_sms_in_sim(pTapiHandle, (int)SimMsgId, TapiEventDeleteSimMsg, NULL);
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
+ tapiRet = tel_delete_sms_in_sim(handle, (int)SimMsgId, TapiEventDeleteSimMsg, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -306,23 +487,27 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_id_t SimMsgId)
THROW(MsgException::SMS_PLG_ERROR, "######## tel_delete_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
}
- msg_sim_id_t SimId = 0;
+ int SimId = 0;
bool bResult = false;
- bResult = getSimEvent(&SimId);
+ bResult = getDelSimEvent(&SimId);
int usedCnt = 0, totalCnt = 0;
if (bResult == true)
{
MSG_DEBUG("######## Deleting Msg was Successful !!! SIM ID : [%d] #######", SimId);
-
- usedCnt = MsgSettingGetInt(SIM_USED_COUNT);
- totalCnt = MsgSettingGetInt(SIM_TOTAL_COUNT);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_USED_COUNT, sim_idx);
+ usedCnt = MsgSettingGetInt(keyName);
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_TOTAL_COUNT, sim_idx);
+ totalCnt = MsgSettingGetInt(keyName);
if (usedCnt == totalCnt)
{
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -336,9 +521,12 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_id_t SimMsgId)
usedCnt--;
- if (MsgSettingSetInt(SIM_USED_COUNT, usedCnt) != MSG_SUCCESS)
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_USED_COUNT, sim_idx);
+
+ if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
{
- MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
+ MSG_DEBUG("Error to set config data [%s]", keyName);
}
}
else
@@ -348,12 +536,17 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_id_t SimMsgId)
}
-bool SmsPluginSimMsg::checkSimMsgFull(unsigned int SegCnt)
+bool SmsPluginSimMsg::checkSimMsgFull(msg_sim_slot_id_t sim_idx, unsigned int SegCnt)
{
int usedCnt = 0, totalCnt = 0;
- usedCnt = MsgSettingGetInt(SIM_USED_COUNT);
- totalCnt = MsgSettingGetInt(SIM_TOTAL_COUNT);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_USED_COUNT, sim_idx);
+ usedCnt = MsgSettingGetInt(keyName);
+ memset(keyName, 0x00, sizeof(keyName));
+ sprintf(keyName, "%s/%d", SIM_TOTAL_COUNT, sim_idx);
+ totalCnt = MsgSettingGetInt(keyName);
MSG_DEBUG("Segment Count [%d]", SegCnt);
MSG_DEBUG("usedCnt [%d], totalCnt [%d]", usedCnt, totalCnt);
@@ -365,13 +558,14 @@ bool SmsPluginSimMsg::checkSimMsgFull(unsigned int SegCnt)
}
-void SmsPluginSimMsg::setReadStatus(msg_sim_id_t SimMsgId)
+void SmsPluginSimMsg::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
MSG_DEBUG("Sim Message ID [%d]", SimMsgId);
int ret = TAPI_API_SUCCESS;
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
- ret = tel_set_sms_message_status(pTapiHandle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
+ ret = tel_set_sms_message_status(handle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
if (ret == TAPI_API_SUCCESS)
{
@@ -398,11 +592,11 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_id_t SimMsgId)
}
-void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
+void SmsPluginSimMsg::getSimMsgCount(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_get_sms_count(pTapiHandle, TapiEventGetSimMsgCnt, NULL);
+ ret = tel_get_sms_count(handle, TapiEventGetSimMsgCnt, NULL);
if (ret == TAPI_API_SUCCESS)
{
@@ -413,7 +607,7 @@ void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
THROW(MsgException::SMS_PLG_ERROR, "######## tel_get_sms_count() Fail !!! return : %d #######", ret);
}
- if (getSimMsgCntEvent(pSimMsgCnt) == true)
+ if (getSimMsgCntEvent(handle, pSimMsgCnt) == true)
{
MSG_DEBUG("######## Get Sim Msg Count was Successful !!! #######");
}
@@ -424,11 +618,11 @@ void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
}
-bool SmsPluginSimMsg::getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo)
+bool SmsPluginSimMsg::getSimMsg(struct tapi_handle *handle, msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList)
{
int ret = TAPI_API_SUCCESS;
- ret = tel_read_sms_in_sim(pTapiHandle, SimMsgId, TapiEventGetSimMsg, NULL);
+ ret = tel_read_sms_in_sim(handle, SimMsgId, TapiEventGetSimMsg, simIdList);
if (ret == TAPI_API_SUCCESS)
{
@@ -440,7 +634,7 @@ bool SmsPluginSimMsg::getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgI
return false;
}
- if (getSimMsgEvent(pMsgInfo) == true)
+ if (getSimMsgEvent(handle, pMsgInfo) == true)
{
MSG_DEBUG("######## Get Sim Msg was Successful !!! #######");
}
@@ -454,7 +648,7 @@ bool SmsPluginSimMsg::getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgI
}
-void SmsPluginSimMsg::setSmsOptions(SMS_DELIVER_S *pDeliver)
+void SmsPluginSimMsg::setSmsOptions(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver)
{
pDeliver->bMoreMsg = false;
pDeliver->bStatusReport = false;
@@ -465,7 +659,9 @@ void SmsPluginSimMsg::setSmsOptions(SMS_DELIVER_S *pDeliver)
pDeliver->dcs.msgClass = SMS_MSG_CLASS_NONE;
pDeliver->dcs.codingGroup = SMS_GROUP_GENERAL;
- pDeliver->dcs.codingScheme = (SMS_CODING_SCHEME_T)MsgSettingGetInt(SMS_SEND_DCS);
+ /* use encoding type of received message instead of message settings */
+ //pDeliver->dcs.codingScheme = (SMS_CODING_SCHEME_T)MsgSettingGetInt(SMS_SEND_DCS);
+ pDeliver->dcs.codingScheme = pMsgInfo->encodeType;
MSG_DEBUG("DCS : %d", pDeliver->dcs.codingScheme);
@@ -484,7 +680,8 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D
// encode absolute time
struct tm timeinfo = {0,};
- gmtime_r(&pMsgInfo->displayTime, &timeinfo);
+ tzset();
+ localtime_r(&pMsgInfo->displayTime, &timeinfo);
pDeliver->timeStamp.time.absolute.year = timeinfo.tm_year - 100;
MSG_DEBUG("pDeliver->timeStamp.time.absolute.year is %d",pDeliver->timeStamp.time.absolute.year);
@@ -511,23 +708,29 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D
}
-void SmsPluginSimMsg::setSimMsgCntEvent(const MSG_SIM_COUNT_S *pSimMsgCnt)
+void SmsPluginSimMsg::setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SIM_COUNT_S *pSimMsgCnt)
{
mx.lock();
MSG_DEBUG("Sim Message Count is %d.", pSimMsgCnt->usedCount);
+ int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+ char keyName[MAX_VCONFKEY_NAME_LEN]= {0,};
+
for (int i=0; i < pSimMsgCnt->usedCount; i++)
{
MSG_DEBUG("Sim Message Index is %d.", pSimMsgCnt->indexList[i]);
}
- if (MsgSettingSetInt(SIM_USED_COUNT, pSimMsgCnt->usedCount) != MSG_SUCCESS)
+ snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
+ if (MsgSettingSetInt(keyName, pSimMsgCnt->usedCount) != MSG_SUCCESS)
{
MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
}
- if (MsgSettingSetInt(SIM_TOTAL_COUNT, (int)pSimMsgCnt->totalCount) != MSG_SUCCESS)
+ memset(keyName, 0, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
+ if (MsgSettingSetInt(keyName, (int)pSimMsgCnt->totalCount) != MSG_SUCCESS)
{
MSG_DEBUG("Error to set config data [%s]", SIM_TOTAL_COUNT);
}
@@ -541,7 +744,7 @@ void SmsPluginSimMsg::setSimMsgCntEvent(const MSG_SIM_COUNT_S *pSimMsgCnt)
}
-bool SmsPluginSimMsg::getSimMsgCntEvent(MSG_SIM_COUNT_S *pSimMsgCnt)
+bool SmsPluginSimMsg::getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
{
int ret = 0;
@@ -562,19 +765,22 @@ bool SmsPluginSimMsg::getSimMsgCntEvent(MSG_SIM_COUNT_S *pSimMsgCnt)
return true;
}
-void SmsPluginSimMsg::setSimMsgEvent(const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess)
+void SmsPluginSimMsg::setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess)
{
mx.lock();
bTapiResult = bSuccess;
memset(&simMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ memset(&simAddrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
if (bTapiResult == true)
{
MSG_DEBUG("Success to get sim msg - Id : [%d]", pMsgInfo->msgId);
memcpy(&simMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
+ simMsgInfo.addressList = &simAddrInfo;
+ memcpy(&simAddrInfo,pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S));
}
cv.signal();
@@ -583,7 +789,7 @@ void SmsPluginSimMsg::setSimMsgEvent(const MSG_MESSAGE_INFO_S *pMsgInfo, bool bS
}
-bool SmsPluginSimMsg::getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo)
+bool SmsPluginSimMsg::getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INFO_S *pMsgInfo)
{
int ret = 0;
@@ -605,20 +811,25 @@ bool SmsPluginSimMsg::getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo)
if (bTapiResult == true)
{
memcpy(pMsgInfo, &simMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
+ pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S));
+ memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+ memcpy(pMsgInfo->addressList, simMsgInfo.addressList, sizeof(MSG_ADDRESS_INFO_S));
+ pMsgInfo->sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
}
+
return bTapiResult;
}
-void SmsPluginSimMsg::setSaveSimMsgEvent(int simMsgId, int result)
+void SmsPluginSimMsg::setSaveSimMsgEvent(struct tapi_handle *handle, int simId, int result)
{
msg_error_t err = MSG_SUCCESS;
mx.lock();
if (result != TAPI_NETTEXT_SENDSMS_SUCCESS) {
- if (result == TAPI_NETTEXT_ROUTING_NOT_AVAILABLE)
+ if (result == TAPI_NETTEXT_ROUTING_NOT_AVAILABLE || result == TAPI_NETTEXT_SIM_FULL)
err = MSG_ERR_SIM_STORAGE_FULL;
else
err = MSG_ERR_UNKNOWN;
@@ -629,58 +840,96 @@ void SmsPluginSimMsg::setSaveSimMsgEvent(int simMsgId, int result)
else
bTapiResult = false;
+ simMsgId = simId;
+
cv.signal();
mx.unlock();
- // Send Deliver Report
- SmsPluginTransport::instance()->sendDeliverReport(err);
+ int tapiRet = TAPI_API_SUCCESS;
+
+ if (err == MSG_SUCCESS) {
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
+ } else if (err == MSG_ERR_SIM_STORAGE_FULL) {
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
+ } else {
+ return;
+ }
+ if (tapiRet == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
+ }
}
-void SmsPluginSimMsg::setSaveClass2MsgEvent(int simMsgId, int result)
+void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simId, int result, MSG_MESSAGE_INFO_S *pMsgInfo)
{
msg_error_t err = MSG_SUCCESS;
+// int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
+ if (result == TAPI_NETTEXT_SENDSMS_SUCCESS && simId >= 0 && pMsgInfo) {
+ bool isNewSimMsg = true;
+
+ for (int i = 0; i < MAX_SIM_SMS_NUM; i++) {
+ if (simIdList[i] != 0) {
+ MSG_DEBUG("simIdList[%d] is exist [%d]", i, simIdList[i]);
+ continue;
+ } else {
+ simIdList[i] = simId + 1;
+ MSG_DEBUG("simIdList[%d] is assigned [%d]", i, simId + 1);
+ break;
+ }
+ }
- if (result == TAPI_NETTEXT_SENDSMS_SUCCESS && simMsgId >= 0) {
+ if (pMsgInfo->msgType.subType >= MSG_REPLACE_TYPE1_SMS && pMsgInfo->msgType.subType <= MSG_REPLACE_TYPE7_SMS) {
+ if (pMsgInfo->msgId > 0) {
+ isNewSimMsg = false;
+ }
+ }
- simMsgInfo.msgId = simMsgId;
+ if (simMsgDataInfo.totalSegment >= 1 && simIdList[simMsgDataInfo.totalSegment-1] != 0) {
+ msg_message_id_t saved_msg_id = 0;
+ SmsPluginEventHandler::instance()->handleSimMsg(pMsgInfo, simIdList, &saved_msg_id, MAX_SIM_SMS_NUM);
- err = SmsPluginStorage::instance()->addSimMessage(&simMsgInfo);
+ MSG_DEBUG("Saved message ID = [%d]", saved_msg_id);
- if (err == MSG_SUCCESS)
- {
- MSG_DEBUG("addSimMessage() Success !!");
+ if (saved_msg_id > 0)
+ pMsgInfo->msgId = saved_msg_id;
- // Callback
- err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&simMsgInfo);
+ err = SmsPluginEventHandler::instance()->callbackMsgIncoming(pMsgInfo);
if (err != MSG_SUCCESS)
{
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
}
+ }
- usedCnt = MsgSettingGetInt(SIM_USED_COUNT);
-
+ if (isNewSimMsg == true) {
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ sprintf(keyName, "%s/%d", SIM_USED_COUNT, pMsgInfo->sim_idx);
+ usedCnt = MsgSettingGetInt(keyName);
usedCnt++;
- if (MsgSettingSetInt(SIM_USED_COUNT, usedCnt) != MSG_SUCCESS)
+ if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
{
MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
}
- } else {
- MSG_DEBUG("addMessage() Error !! [%d]", err);
+ }
+
+ if (simMsgDataInfo.totalSegment >= 1 && simIdList[simMsgDataInfo.totalSegment-1] != 0) {
+ memset(simIdList, 0, sizeof(int) * MAX_SIM_SMS_NUM);
}
} else {
- if (result == TAPI_NETTEXT_ROUTING_NOT_AVAILABLE)
- err = MSG_ERR_SIM_STORAGE_FULL;
- else
- err = MSG_ERR_UNKNOWN;
+ if (result == TAPI_NETTEXT_SIM_FULL)
+ err = MSG_ERR_SIM_STORAGE_FULL;
+ else
+ err = MSG_ERR_UNKNOWN;
}
// Send Deliver Report
- SmsPluginTransport::instance()->sendDeliverReport(err);
+ SmsPluginTransport::instance()->sendDeliverReport(handle, err);
}
@@ -721,6 +970,46 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId)
return bTapiResult;
}
+
+void SmsPluginSimMsg::setDelSimEvent(int SimId, bool bResult)
+{
+ mx.lock();
+
+ delSimMsgId = SimId;
+ bTapiResult = bResult;
+
+ cv.signal();
+
+ mx.unlock();
+}
+
+
+bool SmsPluginSimMsg::getDelSimEvent(int *pSimId)
+{
+ int ret = 0;
+
+ mx.lock();
+
+ delSimMsgId = -1;
+ bTapiResult = false;
+ ret = cv.timedwait(mx.pMutex(), 10);
+
+ mx.unlock();
+
+ if (ret == ETIMEDOUT)
+ {
+ MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+ return false;
+ }
+
+ *pSimId = delSimMsgId;
+
+ MSG_DEBUG("Returned delSimMsgId is %d.", delSimMsgId);
+
+ return bTapiResult;
+}
+
+
void SmsPluginSimMsg::setSmsData(const char *sca, const char *szData, int msgLength)
{
MSG_DEBUG("Set SMS data(class2 message)");
@@ -731,3 +1020,11 @@ void SmsPluginSimMsg::setSmsData(const char *sca, const char *szData, int msgLen
memcpy(&simMsgDataInfo.szData, szData, sizeof(simMsgDataInfo.szData)-1);
simMsgDataInfo.msgLength = msgLength;
}
+
+void SmsPluginSimMsg::setSmsTpduTotalSegCount(int totalSeg)
+{
+ MSG_DEBUG("Set SMS Segements Info");
+
+ simMsgDataInfo.totalSegment = totalSeg;
+}
+
diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp
index 3398fc9..0977ea4 100755
--- a/plugin/sms_plugin/SmsPluginStorage.cpp
+++ b/plugin/sms_plugin/SmsPluginStorage.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <errno.h>
@@ -25,6 +22,7 @@
#include "MsgContact.h"
#include "MsgUtilFile.h"
#include "MsgUtilStorage.h"
+#include "MsgUtilFunction.h"
#include "MsgGconfWrapper.h"
#include "MsgNotificationWrapper.h"
#include "SmsPluginMain.h"
@@ -41,7 +39,7 @@ SmsPluginStorage* SmsPluginStorage::pInstance = NULL;
SmsPluginStorage::SmsPluginStorage()
{
/*** No need to connect DB anymore.
- if (dbHandle.connect() != MSG_SUCCESS) {
+ if (dbHandle->connect() != MSG_SUCCESS) {
MSG_DEBUG("DB Connect Fail");
}
***/
@@ -50,9 +48,7 @@ SmsPluginStorage::SmsPluginStorage()
SmsPluginStorage::~SmsPluginStorage()
{
- if (dbHandle.disconnect() != MSG_SUCCESS) {
- MSG_DEBUG("DB Disconnect Fail");
- }
+
}
@@ -67,13 +63,157 @@ SmsPluginStorage* SmsPluginStorage::instance()
}
+msg_error_t SmsPluginStorage::insertMsgRef(MSG_MESSAGE_INFO_S *pMsg, unsigned char msgRef, int index)
+{
+ MSG_BEGIN();
+
+ time_t curTime = time(NULL);
+
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+ char *normalNum = NULL;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ normalNum = msg_normalize_number(pMsg->addressList[index].addressVal);
+
+ MSG_SEC_DEBUG("Insert MsgID=[%d], Address=[%s], MsgRef=[%d], Time=[%d]", \
+ pMsg->msgId, normalNum, (int)msgRef, (int)curTime);
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %s, %d, 0, -1, %d);",
+ MSGFW_SMS_REPORT_TABLE_NAME, pMsg->msgId, normalNum, (int)msgRef, (int)curTime);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("MsgExecQuery() : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ MSG_END();
+
+ return MSG_SUCCESS;
+
+}
+
+
+msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInfo, unsigned char msgRef)
+{
+ MSG_BEGIN();
+
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ msg_message_id_t msgId = 0;
+ int rowCnt = 0;
+ char *normalNum = NULL;
+
+ normalNum = msg_normalize_number(pMsgInfo->addressList[0].addressVal);
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE ADDRESS_VAL = %s AND MSG_REF > 0 ORDER BY TIME ASC;",
+ MSGFW_SMS_REPORT_TABLE_NAME, normalNum);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_PREPARE;
+
+ if (dbHandle->stepQuery() == MSG_ERR_DB_ROW)
+ msgId = dbHandle->columnInt(0);
+
+ dbHandle->finalizeQuery();
+
+ pMsgInfo->msgId = msgId;
+
+ /** Update Status - MSG_MESSAGE_TABLE */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE MSG_ID = %d AND MSG_REF > 0;",
+ MSGFW_SMS_REPORT_TABLE_NAME, msgId);
+
+ if (dbHandle->getTable(sqlQuery, &rowCnt) != MSG_SUCCESS) {
+ dbHandle->freeTable();
+ return MSG_ERR_DB_GETTABLE;
+ }
+
+ dbHandle->freeTable();
+
+ MSG_DEBUG("Selected row count = [%d]", rowCnt);
+
+ if (rowCnt == 1 && pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE MSG_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, (int)pMsgInfo->networkStatus, msgId);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+ }
+
+ /** Update Status - MSG_REPORT_TABLE */
+ if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
+ MSGFW_SMS_REPORT_TABLE_NAME, 1, (int)pMsgInfo->displayTime, msgId, normalNum);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+ } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
+ MSGFW_SMS_REPORT_TABLE_NAME, 0, (int)pMsgInfo->displayTime, msgId, normalNum);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+ } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
+ MSGFW_SMS_REPORT_TABLE_NAME, 3, (int)pMsgInfo->displayTime, msgId, normalNum);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+ } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
+ MSGFW_SMS_REPORT_TABLE_NAME, 8, (int)pMsgInfo->displayTime, msgId, normalNum);
+ MSG_DEBUG("[SQL Query] %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed : [%s]", sqlQuery);
+ return MSG_ERR_DB_EXEC;
+ }
+ }
+
+ MSG_END();
+
+ return MSG_SUCCESS;
+}
+
+
msg_error_t SmsPluginStorage::updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status)
{
MSG_BEGIN();
+ if (!pMsgInfo || (pMsgInfo && pMsgInfo->msgId <= 0)) {
+ MSG_DEBUG("Invalid message id");
+ return MSG_ERR_INVALID_MESSAGE_ID;
+ }
+
/*** Comment below line to not save the time value after sent status (it could be used later.)
time_t curTime = time(NULL);
***/
+ MsgDbHandler *dbHandle = getDbHandle();
+
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -85,21 +225,21 @@ msg_error_t SmsPluginStorage::updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_ne
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d, FOLDER_ID = %d WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, status, MSG_SENTBOX_ID, pMsgInfo->msgId);
} else {
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE MSG_ID = %d;",
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d, READ_STATUS = 0 WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, status, pMsgInfo->msgId);
}
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
MSG_DEBUG("MsgExecQuery() : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
-
+ //contacts-service is not used for gear
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
if (status == MSG_NETWORK_SEND_SUCCESS) {
MSG_DEBUG("MsgAddPhoneLog() : folderId [%d]", pMsgInfo->folderId);
MsgAddPhoneLog(pMsgInfo);
}
-
-
+#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MSG_END();
return MSG_SUCCESS;
@@ -110,6 +250,8 @@ msg_error_t SmsPluginStorage::updateMsgRef(msg_message_id_t MsgId, unsigned char
{
MSG_BEGIN();
+ MsgDbHandler *dbHandle = getDbHandle();
+
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -117,7 +259,7 @@ msg_error_t SmsPluginStorage::updateMsgRef(msg_message_id_t MsgId, unsigned char
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = %d WHERE MSG_ID = %d;",
MSGFW_REPORT_TABLE_NAME, (int)MsgRef, MsgId);
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
@@ -139,6 +281,8 @@ msg_error_t SmsPluginStorage::updateStatusReport(unsigned char MsgRef, msg_deliv
MSG_DEBUG("tmpMsgRef : %d", tmpMsgRef);
+ MsgDbHandler *dbHandle = getDbHandle();
+
char sqlQuery[MAX_QUERY_LEN+1];
/** Get Msg Id for Quickpanel Noti */
@@ -148,20 +292,20 @@ msg_error_t SmsPluginStorage::updateStatusReport(unsigned char MsgRef, msg_deliv
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE MSG_REF = %d;",
MSGFW_REPORT_TABLE_NAME, (int)tmpMsgRef);
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
- if (dbHandle.stepQuery() == MSG_ERR_DB_ROW)
- msgId = dbHandle.columnInt(0);
+ if (dbHandle->stepQuery() == MSG_ERR_DB_ROW)
+ msgId = dbHandle->columnInt(0);
- dbHandle.finalizeQuery();
+ dbHandle->finalizeQuery();
/** Update Status */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, DELIVERY_REPORT_STATUS = %d, DELIVERY_REPORT_TIME = %lu WHERE MSG_REF = %d;",
MSGFW_REPORT_TABLE_NAME, Status, DeliveryTime, (int)tmpMsgRef);
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
@@ -169,7 +313,7 @@ msg_error_t SmsPluginStorage::updateStatusReport(unsigned char MsgRef, msg_deliv
/** Insert Quickpanel Noti */
msg_error_t ret = MSG_SUCCESS;
- ret = MsgInsertSmsNotiToQuickpanel(&dbHandle, msgId, Status);
+ ret = MsgInsertSmsNotiToQuickpanel(dbHandle, msgId, Status);
if (ret != MSG_SUCCESS) {
MSG_DEBUG("MsgInsertSmsNotiToQuickpanel() Failed : [%d]", ret);
@@ -182,61 +326,40 @@ msg_error_t SmsPluginStorage::updateStatusReport(unsigned char MsgRef, msg_deliv
}
#endif
-msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo)
+msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int *simIdList)
{
msg_error_t err = MSG_SUCCESS;
- msg_message_id_t msgId = 0;
- msg_thread_id_t convId = 0;
unsigned int simId = 0;
+ MsgDbHandler *dbHandle = getDbHandle();
char sqlQuery[MAX_QUERY_LEN+1];
- dbHandle.beginTrans();
+// dbHandle->beginTrans();
- err = MsgStoAddAddress(&dbHandle, pSimMsgInfo, &convId);
+# if 0
+ msg_message_id_t msgId = 0;
+ msg_thread_id_t convId = 0;
+
+ err = MsgStoAddAddress(dbHandle, pSimMsgInfo, &convId);
if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ dbHandle->endTrans(false);
return err;
}
pSimMsgInfo->threadId = convId;
- err = dbHandle.getRowId(MSGFW_MESSAGE_TABLE_NAME, &msgId);
+ err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &msgId);
if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ dbHandle->endTrans(false);
return err;
}
- simId = pSimMsgInfo->msgId;
+ //simId = pSimMsgInfo->msgId;
pSimMsgInfo->msgId = msgId;
- SMS_CONCAT_SIM_MSG_S concatSimMsg = {0};
-
- /** Get Data from Concat SIM Msg */
- if (pSimMsgInfo->msgType.subType == MSG_CONCAT_SIM_SMS && pSimMsgInfo->bTextSms == false) {
-
- int fileSize = 0;
-
- char* pFileData = NULL;
- AutoPtr<char> buf(&pFileData);
-
- if (MsgOpenAndReadFile(pSimMsgInfo->msgData, &pFileData, &fileSize) == false) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
- }
-
-
- memcpy(&concatSimMsg, (SMS_CONCAT_SIM_MSG_S*)pFileData, fileSize);
-
- /** Delete temporary file */
- MsgDeleteFile(pSimMsgInfo->msgData); /** ipc */
-
- MSG_DEBUG("SIM ID [%d], MSG DATA [%s]", concatSimMsg.simIdCnt, concatSimMsg.msgData);
- }
-
/** Add Message */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -248,68 +371,99 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo)
MSG_DEBUG("QUERY : %s", sqlQuery);
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_PREPARE;
}
- dbHandle.bindText(pSimMsgInfo->subject, 1);
+ dbHandle->bindText(pSimMsgInfo->subject, 1);
- if (pSimMsgInfo->msgType.subType == MSG_CONCAT_SIM_SMS && pSimMsgInfo->bTextSms == false)
- dbHandle.bindText(concatSimMsg.msgData, 2);
- else
- dbHandle.bindText(pSimMsgInfo->msgText, 2);
+ dbHandle->bindText(pSimMsgInfo->msgText, 2);
- if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
- dbHandle.endTrans(false);
+ if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_STEP;
}
- dbHandle.finalizeQuery();
+ dbHandle->finalizeQuery();
+#endif
+ if(simIdList) {
+ MSG_DEBUG("simIdList exist.");
+ for(int i=0; i < MAX_SIM_SMS_NUM; ++i)
+ {
+ if(simIdList[i]) {
+ simId = simIdList[i] - 1;
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);",
+ MSGFW_SIM_MSG_TABLE_NAME, simId, pSimMsgInfo->msgId);
+
+ MSG_DEBUG("QUERY : %s", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+// dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+ } else
+ break;
+ }
+ }
- /** Insert to Sim table */
- if (pSimMsgInfo->msgType.subType == MSG_CONCAT_SIM_SMS && pSimMsgInfo->bTextSms == false) {
+// dbHandle->endTrans(true);
- MSG_DEBUG("sim count : %d", concatSimMsg.simIdCnt);
+ return err;
- for (unsigned int i = 0; i < concatSimMsg.simIdCnt; i++) {
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);",
- MSGFW_SIM_MSG_TABLE_NAME, msgId, concatSimMsg.simIdList[i]);
+}
- MSG_DEBUG("QUERY : %s", sqlQuery);
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
- }
- } else {
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);",
- MSGFW_SIM_MSG_TABLE_NAME, msgId, simId);
+msg_error_t SmsPluginStorage::insertSimMessage(int simId, int msgId)
+{
+ MSG_BEGIN();
- MSG_DEBUG("QUERY : %s", sqlQuery);
+ MsgDbHandler *dbHandle = getDbHandle();
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ dbHandle->beginTrans();
+
+ /** Insert Message into msg_sim table */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);", MSGFW_SIM_MSG_TABLE_NAME, simId, msgId);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
}
- /** Update conversation table. */
- if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
+ dbHandle->endTrans(true);
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t SmsPluginStorage::deleteSimMessage(int sim_idx, int simId)
+{
+ MSG_BEGIN();
+
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ dbHandle->beginTrans();
+
+ /** Delete Message from msg_sim table */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE SIM_ID = %d AND SIM_SLOT_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, simId, sim_idx);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
}
- dbHandle.endTrans(true);
+ dbHandle->endTrans(true);
- return err;
+ return MSG_SUCCESS;
}
-msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
+msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
@@ -321,74 +475,57 @@ msg_error_t SmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
if (err != MSG_SUCCESS) {
if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
pMsgInfo->folderId = 0;
- if (addSmsMessage(pMsgInfo) != MSG_SUCCESS) {
- MSG_DEBUG("addSmsMessage is failed!");
- }
+ err = MSG_SUCCESS;
+ }
+ else if(pMsgInfo->msgType.classType == MSG_CLASS_2 &&
+ (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
+ err = addClass2Message(pMsgInfo);
+ }
+ else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS){
+ err = MSG_SUCCESS;
}
return err;
}
+ /** Amend message information for type **/
if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS) {
- MSG_DEBUG("Add Normal SMS");
+ MSG_DEBUG("Normal SMS");
if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
- err = SmsPluginSimMsg::instance()->saveClass2Message(pMsgInfo);
-
- if (err == MSG_SUCCESS) {
- MSG_DEBUG("Success to saveSimMessage.");
- } else {
- MSG_DEBUG("Fail to saveSimMessage : [%d]", err);
- }
- } else {
+ err = addClass2Message(pMsgInfo);
+ } else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
/** Class 0 Msg should be saved in hidden folder */
- if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
- pMsgInfo->folderId = 0;
- }
-
- /** Add into DB */
- err = addSmsMessage(pMsgInfo);
+ pMsgInfo->folderId = 0;
}
- } else if ((pMsgInfo->msgType.subType == MSG_CB_SMS) || (pMsgInfo->msgType.subType == MSG_JAVACB_SMS)) {
- /** 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);
+ MSG_DEBUG("Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
+
+ if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
+ err = addClass2Message(pMsgInfo);
+ } else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
+ /** Class 0 Msg should be saved in hidden folder */
+ pMsgInfo->folderId = 0;
+ pMsgInfo->msgType.subType = MSG_NORMAL_SMS;
+ }
+
} else if ((pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS) && (pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
if (pMsgInfo->bStore == true) {
- MSG_DEBUG("Add MWI Message");
- err = addSmsMessage(pMsgInfo);
- }
- } else if ((pMsgInfo->msgType.subType == MSG_WAP_SI_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_CO_SMS)) {
- MSG_DEBUG("Add WAP Push Message");
- switch (pMsgInfo->msgType.subType)
- {
- case MSG_WAP_SI_SMS:
- {
- // save push message information
- err = addWAPMessage(pMsgInfo);
- }
- break;
+ MSG_DEBUG("MWI Message");
- case MSG_WAP_CO_SMS:
- {
- err = handleCOWAPMessage(pMsgInfo);
+ if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
+ err = addClass2Message(pMsgInfo);
}
- break;
}
+ } else {
+ MSG_DEBUG("No matching type [%d]", pMsgInfo->msgType.subType);
}
if (err == MSG_SUCCESS) {
- MSG_DEBUG("Success to add message !!");
+ MSG_DEBUG("Success to check message !!");
} else {
- MSG_DEBUG("fail to add message !! : [%d]", err);
+ MSG_DEBUG("fail to check message !! : [%d]", err);
}
return err;
@@ -402,14 +539,16 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
unsigned int rowId = 0;
msg_thread_id_t convId = 0;
- dbHandle.beginTrans();
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ dbHandle->beginTrans();
if (pMsgInfo->nAddressCnt > 0) {
- err = MsgStoAddAddress(&dbHandle, pMsgInfo, &convId);
+ err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId);
if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ dbHandle->endTrans(false);
return err;
}
@@ -417,154 +556,29 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
}
/** Add Message Table */
- rowId = MsgStoAddMessageTable(&dbHandle, pMsgInfo);
+ rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo);
if (rowId <= 0) {
- dbHandle.endTrans(false);
+ dbHandle->endTrans(false);
return MSG_ERR_DB_ROW;
}
/** Update conversation table */
- err = MsgStoUpdateConversation(&dbHandle, convId);
+ err = MsgStoUpdateConversation(dbHandle, convId);
if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ dbHandle->endTrans(false);
return err;
}
- dbHandle.endTrans(true);
-
- pMsgInfo->msgId = (msg_message_id_t)rowId;
-
- MSG_END();
-
- return MSG_SUCCESS;
-}
-
-msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo)
-{
- MSG_BEGIN();
-
- msg_error_t err = MSG_SUCCESS;
-
- if (pSendOptInfo->bSetting == false) {
- MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
- MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-
- if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
- pSendOptInfo->bSetting = true;
- MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
- }
- }
-
- if (pSendOptInfo->bSetting == true) {
- char sqlQuery[MAX_QUERY_LEN+1];
-
- dbHandle.beginTrans();
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d);",
- MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
- pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-
- MSG_DEBUG("Query = [%s]", sqlQuery);
-
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- err = MSG_ERR_DB_EXEC;
- } else {
- dbHandle.endTrans(true);
- }
- }
-
- MSG_END();
-
- return err;
-}
-
-
-msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsg)
-{
- msg_error_t err = MSG_SUCCESS;
-
- char sqlQuery[MAX_QUERY_LEN+1];
-
- msg_thread_id_t convId = 0;
-
- dbHandle.beginTrans();
-
- if (pMsg->nAddressCnt > 0) {
-
- err = MsgStoAddAddress(&dbHandle, pMsg, &convId);
-
- if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return err;
- }
- }
-
- int fileSize = 0;
-
- char* pFileData = NULL;
- AutoPtr<char> buf(&pFileData);
-
- /** Get File Data */
- if (pMsg->bTextSms == false) {
- if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
- }
- }
-
- /** Update Message */
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
- DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \
- BACKUP = %d, SUBJECT = ?, MSG_DATA = ?, THUMB_PATH = ?, MSG_TEXT = ? WHERE MSG_ID = %d;",
- MSGFW_MESSAGE_TABLE_NAME, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize,
- pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, pMsg->bBackup, pMsg->msgId);
-
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
-
- dbHandle.bindText(pMsg->subject, 1);
-
- dbHandle.bindText(pMsg->msgData, 2);
-
- dbHandle.bindText(pMsg->thumbPath, 3);
-
- if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->bTextSms == false)
- dbHandle.bindText(pFileData, 4);
- else
- dbHandle.bindText(pMsg->msgText, 4);
-
- MSG_DEBUG("%s", sqlQuery);
-
- if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
-
- dbHandle.finalizeQuery();
-
- err = MsgStoUpdateConversation(&dbHandle, convId);
-
+ err = dbHandle->endTrans(true);
if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
+ return err;
}
- err = MsgStoClearConversationTable(&dbHandle);
-
- if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
- }
+ pMsgInfo->msgId = (msg_message_id_t)rowId;
- dbHandle.endTrans(true);
+ MSG_END();
return MSG_SUCCESS;
}
@@ -574,45 +588,49 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
{
MSG_BEGIN();
+ MsgDbHandler *dbHandle = getDbHandle();
+
char sqlQuery[MAX_QUERY_LEN+1];
/** Get SUB_TYPE, STORAGE_ID */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, ADDRESS_ID \
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, CONV_ID, SIM_INDEX \
FROM %s WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, msgId);
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
MSG_MESSAGE_TYPE_S msgType;
msg_folder_id_t folderId;
msg_thread_id_t convId;
+ msg_sim_slot_id_t simIndex;
- if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
- msgType.mainType = dbHandle.columnInt(0);
- msgType.subType = dbHandle.columnInt(1);
- folderId = dbHandle.columnInt(2);
- convId = dbHandle.columnInt(3);
+ if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
+ msgType.mainType = dbHandle->columnInt(0);
+ msgType.subType = dbHandle->columnInt(1);
+ folderId = dbHandle->columnInt(2);
+ convId = dbHandle->columnInt(3);
+ simIndex = dbHandle->columnInt(4);
MSG_DEBUG("Main Type:[%d] SubType:[%d] FolderId:[%d] ConversationId:[%d]", msgType.mainType, msgType.subType, folderId, convId);
} else {
MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery);
- dbHandle.finalizeQuery();
+ dbHandle->finalizeQuery();
return MSG_ERR_DB_STEP;
}
- dbHandle.finalizeQuery();
+ dbHandle->finalizeQuery();
- dbHandle.beginTrans();
+ dbHandle->beginTrans();
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_SENDOPT_TABLE_NAME, msgId);
/** Delete SMS Send Option */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
@@ -621,8 +639,8 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_CB_MSG_TABLE_NAME, msgId);
/** Delete Push Message from push table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
} else if (msgType.subType >= MSG_WAP_SI_SMS && msgType.subType <= MSG_WAP_CO_SMS) {
@@ -630,8 +648,8 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgId);
/** Delete Push Message from push table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
} else if (msgType.subType == MSG_SYNCML_CP) {
@@ -639,479 +657,228 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SYNCML_MSG_TABLE_NAME, msgId);
/** Delete SyncML Message from syncML table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
}
+ /** Delete Message from msg table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
- /** Delete Message from msg table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ /** Delete Message from msg_report table */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_REPORT_TABLE_NAME, msgId);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ /** Delete Message from msg_sim table */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
/** Clear Conversation table */
- if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
/** Update conversation table.*/
- if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
+ if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_STORAGE_ERROR;
}
- dbHandle.endTrans(true);
+ dbHandle->endTrans(true);
if (folderId == MSG_INBOX_ID) {
msgType.classType = MSG_CLASS_NONE;
/** Set memory status in SIM */
- if (MsgStoCheckMsgCntFull(&dbHandle, &msgType, folderId) == MSG_SUCCESS) {
+ if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) {
MSG_DEBUG("Set Memory Status");
- SmsPlgSetMemoryStatus(MSG_SUCCESS);
+ SmsPlgSetMemoryStatus(simIndex, MSG_SUCCESS);
}
}
- int smsCnt = 0, mmsCnt = 0;
-
- smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
- mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
-
- MsgSettingHandleNewMsg(smsCnt, mmsCnt);
- MsgRefreshNoti(false);
+ MsgRefreshAllNotification(true, false, false);
return MSG_SUCCESS;
}
-msg_error_t SmsPluginStorage::addCbMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
+msg_error_t SmsPluginStorage::addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo)
{
- msg_error_t err = MSG_SUCCESS;
-
- unsigned int rowId = 0;
- msg_thread_id_t convId = 0;
-
- char sqlQuery[MAX_QUERY_LEN+1];
-
- dbHandle.beginTrans();
-
- if (pMsgInfo->nAddressCnt > 0) {
- err = MsgStoAddAddress(&dbHandle, pMsgInfo, &convId);
+ MSG_BEGIN();
- if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return err;
- }
+ msg_error_t err = MSG_SUCCESS;
+ pthread_t thd;
+ memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
+ memset(&addrInfo, 0, sizeof(MSG_ADDRESS_INFO_S));
+ memcpy(&msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
+ memcpy(&addrInfo, pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S));
+ msgInfo.addressList = &addrInfo;
+
+ if(pthread_create(&thd, NULL, &class2_thread, (void *)&msgInfo) < 0)
+ {
+ MSG_DEBUG("pthread_create() error");
- pMsgInfo->threadId = convId;
}
+ //pthread_join(thd, (void **)&err);
+ pthread_detach(thd);
- /** Add Message Table */
- rowId = MsgStoAddMessageTable(&dbHandle, pMsgInfo);
+#if 0
+ err = SmsPluginSimMsg::instance()->saveClass2Message(pMsgInfo);
- if (rowId <= 0) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_ROW;
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Success to saveClass2Message.");
+ } else {
+ MSG_DEBUG("Fail to saveClass2Message : [%d]", err);
}
+#endif
- /** Get CB Msg ID */
- unsigned short cbMsgId = (unsigned short)pMsgInfo->msgId;
+ MSG_END();
- /** Add CB Msg in MSG_CBMSG_TABLE */
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ return err;
+}
- sprintf(sqlQuery, "INSERT INTO %s VALUES (%d, %d);",
- MSGFW_CB_MSG_TABLE_NAME, rowId, cbMsgId);
+void* SmsPluginStorage::class2_thread(void *data)
+{
+ MSG_BEGIN();
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_EXEC;
- }
+ msg_error_t err = MSG_SUCCESS;
+ MSG_MESSAGE_INFO_S *pMsgInfo = (MSG_MESSAGE_INFO_S *)data;
- /** Update conversation table. */
- if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
+ err = SmsPluginSimMsg::instance()->saveClass2Message(pMsgInfo);
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Success to saveClass2Message.");
+ } else {
+ MSG_DEBUG("Fail to saveClass2Message : [%d]", err);
}
- dbHandle.endTrans(true);
-
- /** Assign Msg ID */
- pMsgInfo->msgId = (msg_message_id_t)rowId;
-
- return err;
+ MSG_END();
+ return (void *)err;
}
-msg_error_t SmsPluginStorage::addReplaceTypeMsg(MSG_MESSAGE_INFO_S *pMsgInfo)
+msg_error_t SmsPluginStorage::getReplaceSimMsg(const MSG_MESSAGE_INFO_S *pMsg, int *pMsgId, int *pSimId)
{
- msg_error_t err = MSG_SUCCESS;
+ MSG_BEGIN();
- char sqlQuery[MAX_QUERY_LEN+1];
+ MsgDbHandler *dbHandle = getDbHandle();
- unsigned int retCnt = 0;
+ char sqlQuery[MAX_QUERY_LEN+1];
msg_thread_id_t convId = 0;
+ msg_message_id_t msgId = 0;
+
+ dbHandle->beginTrans();
- /** Check if new address or not */
- if (MsgExistAddress(&dbHandle, pMsgInfo, &convId) == true) {
+ if (MsgExistAddress(dbHandle, pMsg, &convId) == true) {
MSG_DEBUG("Address Info. exists [%d]", convId);
- /** Find Replace Type Msg : Same Replace Type, Same Origin Address */
+ /** Find Replace Type Msg : Same Replace Type, Same Origin Address, Same Storage ID */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*), MSG_ID FROM %s WHERE SUB_TYPE = %d AND CONV_ID = %d;",
- MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgType.subType, convId);
-
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s \
+ WHERE CONV_ID = %d AND SUB_TYPE = %d AND STORAGE_ID = %d \
+ ORDER BY DISPLAY_TIME ASC;",
+ MSGFW_MESSAGE_TABLE_NAME, (int)convId, pMsg->msgType.subType, MSG_STORAGE_SIM);
+
+ MSG_DEBUG("Query=[%s]", sqlQuery);
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
return MSG_ERR_DB_PREPARE;
+ }
- if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
- retCnt = dbHandle.columnInt(0);
- pMsgInfo->msgId = dbHandle.columnInt(1);
+ if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
+ *pMsgId = dbHandle->columnInt(0);
} else {
- dbHandle.finalizeQuery();
+ dbHandle->finalizeQuery();
+ dbHandle->endTrans(false);
return MSG_ERR_DB_STEP;
}
- dbHandle.finalizeQuery();
- }
+ dbHandle->finalizeQuery();
- /** Update New Replace Type Msg */
- if (retCnt == 0) { /** Insert New Replace Type Msg */
- MSG_DEBUG("Insert Replace Type Msg");
- err = addSmsMessage(pMsgInfo);
} else {
- MSG_DEBUG("Update Replace Type Msg");
- err = updateSmsMessage(pMsgInfo);
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_NORECORD;
}
- return err;
-}
-
-
-msg_error_t SmsPluginStorage::addWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
-{
- msg_error_t err = MSG_SUCCESS;
-
- MSG_PUSH_MESSAGE_S pushMsg = {};
-
- char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- int fileSize = 0;
-
- char* pFileData = NULL;
- AutoPtr<char> buf(&pFileData);
-
- if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
- return MSG_ERR_STORAGE_ERROR;
-
- MSG_DEBUG("fileSize : %d", fileSize);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_ID FROM %s \
+ WHERE MSG_ID = %d;",
+ MSGFW_SIM_MSG_TABLE_NAME, *pMsgId);
- memcpy(&pushMsg, pFileData, fileSize);
-
- /** Delete temporary file */
- MsgDeleteFile(pMsgInfo->msgData);
-
- /** check pPushMsg data */
-
- MSG_DEBUG("check pushMsg data");
- MSG_DEBUG("pushMsg.action : [%d]", pushMsg.action);
- MSG_DEBUG("pushMsg.received : [%d]", pushMsg.received);
- MSG_DEBUG("pushMsg.created : [%d]", pushMsg.created);
- MSG_DEBUG("pushMsg.expires : [%d]", pushMsg.expires);
- MSG_DEBUG("pushMsg.id : [%s]", pushMsg.id);
- MSG_DEBUG("pushMsg.href : [%s]", pushMsg.href);
- MSG_DEBUG("pushMsg.contents : [%s]", pushMsg.contents);
-
- bool bProceed = true;
-
- /** check validation of contents */
- if (checkPushMsgValidation(&pushMsg, &bProceed) != MSG_SUCCESS) {
- MSG_DEBUG("Fail to check Push Message validation.");
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_PREPARE;
}
- /** if validation check value is false */
- /** return and drop message. */
- if (bProceed == false)
- return MSG_ERR_INVALID_MESSAGE;
-
-#if 0
- /** update subject */
- int len = strlen(pushMsg.contents);
-
- if (len > MAX_SUBJECT_LEN) {
- memcpy(pMsgInfo->subject, pushMsg.contents, MAX_SUBJECT_LEN);
- pMsgInfo->subject[MAX_SUBJECT_LEN] = '\0';
+ if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
+ *pSimId = dbHandle->columnInt(0);
} else {
- strncpy(pMsgInfo->subject, pushMsg.contents, MAX_SUBJECT_LEN);
- }
-#endif
-
- /** Update Msg Text - remove */
- strncpy(pMsgInfo->msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
-
- if (pushMsg.contents[0] != '\0') {
- strncat(pMsgInfo->msgText, " ", MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
- strncat(pMsgInfo->msgText, pushMsg.contents, MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
- }
-
- pMsgInfo->dataSize = strlen(pMsgInfo->msgText);
-
- pMsgInfo->bTextSms = true;
- pMsgInfo->folderId = MSG_INBOX_ID;
- pMsgInfo->storageId = MSG_STORAGE_PHONE;
-
- msg_thread_id_t convId = 0;
-
- dbHandle.beginTrans();
-
- if (pMsgInfo->nAddressCnt > 0) {
-
- err = MsgStoAddAddress(&dbHandle, pMsgInfo, &convId);
-
- if (err != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return err;
- }
-
- pMsgInfo->threadId = convId;
- }
-
- /** get last row count for Message id */
- unsigned int rowId = 0;
-
- /** Add Message Table */
- rowId = MsgStoAddMessageTable(&dbHandle, pMsgInfo);
-
- if (rowId <= 0) {
- dbHandle.endTrans(false);
- return MSG_ERR_DB_ROW;
- }
-
- /** add msg_push_table */
- snprintf (sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %lu, %lu, ?, ?, ?)",
- MSGFW_PUSH_MSG_TABLE_NAME, pMsgInfo->msgId, pushMsg.action, pushMsg.created, pushMsg.expires);
-
- if ((err = dbHandle.prepareQuery(sqlQuery)) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return err;
+ dbHandle->finalizeQuery();
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_STEP;
}
- dbHandle.bindText(pushMsg.id, 1);
-
- dbHandle.bindText(pushMsg.href, 2);
+ MSG_DEBUG("Replace Msg Id=[%d], Sim Id=[%d]", *pMsgId, *pSimId);
- dbHandle.bindText(pushMsg.contents, 3);
+ dbHandle->finalizeQuery();
- if ((err = dbHandle.stepQuery()) != MSG_ERR_DB_DONE) {
- dbHandle.endTrans(false);
- return err;
- }
-
- /** Update conversation table. */
- if (MsgStoUpdateConversation(&dbHandle, convId) != MSG_SUCCESS) {
- dbHandle.endTrans(false);
- return MSG_ERR_STORAGE_ERROR;
- }
+ dbHandle->endTrans(true);
- dbHandle.endTrans(true);
-
- pMsgInfo->msgId = (msg_message_id_t)rowId;
+ MSG_END();
- return MSG_SUCCESS;
+ return msgId;
}
-
-msg_error_t SmsPluginStorage::handleCOWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
+msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo)
{
- msg_error_t err = MSG_SUCCESS;
-
- char href[MAX_PUSH_CACHEOP_MAX_URL_LEN+1];
- char sqlQuery[MAX_QUERY_LEN+1];
-
- int fileSize = 0;
-
- char* pFileData = NULL;
- AutoPtr<char> buf(&pFileData);
-
- if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
- return MSG_ERR_STORAGE_ERROR;
-
- MSG_PUSH_CACHEOP_S *pPushMsg;
-
- pPushMsg = (MSG_PUSH_CACHEOP_S*)pFileData;
-
- for (int i = 0; i < pPushMsg->invalObjectCnt; i++) {
-
- int msgid = -1;
-
- memset(href, 0x00, sizeof(href));
- strncpy(href, &(pPushMsg->invalObjectUrl[i][0]), MAX_PUSH_CACHEOP_MAX_URL_LEN);
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf (sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE HREF LIKE '%%%s%%';", MSGFW_PUSH_MSG_TABLE_NAME, href);
-
- dbHandle.beginTrans();
-
- err = dbHandle.prepareQuery(sqlQuery);
-
- if ((dbHandle.stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) {
-
- msgid = dbHandle.getColumnToInt(1);
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID= %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgid);
-
- /** Delete Message from Push table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgid);
-
- /** Delete Message from msg table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
-
- /** Update all Address */
- if (updateAllAddress() != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
+ MSG_BEGIN();
- /** Clear Conversation table */
- if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
- }
+ msg_error_t err = MSG_SUCCESS;
- dbHandle.finalizeQuery();
+ if (pSendOptInfo->bSetting == false) {
+ MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
+ MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
- dbHandle.endTrans(true);
+// if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
+// pSendOptInfo->bSetting = true;
+ MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
+// }
}
- for (int i = 0; i < pPushMsg->invalServiceCnt; i++) {
-
- int msgid = -1;
+// if (pSendOptInfo->bSetting == true) {
+ MsgDbHandler *dbHandle = getDbHandle();
- memset(href, 0x00, sizeof(href));
- strncpy(href, &(pPushMsg->invalObjectUrl[i][0]), MAX_PUSH_CACHEOP_MAX_URL_LEN);
+ char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE HREF LIKE '%%%s%%'", MSGFW_PUSH_MSG_TABLE_NAME, href);
-
- dbHandle.beginTrans();
-
- err = dbHandle.prepareQuery(sqlQuery);
-
- if ((dbHandle.stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) {
-
- msgid = dbHandle.getColumnToInt(1);
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- sprintf(sqlQuery, "DELETE FROM %s WHERE MSG_ID='%d'", MSGFW_PUSH_MSG_TABLE_NAME, msgid);
-
- /** Delete Message from Push table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
-
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgid);
-
- /** Delete Message from msg table */
- if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
+ MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
+ pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->encodeType);
- /** Update all Address */
- if (updateAllAddress() != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
+ MSG_DEBUG("Query = [%s]", sqlQuery);
- /** Clear Address table */
- if (MsgStoClearConversationTable(&dbHandle) != MSG_SUCCESS) {
- dbHandle.finalizeQuery();
- dbHandle.endTrans(false);
- continue;
- }
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ err = MSG_ERR_DB_EXEC;
}
+// }
- dbHandle.finalizeQuery();
-
- dbHandle.endTrans(true);
- }
-
- /** delete temporary file */
- MsgDeleteFile(pMsgInfo->msgData);
-
- return MSG_SUCCESS;
-}
-
-
-msg_error_t SmsPluginStorage::checkPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbProceed)
-{
- msg_error_t err = MSG_SUCCESS;
-
- unsigned long oldExpireTime = 0;
- int rowCnt = 0;
-
- char sqlQuery[MAX_QUERY_LEN+1];
-
- /** is push message is expired?? */
- if (pPushMsg->received > pPushMsg->expires) {
- MSG_DEBUG("Push Message is expired.");
- pbProceed = false;
- return err;
- }
-
-
- if (pPushMsg->action == MSG_PUSH_SL_ACTION_EXECUTE_LOW) {
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXPIRES FROM %s WHERE ID = '%s' AND ACTION = %d",
- MSGFW_PUSH_MSG_TABLE_NAME, pPushMsg->id, pPushMsg->action);
- } else {
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT EXPIRES FROM %s WHERE ID = '%s'",
- MSGFW_PUSH_MSG_TABLE_NAME, pPushMsg->id);
- }
-
- err = dbHandle.getTable(sqlQuery, &rowCnt);
-
- if (rowCnt < 1) {
- dbHandle.freeTable();
- return MSG_SUCCESS;
- }
-
- oldExpireTime = dbHandle.getColumnToInt(1);
-
- dbHandle.freeTable();
-
- if (pPushMsg->created < oldExpireTime) {
- MSG_DEBUG("Push Message is expired.");
- pbProceed = false;
- return err;
- }
+ MSG_END();
return err;
}
@@ -1121,7 +888,9 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo)
{
msg_error_t err = MSG_SUCCESS;
- err = MsgStoCheckMsgCntFull(&dbHandle, &(pMsgInfo->msgType), pMsgInfo->folderId);
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ err = MsgStoCheckMsgCntFull(dbHandle, &(pMsgInfo->msgType), pMsgInfo->folderId);
if (err != MSG_SUCCESS) {
@@ -1136,7 +905,7 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo)
msg_message_id_t msgId;
/** Find the oldest message's msgId */
- err = MsgStoGetOldestMessage(&dbHandle, pMsgInfo, &msgId);
+ err = MsgStoGetOldestMessage(dbHandle, pMsgInfo, &msgId);
if (err != MSG_SUCCESS)
return err;
@@ -1153,68 +922,90 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo)
}
-msg_error_t SmsPluginStorage::updateAllAddress()
+#if 0
+
+msg_error_t SmsPluginStorage::isReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage)
{
msg_error_t err = MSG_SUCCESS;
- int rowCnt = 0, index = 1;
- char sqlQuery[MAX_QUERY_LEN+1];
+ int rowCnt = 0;
+
+ MsgDbHandler *dbHandle = getDbHandle();
+
+ char sqlQuery[MAX_QUERY_LEN+1] = {0, };
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s", MSGFW_ADDRESS_TABLE_NAME);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE GEO_SCOPE = %d AND MSG_CODE = %d AND MESSAGE_ID = %d AND UPDATE_NUM = %d",
+ MSGFW_RECEIVED_CB_MSG_TABLE_NAME, CbPage.pageHeader.serialNum.geoScope,
+ CbPage.pageHeader.serialNum.msgCode,CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum);
- err = dbHandle.getTable(sqlQuery, &rowCnt);
+ 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;
- }
+ dbHandle->freeTable();
+ return err;
+}
+msg_error_t SmsPluginStorage::insertReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage)
+{
- for (int i = 0; i < rowCnt; i++) {
+ msg_error_t err = MSG_SUCCESS;
+
+ unsigned int rowId = 0;
- err = MsgStoUpdateConversation(&dbHandle, index++);
+ MsgDbHandler *dbHandle = getDbHandle();
- if (err != MSG_SUCCESS)
- break;
- }
+ char sqlQuery[MAX_QUERY_LEN+1];
- dbHandle.freeTable();
+ err = dbHandle->getRowId(MSGFW_RECEIVED_CB_MSG_TABLE_NAME, &rowId);
+
+ if (err != MSG_SUCCESS)
+ return err;
+
+ // Add Folder
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
+ MSGFW_RECEIVED_CB_MSG_TABLE_NAME, rowId, CbPage.pageHeader.serialNum.geoScope,
+ CbPage.pageHeader.serialNum.msgCode,CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_EXEC;
+
+ return MSG_SUCCESS;
- return err;
}
+#endif
-msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *count, char *application_id, char *contentType)
+msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *count, char *application_id, int app_id_len, char *content_type, int content_type_len)
{
msg_error_t err = MSG_SUCCESS;
int rowCnt = 0, index = 3;
+ MsgDbHandler *dbHandle = getDbHandle();
+
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);
+ err = dbHandle->getTable(sqlQuery, &rowCnt);
MSG_DEBUG("rowCnt: %d", rowCnt);
if (err == MSG_ERR_DB_NORECORD) {
- dbHandle.freeTable();
+ dbHandle->freeTable();
return MSG_SUCCESS;
}
else if ( err != MSG_SUCCESS) {
- dbHandle.freeTable();
+ dbHandle->freeTable();
return err;
}
- char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
- char app_id[MAX_WAPPUSH_ID_LEN + 1];
+ char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0,};
+ char appId[MAX_WAPPUSH_ID_LEN + 1] = {0,};
int appcode = 0, default_appcode = 0;
bool found = false;
char *_content_type = NULL, *_app_id = NULL;
@@ -1222,26 +1013,26 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
for (int i = 0; i < rowCnt; i++) {
- memset(content_type, 0, MAX_WAPPUSH_CONTENT_TYPE_LEN);
- memset(app_id, 0, MAX_WAPPUSH_ID_LEN);
+ memset(contentType, 0, MAX_WAPPUSH_CONTENT_TYPE_LEN);
+ memset(appId, 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++);
+ dbHandle->getColumnToString(index++, MAX_WAPPUSH_CONTENT_TYPE_LEN + 1, contentType);
+ dbHandle->getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, appId);
+ appcode = dbHandle->getColumnToInt(index++);
//MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
- _content_type = strcasestr(pPushHeader, content_type);
+ _content_type = strcasestr(pPushHeader, contentType);
if(_content_type) {
- _app_id = strcasestr(pPushHeader, app_id);
+ _app_id = strcasestr(pPushHeader, appId);
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);
- strcpy(contentType, content_type);
+ MSG_SEC_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, appId);
+ snprintf(application_id, app_id_len, "%s", appId);
+ snprintf(content_type, content_type_len, "%s", contentType);
pushAppInfoList.push_back(pInfo);
(*count)++;
found = true;
@@ -1249,17 +1040,18 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
}
}
- if(!found)
+ if(!found && default_appcode != SMS_WAP_APPLICATION_LBS)
{
// perform default action.
PUSH_APPLICATION_INFO_S pInfo = {0, };
pInfo.appcode = default_appcode;
- strcpy(application_id, app_id);
- strcpy(contentType, content_type);
+ memset(appId, 0, MAX_WAPPUSH_ID_LEN + 1);
+ snprintf(application_id, app_id_len, "%s", appId);
+ snprintf(content_type, content_type_len, "%s", contentType);
pushAppInfoList.push_back(pInfo);
*count = 1;
}
- dbHandle.freeTable();
+ dbHandle->freeTable();
return err;
}
diff --git a/plugin/sms_plugin/SmsPluginTpduCodec.cpp b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
index 3ae4bff..2b17797 100755
--- a/plugin/sms_plugin/SmsPluginTpduCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <stdio.h>
@@ -119,7 +116,7 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
pTpdu[offset] = 0x01;
//TP-RD
- if(pSubmit->bRejectDup == false)
+ if(pSubmit->bRejectDup == true)
pTpdu[offset] |= 0x04;
//TP-VPF
@@ -198,6 +195,15 @@ MSG_DEBUG("encodeSize : %d", encodeSize);
offset += encodeSize;
+#if 0
+ printf("\n\n[encodeSubmit] pTpdu data.\n");
+ for (int i = 0; i < offset; i++)
+ {
+ printf(" [%02x]", pTpdu[i]);
+ }
+ printf("\n\n");
+#endif
+
return offset;
}
@@ -279,8 +285,10 @@ int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliver
offset++;
// TP-FCS
- if (pDeliverRep->reportType == SMS_REPORT_NEGATIVE)
+ if (pDeliverRep->reportType == SMS_REPORT_NEGATIVE) {
pTpdu[offset++] = pDeliverRep->failCause;
+ MSG_DEBUG("Delivery report : fail cause = [%02x]", pDeliverRep->failCause);
+ }
// TP-PI
pTpdu[offset++] = pDeliverRep->paramInd;
@@ -471,7 +479,7 @@ int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SM
int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, SMS_DELIVER_S *pDeliver)
{
- int offset = 0, udLen = 0;
+ int offset = 0, udLen = 0, tmpOffset = 0;
char tpduTmp[(TpduLen*2)+1];
@@ -480,7 +488,7 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
}
MSG_DEBUG("Deliver TPDU.");
- MSG_DEBUG("[%s]", tpduTmp);
+ MSG_INFO("[%s]", tpduTmp);
// TP-MMS
@@ -509,6 +517,8 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
offset++;
+ tmpOffset = offset;
+#if 1
// TP-OA
offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
@@ -518,6 +528,65 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
// TP-DCS
offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pDeliver->dcs));
+ // Support KSC5601 :: Coding group bits == 0x84
+ if (pTpdu[offset-1] == 0x84) {
+ pDeliver->dcs.codingScheme = SMS_CHARSET_EUCKR;
+ }
+
+#else
+ //For alphanumeric address test
+
+ offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
+
+ char* address = new char[15];
+ address[0] = 0x04;
+ address[1] = 0xd0;
+ address[2] = 0x11;
+ address[3] = 0x00;
+ address[4] = 0x20;
+ address[5] = 0xF2;
+ address[6] = 0x01;
+ address[7] = 0x01;
+ address[8] = 0x11;
+ address[9] = 0x61;
+ address[10] = 0x40;
+ address[11] = 0x82;
+ address[12] = 0x2b;
+ address[13] = 0x01;
+ address[14] = 0x20;
+
+ SmsPluginParamCodec::decodeAddress((unsigned char*)address, &(pDeliver->originAddress));
+
+ pDeliver->pid = 0x20;
+ offset++;
+ offset += SmsPluginParamCodec::decodeDCS((unsigned char*)address, &(pDeliver->dcs));
+ // end test
+#endif
+
+ if (pDeliver->pid == 0x20 && pDeliver->originAddress.ton == SMS_TON_ALPHANUMERIC) {
+ int setType = -1;
+ int indType = -1;
+
+ bool bVmi = SmsPluginParamCodec::checkCphsVmiMsg(&pTpdu[tmpOffset], &setType, &indType);
+
+ MSG_DEBUG("bVmi = [%d], setType=[%d], indType=[%d]", bVmi, setType, indType);
+
+ if (bVmi) {
+ pDeliver->dcs.bMWI = true;
+
+ if (setType == 0) {
+ pDeliver->dcs.bIndActive = false;
+ } else {
+ pDeliver->dcs.bIndActive = true;
+ }
+
+ if (indType == 0)
+ pDeliver->dcs.indType = SMS_VOICE_INDICATOR;
+ else if (indType == 1)
+ pDeliver->dcs.indType = SMS_VOICE2_INDICATOR;
+ }
+ }
+
// TP-SCTS
offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pDeliver->timeStamp));
diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp
index 9b01803..2a9b236 100755
--- a/plugin/sms_plugin/SmsPluginTransport.cpp
+++ b/plugin/sms_plugin/SmsPluginTransport.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <errno.h>
@@ -26,12 +23,16 @@
#include "MsgGconfWrapper.h"
#include "MsgUtilFile.h"
#include "MsgNotificationWrapper.h"
+#include "MsgUtilStorage.h"
+
#include "SmsPluginParamCodec.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginStorage.h"
#include "SmsPluginCallback.h"
#include "SmsPluginTransport.h"
+#include "SmsPluginDSHandler.h"
+#include "SmsPluginSetting.h"
extern "C"
{
@@ -39,7 +40,7 @@ extern "C"
}
-extern struct tapi_handle *pTapiHandle;
+extern bool isMemAvailable;
/*==================================================================================================
IMPLEMENTATION OF SmsPluginTransport - Member Functions
@@ -52,6 +53,7 @@ SmsPluginTransport::SmsPluginTransport()
msgRef = 0x00;
msgRef8bit = 0x00;
msgRef16bit = 0x0000;
+ memset(&curMoCtrlData, 0x00, sizeof(curMoCtrlData));
}
@@ -78,48 +80,55 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
tpdu.tpduType = SMS_TPDU_SUBMIT;
- // Set SMS Send Options - Setting
- setSmsSendOptions(&(tpdu.data.submit));
+ // Get SMS Send Options - Setting
+ getSmsSendOption(pReqInfo->msgInfo.sim_idx, &(tpdu.data.submit));
// Set SMS Send Options - Each Message
- if (pReqInfo->sendOptInfo.bSetting == true)
- {
- tpdu.data.submit.bStatusReport = pReqInfo->sendOptInfo.bDeliverReq;
- tpdu.data.submit.bReplyPath = pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath;
- }
-
- // Set Coding Scheme for apps that use port number
- if (pReqInfo->msgInfo.msgPort.valid == true)
- {
- tpdu.data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
-
- MSG_DEBUG("DCS is changed by application : [%d]", tpdu.data.submit.dcs.codingScheme);
- }
+ setSmsSendOption(pReqInfo, &tpdu);
-#ifdef MSG_SMS_REPORT
- // Update Msg Ref into Report Table
- if (tpdu.data.submit.bStatusReport == true)
- {
- MSG_DEBUG("Update Msg Ref [%d] in Report Table", tpdu.data.submit.msgRef);
+ // Set coding scheme
+ setSmsDcsOption(pReqInfo, &tpdu);
- SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, tpdu.data.submit.msgRef);
- }
-#endif
+ // Set SMS report request
+ setSmsReportOption(pReqInfo, &tpdu);
// Set SMSC Options
- SMS_ADDRESS_S smsc;
- setSmscOptions(&smsc);
- int i = 0;
- int j = 0;
+ SMS_ADDRESS_S smsc = {0,};
+ setSmscOptions(pReqInfo->msgInfo.sim_idx, &smsc);
+
+ // Get TAPI handle
+ struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pReqInfo->msgInfo.sim_idx);
+
+ // Get address informations.
+ MsgDbHandler *dbHandle = getDbHandle();
+ //contacts-service is not used for gear
+#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+ MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
+#else
+ //contactNameOrder is never used
+ MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
+#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
- for (i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++)
+ // Get MSISDN
+ char *msisdn = NULL;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pReqInfo->msgInfo.sim_idx);
+ msisdn = MsgSettingGetString(keyName);
+
+ for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++)
{
// Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S
SMS_SUBMIT_DATA_S submitData = {{0},};
msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
+ // Insert message reference into db
+ if (tpdu.data.submit.bStatusReport == true) {
+ SmsPluginStorage::instance()->insertMsgRef(&(pReqInfo->msgInfo), tpdu.data.submit.msgRef, i);
+ }
+
// Encode SMSC Address
unsigned char smscAddr[MAX_SMSC_LEN];
memset(smscAddr, 0x00, sizeof(smscAddr));
@@ -128,12 +137,12 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
if (smscLen <= 0) {
MSG_DEBUG("smscLen <= 0");
- return;
+ goto _RETURN_FUNC;
}
char smscAddrTmp[(smscLen*2)+1];
memset(smscAddrTmp, 0x00, sizeof(smscAddrTmp));
- for (j = 0; j < smscLen; j++) {
+ for (int j = 0; j < smscLen; j++) {
snprintf(smscAddrTmp+(j*2), sizeof(smscAddrTmp)-(j*2), "%02X", smscAddr[j]);
}
MSG_DEBUG("pSCAInfo [%s]", smscAddrTmp);
@@ -151,13 +160,17 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, addLen);
tpdu.data.submit.destAddress.address[addLen] = '\0';
} else {
- memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ if (submitData.destAddress.address[0] == '+')
+ memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ else
+ memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN-1);
+
tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
}
MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
-MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
+MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
bool bStatusReport = false;
@@ -179,89 +192,144 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
memset(&(tpdu.data.submit.userData), 0x00, sizeof(SMS_USERDATA_S));
memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
- // Encode SMS-SUBMIT TPDU
- memset(buf, 0x00, sizeof(buf));
+ SMS_NETWORK_STATUS_T retStatus = SMS_NETWORK_SENDING;
- bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
+ bool bMoreMsg = false;
- // Make Telephony Structure
- TelSmsDatapackageInfo_t pkgInfo;
+ int retMoCtrlStatus = TAPI_SAT_CALL_CTRL_R_ALLOWED_NO_MOD;
+ bool bRetryByMoCtrl = false;
+ bool bSatMoCtrl = false;
- // Set TPDU data
- memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
- memcpy((void*)pkgInfo.szData, buf, bufLen);
- pkgInfo.szData[bufLen] = 0;
- pkgInfo.MsgLength = bufLen;
+ for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt)
+ {
+ // Encode SMS-SUBMIT TPDU
+ memset(buf, 0x00, sizeof(buf));
- // Set SMSC data
- memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
- memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
- pkgInfo.Sca[smscLen] = '\0';
+ if (cnt > 0)
+ tpdu.data.submit.bRejectDup = true;
+ bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
- char pkgInfoTmp[(pkgInfo.MsgLength*2)+1];
- memset(pkgInfoTmp, 0x00, sizeof(pkgInfoTmp));
- for (j = 0; j < pkgInfo.MsgLength; j++) {
- snprintf(pkgInfoTmp+(j*2), sizeof(pkgInfoTmp)-(j*2), "%02X", pkgInfo.szData[j]);
- }
- MSG_DEBUG("Submit Request TPDU.");
- MSG_DEBUG("[%s]", pkgInfoTmp);
+ // Make Telephony Structure
+ TelSmsDatapackageInfo_t pkgInfo;
- SMS_SENT_INFO_S sentInfo;
- memset(&sentInfo, 0x00, sizeof(SMS_SENT_INFO_S));
+ // Set TPDU data
+ memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
+ memcpy((void*)pkgInfo.szData, buf, bufLen);
- bool bMoreMsg = FALSE;
+ pkgInfo.szData[bufLen] = 0;
+ pkgInfo.MsgLength = bufLen;
+ pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
- memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S));
+ // Set SMSC data
+ memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
+ memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
+ pkgInfo.Sca[smscLen] = '\0';
- if ((segCnt+1) == submitData.segCount && (i+1)==pReqInfo->msgInfo.nAddressCnt)
- {
- sentInfo.bLast = true;
+
+ char pkgInfoTmp[(pkgInfo.MsgLength*2)+1];
+ memset(pkgInfoTmp, 0x00, sizeof(pkgInfoTmp));
+ for (int j = 0; j < pkgInfo.MsgLength; j++) {
+ snprintf(pkgInfoTmp+(j*2), sizeof(pkgInfoTmp)-(j*2), "%02X", pkgInfo.szData[j]);
+ }
+ MSG_INFO("Submit Request TPDU. try cnt : %d", cnt+1);
+ MSG_INFO("[%s]", pkgInfoTmp);
+
+ SMS_SENT_INFO_S sentInfo;
+ memset(&sentInfo, 0x00, sizeof(SMS_SENT_INFO_S));
bMoreMsg = FALSE;
- }
- else
- {
- sentInfo.bLast = false;
- bMoreMsg = TRUE;
- }
+ memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S));
- SmsPluginEventHandler::instance()->SetSentInfo(&sentInfo);
+ if ((segCnt+1) == submitData.segCount && (i+1)==pReqInfo->msgInfo.nAddressCnt)
+ {
+ sentInfo.bLast = true;
+ bMoreMsg = FALSE;
+ }
+ else
+ {
+ sentInfo.bLast = false;
+ bMoreMsg = TRUE;
+ }
- curStatus = MSG_NETWORK_SENDING;
+ SmsPluginEventHandler::instance()->SetSentInfo(&sentInfo);
- // Send SMS
- int tapiRet = TAPI_API_SUCCESS;
+ curStatus = SMS_NETWORK_SENDING;
- tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, bMoreMsg, TapiEventSentStatus, NULL);
+ // Send SMS
+ int tapiRet = TAPI_API_SUCCESS;
- if (tapiRet == TAPI_API_SUCCESS)
- {
- MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
- }
- else
- {
- SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+ tapiRet = tel_send_sms(handle, &pkgInfo, bMoreMsg, TapiEventSentStatus, (void *)&curMoCtrlData);
- THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
- }
+ if (tapiRet == TAPI_API_SUCCESS)
+ {
+ MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MO_CONTROL, pReqInfo->msgInfo.sim_idx);
+ if (MsgSettingGetBool(keyName, &bSatMoCtrl) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
+
+ if (bSatMoCtrl) {
+ // Get SAT MO SM control
+ retMoCtrlStatus = getMoCtrlStatus();
+ MSG_DEBUG("retMoCtrlStatus = [%d]", retMoCtrlStatus);
+
+ if (retMoCtrlStatus == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) {
+
+ if (bRetryByMoCtrl == false) {
+ bRetryByMoCtrl = true;
+
+ // Modify Address with control data
+ memset(smsc.address, 0x00, sizeof(smsc.address));
+ memcpy(smsc.address, curMoCtrlData.rpDestAddr.string, sizeof(smsc.address)-1);
+
+ memset(smscAddr, 0x00, sizeof(smscAddr));
+ smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
+
+ MSG_SEC_DEBUG("SMSC address=[%s], Encoded length=[%d]", smsc.address, smscLen);
+
+ if (curMoCtrlData.tpDestAddr.stringLen < MAX_ADDRESS_LEN) {
+ memcpy(tpdu.data.submit.destAddress.address, curMoCtrlData.tpDestAddr.string, curMoCtrlData.tpDestAddr.stringLen);
+ tpdu.data.submit.destAddress.address[curMoCtrlData.tpDestAddr.stringLen] = '\0';
+ } else {
+ memcpy(tpdu.data.submit.destAddress.address, submitData.destAddress.address, MAX_ADDRESS_LEN);
+ tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
+ }
+ } else {
+ curMoCtrlData.moSmsCtrlResult = TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED;
+ }
+ }
+ }
+ }
+ else
+ {
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- // Tizen Validation System
- char *msisdn = NULL;
- msisdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ if (msisdn) {
+ free(msisdn);
+ msisdn = NULL;
+ }
+ THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
+ }
+
+ // Tizen Validation System
+ MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
+ (msisdn == NULL)?"ME":msisdn, \
+ pReqInfo->msgInfo.addressList[0].addressVal, \
+ (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
- MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
- (msisdn == NULL)?"ME":msisdn, \
- pReqInfo->msgInfo.addressList[0].addressVal, \
- (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
+ MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
- MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
+ retStatus = getNetStatus();
- msg_network_status_t retStatus = getNetStatus();
+ if (retStatus != SMS_NETWORK_SEND_FAIL_TEMPORARY && retStatus != SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD)
+ break;
+ }
- #ifdef MSG_SMS_REPORT
+#ifdef MSG_SMS_REPORT
if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false)
{
if(pReqInfo->sendOptInfo.bDeliverReq == true)
@@ -272,40 +340,62 @@ MSG_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
MsgStoAddDeliveryReportStatus( tmpInfo.msgInfo.msgId, (unsigned char)tmpInfo.msgInfo.referenceId);
}
}
- #endif
+#endif
MSG_SMS_VLD_INFO("%d, SMS Send End, %s->%s, %s", pReqInfo->msgInfo.msgId, \
(msisdn == NULL)?"ME":msisdn, \
pReqInfo->msgInfo.addressList[0].addressVal, \
- (retStatus == MSG_NETWORK_SEND_SUCCESS)?"Success":"Fail");
+ (retStatus == SMS_NETWORK_SEND_SUCCESS)?"Success":"Fail");
-
- if (retStatus == MSG_NETWORK_SEND_SUCCESS)
+ if (retStatus == SMS_NETWORK_SEND_SUCCESS)
{
- if (bMoreMsg == false) {
- MsgInsertTicker("SMS is sent", SMS_MESSAGE_SENT);
+ bool bTTS = false;
+
+ if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) {
+ MSG_DEBUG("MsgSettingGetBool is failed.");
+ }
+
+ if (bTTS) {
+ if (bMoreMsg == false) {
+ MsgInsertTicker("SMS is sent", SMS_MESSAGE_SENT, false, 0);
+ }
+ MSG_DEBUG("######## Msg Sent was Successful !!! #######");
}
- MSG_DEBUG("######## Msg Sent was Successful !!! return : [%d] #######", retStatus);
}
else
{
- //MsgInsertTicker("Sending SMS is failed", NULL);
- MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL);
+ if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT || retStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY || retStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD)
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+ if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
+ MsgInsertTicker("Unable to send the message while Fixed dialling mode is enabled", SMS_FDN_RESTRICTED, true, 0);
+ } else {
+ MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, pReqInfo->msgInfo.msgId);
+ }
+ if (msisdn) {
+ free(msisdn);
+ msisdn = NULL;
+ }
THROW(MsgException::SMS_PLG_ERROR, "######## Msg Sent was Failed !!! return : [%d] #######", retStatus);
}
if (tpdu.data.submit.userData.headerCnt > 0) tpdu.data.submit.userData.headerCnt--;
+
}
}
+_RETURN_FUNC :
+ if (msisdn) {
+ free(msisdn);
+ msisdn = NULL;
+ }
MSG_END();
+ return;
}
-void SmsPluginTransport::sendDeliverReport(msg_error_t err)
+void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error_t err)
{
MSG_BEGIN();
@@ -317,29 +407,37 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
int tapiRet = TAPI_API_SUCCESS;
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
if (err == MSG_SUCCESS)
{
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
-
- if (tapiRet == TAPI_API_SUCCESS)
+ if(isMemAvailable == false)
{
- MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
- else
- {
- MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
+
+ if (tapiRet == TAPI_API_SUCCESS)
+ {
+ MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
+ }
+ else
+ {
+ MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
+ }
}
}
else if (err == MSG_ERR_SIM_STORAGE_FULL)
{
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
- tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
+ tpdu.data.deliverRep.failCause = SMS_FC_SIM_STORAGE_FULL;
+
response = TAPI_NETTEXT_SIM_FULL;
+ MsgInsertTicker("Sim memory full. Delete some items", SMS_MESSAGE_SIM_MESSAGE_FULL, true, 0);
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
+#if 0
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -349,14 +447,15 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
{
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
}
+#endif
}
else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
{
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
response = TAPI_NETTEXT_ME_FULL;
-
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
+ MsgInsertTicker("Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL, true, 0);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -410,12 +509,13 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
pkgInfo.szData[bufLen] = 0;
pkgInfo.MsgLength = bufLen;
+ pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
// Set SMSC Address
SMS_ADDRESS_S smsc;
// Set SMSC Options
- setSmscOptions(&smsc);
+ setSmscOptions(simIndex, &smsc);
// Encode SMSC Address
unsigned char smscAddr[MAX_SMSC_LEN];
@@ -431,7 +531,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
pkgInfo.Sca[smscLen] = '\0';
// Send Deliver Report
- tapiRet = tel_send_sms_deliver_report(pTapiHandle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
+ tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -445,7 +545,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err)
MSG_END();
}
-void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
+void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg_error_t err)
{
MSG_BEGIN();
@@ -457,12 +557,14 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
int tapiRet = TAPI_API_SUCCESS;
+ int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
+
if (err == MSG_SUCCESS)
{
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -478,7 +580,7 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -494,7 +596,7 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
+ tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -537,12 +639,13 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
pkgInfo.szData[bufLen] = 0;
pkgInfo.MsgLength = bufLen;
+ pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
// Set SMSC Address
SMS_ADDRESS_S smsc;
// Set SMSC Options
- setSmscOptions(&smsc);
+ setSmscOptions(simIndex, &smsc);
// Encode SMSC Address
unsigned char smscAddr[MAX_SMSC_LEN];
@@ -558,7 +661,7 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
pkgInfo.Sca[smscLen] = '\0';
// Send Deliver Report
- tapiRet = tel_send_sms_deliver_report(pTapiHandle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
+ tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
@@ -573,8 +676,7 @@ void SmsPluginTransport::sendClass0DeliverReport(msg_error_t err)
}
-
-void SmsPluginTransport::setSmsSendOptions(SMS_SUBMIT_S *pSubmit)
+void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit)
{
// Set SMS Send Options
pSubmit->bRejectDup = false;
@@ -593,78 +695,115 @@ void SmsPluginTransport::setSmsSendOptions(SMS_SUBMIT_S *pSubmit)
MSG_DEBUG("DCS : %d", pSubmit->dcs.codingScheme);
- int selectIdx = MsgSettingGetInt(SMSC_SELECTED);
+ MSG_SMSC_LIST_S smscList = {0,};
+ SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList);
- char keyName[128];
+ int selectIdx = smscList.selected;
+ int valPeriod = 0;
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_PID, selectIdx);
- MSG_SMS_PID_T pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName);
+ if (selectIdx < SMSC_LIST_MAX) {
+ MSG_SMS_PID_T pid = smscList.smscData[selectIdx].pid;
+ pSubmit->pid = convertPid(pid);
+
+ valPeriod = smscList.smscData[selectIdx].valPeriod;
+ } else {
+ MSG_WARN("Invalid case");
+ pSubmit->pid = SMS_PID_NORMAL;
+ valPeriod = 255;
+ }
- pSubmit->pid = convertPid(pid);
MSG_DEBUG("PID : %d", pSubmit->pid);
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, selectIdx);
- int valPeriod = MsgSettingGetInt(keyName);
+ pSubmit->vpf = SMS_VPF_NOT_PRESENT; // default value
MSG_DEBUG("valPeriod : %d", valPeriod);
+ MSG_DEBUG("vpf : %d", pSubmit->vpf);
+}
- if (valPeriod == 0)
- {
- pSubmit->vpf = SMS_VPF_NOT_PRESENT;
+
+void SmsPluginTransport::setSmsSendOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu)
+{
+ if (!pReqInfo || !pSmsTpdu) {
+ MSG_DEBUG("Input param is NULL");
+ return;
}
- else
+
+ if (pReqInfo->sendOptInfo.bSetting == true)
{
- pSubmit->vpf = SMS_VPF_RELATIVE;
- pSubmit->validityPeriod.format = SMS_TIME_RELATIVE;
- pSubmit->validityPeriod.time.relative.time = valPeriod;
+ pSmsTpdu->data.submit.bStatusReport = pReqInfo->sendOptInfo.bDeliverReq;
+ pSmsTpdu->data.submit.bReplyPath = pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath;
}
}
-void SmsPluginTransport::setSmscOptions(SMS_ADDRESS_S *pSmsc)
+void SmsPluginTransport::setSmsDcsOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu)
{
- // Set SMSC Options
- int selectIdx = MsgSettingGetInt(SMSC_SELECTED);
-
- char keyName[128];
+ if (!pReqInfo || !pSmsTpdu) {
+ MSG_DEBUG("Input param is NULL");
+ return;
+ }
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_ADDRESS, selectIdx);
+ if (pReqInfo->msgInfo.msgPort.valid == true) {
+ // Set Coding Scheme for apps that use port number
+ pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
+ MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
+ } else {
+ // Change coding scheme if it is set coding scheme by apps
+ if (pSmsTpdu->data.submit.dcs.codingScheme == SMS_CHARSET_7BIT && pReqInfo->msgInfo.encodeType != MSG_ENCODE_GSM7BIT) {
+ pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
+ MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
+ }
+ }
+}
- char* tmpValue = NULL;
- tmpValue = MsgSettingGetString(keyName);
+void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu)
+{
+ if (!pReqInfo || !pSmsTpdu) {
+ MSG_DEBUG("Input param is NULL");
+ return;
+ }
- if (tmpValue != NULL)
+#ifdef MSG_SMS_REPORT
+ // Update Msg Ref into Report Table
+ if (pSmsTpdu->data.submit.bStatusReport == true)
{
- memset(pSmsc->address, 0x00, sizeof(pSmsc->address));
- strncpy(pSmsc->address, tmpValue, MAX_ADDRESS_LEN);
+ MSG_DEBUG("Update Msg Ref [%d] in Report Table", pSmsTpdu->data.submit.msgRef);
- MSG_DEBUG("address : %s", pSmsc->address);
+ SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, pSmsTpdu->data.submit.msgRef);
}
- else
- {
- strncpy(pSmsc->address, "+8210911111", MAX_ADDRESS_LEN);
+#endif
+
+ // Set Message Reference
+ if (pSmsTpdu->data.submit.bStatusReport == true) {
+ pSmsTpdu->data.submit.msgRef = (pReqInfo->msgInfo.msgId % 256);
}
+}
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_TON, selectIdx);
- pSmsc->ton = (SMS_TON_T)MsgSettingGetInt(keyName);
- MSG_DEBUG("ton : %d", pSmsc->ton);
+void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc)
+{
+ // Set SMSC Options
+ MSG_SMSC_LIST_S smscList = {0,};
+ SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList);
- memset(keyName, 0x00, sizeof(keyName));
- sprintf(keyName, "%s/%d", SMSC_NPI, selectIdx);
- pSmsc->npi = (SMS_NPI_T)MsgSettingGetInt(keyName);
+ int selectIdx = smscList.selected;
- MSG_DEBUG("npi : %d", pSmsc->npi);
+ if (selectIdx < SMSC_LIST_MAX) {
+ if (smscList.smscData[selectIdx].smscAddr.address[0] != '\0') {
+ memset(pSmsc->address, 0x00, sizeof(pSmsc->address));
+ strncpy(pSmsc->address, smscList.smscData[selectIdx].smscAddr.address, MAX_ADDRESS_LEN);
- if (tmpValue != NULL)
- {
- free(tmpValue);
- tmpValue = NULL;
+ MSG_SEC_DEBUG("address : %s", pSmsc->address);
+ } else {
+ memset(pSmsc->address, 0x00, MAX_ADDRESS_LEN);
+ }
+
+ pSmsc->ton = (SMS_TON_T)smscList.smscData[selectIdx].smscAddr.ton;
+ MSG_DEBUG("ton : %d", pSmsc->ton);
+
+ pSmsc->npi = (SMS_NPI_T)smscList.smscData[selectIdx].smscAddr.npi;
+ MSG_DEBUG("npi : %d", pSmsc->npi);
}
}
@@ -680,13 +819,15 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
MSG_DEBUG("ton [%d]", pData->destAddress.ton);
MSG_DEBUG("npi [%d]", pData->destAddress.npi);
- MSG_DEBUG("address [%s]", pData->destAddress.address);
+ MSG_SEC_DEBUG("address [%s]", pData->destAddress.address);
int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1; // SMS_CHARSET_7BIT
unsigned char decodeData[bufSize];
memset(decodeData, 0x00, sizeof(decodeData));
+ MsgTextConvert *textCvt = MsgTextConvert::instance();
+
msg_encode_type_t encodeType = MSG_ENCODE_GSM7BIT;
MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED;
@@ -698,7 +839,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
{
if (*pCharType == SMS_CHARSET_7BIT)
{
- decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &bAbnormal);
+ decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &bAbnormal);
}
else if (*pCharType == SMS_CHARSET_8BIT)
{
@@ -707,11 +848,11 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
else if (*pCharType == SMS_CHARSET_UCS2)
{
- decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize);
+ decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize);
}
else if (*pCharType == SMS_CHARSET_AUTO)
{
- decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &encodeType);
+ decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &encodeType);
*pCharType = encodeType;
}
}
@@ -730,7 +871,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
if (*pCharType == SMS_CHARSET_7BIT)
{
- decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &bAbnormal);
+ decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &bAbnormal);
}
else if (*pCharType == SMS_CHARSET_8BIT)
{
@@ -739,11 +880,11 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
else if (*pCharType == SMS_CHARSET_UCS2)
{
- decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
+ decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
}
else if (*pCharType == SMS_CHARSET_AUTO)
{
- decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
+ decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &encodeType);
*pCharType = encodeType;
}
@@ -755,7 +896,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
MSG_DEBUG("decode length : [%d]", decodeLen);
MSG_DEBUG("character type : [%d]", *pCharType);
MSG_DEBUG("Language Identifier : [%d]", langId);
-MSG_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
+MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
int addrLen = 0;
@@ -938,22 +1079,22 @@ void SmsPluginTransport::setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstH
}
-void SmsPluginTransport::setNetStatus(msg_network_status_t netStatus)
+void SmsPluginTransport::setNetStatus(SMS_NETWORK_STATUS_T sentStatus)
{
mx.lock();
- curStatus = netStatus;
+ curStatus = sentStatus;
cv.signal();
mx.unlock();
}
-msg_network_status_t SmsPluginTransport::getNetStatus()
+SMS_NETWORK_STATUS_T SmsPluginTransport::getNetStatus()
{
mx.lock();
int ret = 0;
- if (curStatus == MSG_NETWORK_SENDING)
+ if (curStatus == SMS_NETWORK_SENDING)
ret = cv.timedwait(mx.pMutex(), 125);
mx.unlock();
@@ -961,13 +1102,48 @@ msg_network_status_t SmsPluginTransport::getNetStatus()
if (ret == ETIMEDOUT)
{
MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
- curStatus = MSG_NETWORK_SEND_TIMEOUT;
+ curStatus = SMS_NETWORK_SEND_FAIL_TIMEOUT;
}
return curStatus;
}
+void SmsPluginTransport::setMoCtrlStatus(TelSatMoSmCtrlIndData_t *moCtrlData)
+{
+ mx.lock();
+
+ if (moCtrlData) {
+ memset(&curMoCtrlData, 0x00, sizeof(TelSatMoSmCtrlIndData_t));
+ memcpy(&curMoCtrlData, moCtrlData, sizeof(TelSatMoSmCtrlIndData_t));
+ MSG_DEBUG("MO Control Data is set by Tapi Event Noti");
+ }
+
+ cv.signal();
+ mx.unlock();
+}
+
+
+int SmsPluginTransport::getMoCtrlStatus()
+{
+ mx.lock();
+
+ int ret = 0;
+
+ ret = cv.timedwait(mx.pMutex(), 10);
+
+ mx.unlock();
+
+ if (ret == ETIMEDOUT)
+ {
+ MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
+ return -1;
+ }
+
+ return (curMoCtrlData.moSmsCtrlResult);
+}
+
+
unsigned char SmsPluginTransport::getMsgRef()
{
return msgRef++;
diff --git a/plugin/sms_plugin/SmsPluginUAManager.cpp b/plugin/sms_plugin/SmsPluginUAManager.cpp
index d3db925..b5b0892 100755
--- a/plugin/sms_plugin/SmsPluginUAManager.cpp
+++ b/plugin/sms_plugin/SmsPluginUAManager.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include "MsgDebug.h"
@@ -58,11 +55,16 @@ void SmsPluginUAManager::run()
{
while (1)
{
- if (smsTranQ.empty())
- cv.wait(mx.pMutex());
-
+ lock();
+ while (smsTranQ.empty()) {
+ wait();
+ }
SMS_REQUEST_INFO_S request;
smsTranQ.front(&request);
+ unlock();
+
+ request.msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&request.msgInfo.addressList);
try
{
@@ -72,18 +74,23 @@ void SmsPluginUAManager::run()
{
MSG_FATAL("%s", e.what());
+ lock();
smsTranQ.pop_front();
+ unlock();
continue;
}
catch (exception& e)
{
MSG_FATAL("%s", e.what());
-
+ lock();
smsTranQ.pop_front();
+ unlock();
continue;
}
+ lock();
smsTranQ.pop_front();
+ unlock();
}
}
@@ -93,7 +100,12 @@ void SmsPluginUAManager::addReqEntity(SMS_REQUEST_INFO_S *request)
SMS_REQUEST_INFO_S reqTmp = {0,};
memcpy(&reqTmp, request, sizeof(SMS_REQUEST_INFO_S));
+
+ lock();
+
smsTranQ.push_back(reqTmp);
cv.signal();
+
+ unlock();
}
diff --git a/plugin/sms_plugin/SmsPluginUDCodec.cpp b/plugin/sms_plugin/SmsPluginUDCodec.cpp
index b558f93..2b821be 100755
--- a/plugin/sms_plugin/SmsPluginUDCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginUDCodec.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include "MsgDebug.h"
@@ -160,6 +157,15 @@ MSG_DEBUG("dataLen [%d]", pUserData->length);
MSG_DEBUG("packSize [%d]", packSize);
MSG_DEBUG("encodeLen [%d]", encodeLen);
+#if 0
+printf("\n\n[encodeGSMData] userData data.\n");
+for (int j = 0; j < encodeLen; j++)
+{
+ printf(" [%02x]", pEncodeData[j]);
+}
+printf("\n\n");
+#endif
+
return encodeLen;
}
@@ -242,6 +248,15 @@ MSG_DEBUG("dataLen [%d]", pUserData->length);
encodeLen = offset + pUserData->length;
+#if 0
+printf("\n\n[encodeUCS2Data] userData data.\n");
+for (int j = 0; j < encodeLen; j++)
+{
+ printf(" [%02x]", pEncodeData[j]);
+}
+printf("\n\n");
+#endif
+
return encodeLen;
}
@@ -579,6 +594,11 @@ int SmsPluginUDCodec::encodeHeader(const SMS_UDH_S header, char *pEncodeHeader)
addrLen = SmsPluginParamCodec::encodeAddress(&(header.udh.alternateAddress), &encodedAddr);
+//MSG_DEBUG("addrLen : %d", addrLen);
+
+//for (int i = 0; i < addrLen; i++)
+// MSG_DEBUG("header.udh.alternateAddress.address : [%02x]", encodedAddr[i]);
+
// IEDL
pEncodeHeader[offset++] = addrLen;
@@ -712,7 +732,7 @@ MSG_DEBUG("Decoding special sms udh.");
offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pHeader->udh.alternateAddress));
-MSG_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
+ MSG_SEC_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
}
break;
@@ -777,11 +797,11 @@ int SmsPluginUDCodec::pack7bitChar(const unsigned char *pUserData, int dataLen,
pPackData[dstIdx] = pUserData[srcIdx];
//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx]);
- if (srcIdx >= dataLen) break;
-
shift = 7;
srcIdx++;
dstIdx++;
+
+ if (srcIdx >= dataLen) break;
}
if (shift > 1)
diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
index 395998a..e568313 100755
--- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include "MsgDebug.h"
@@ -27,9 +24,11 @@
#include "SmsPluginEventHandler.h"
#include "SmsPluginWapPushHandler.h"
-
+#include <glib.h>
+#include <gio/gio.h>
+#if MSG_DRM_SUPPORT
#include <drm_client.h>
-#include <dbus/dbus-glib.h>
+#endif
static unsigned short wapPushPortList [] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F};
@@ -616,7 +615,21 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
{ (char*)"x-wap-application:syncml.dm", 0x07 },
{ (char*)"x-wap-application:drm.ua", 0x08 },
{ (char*)"x-wap-application:emn.ua", 0x09 },
+ { (char*)"x-oma-application:ulp.ua ", 0x10 },
+ { (char*)"x-oma-docomo:open.ctl", 0x9055 },
{ (char*)"x-oma-docomo:xmd.mail.ua", 0x905C },
+ { (char*)"x-oma-docomo:xmd.storage.ua", 0x905F },
+ { (char*)"x-oma-docomo:xmd.lcsapp.ua", 0x9060 },
+ { (char*)"x-oma-docomo:xmd.info.ua", 0x9061 },
+ { (char*)"x-oma-docomo:xmd.agent.ua", 0x9062 },
+ { (char*)"x-oma-docomo:xmd.sab.ua", 0x9063 },
+ { (char*)"x-oma-docomo:xmd.am.ua", 0x9064 },
+ { (char*)"x-oma-docomo:xmd.emdm.ua", 0x906B },
+ { (char*)"x-oma-docomo:xmd.lac.ua", 0x906C },
+ { (char*)"x-oma-docomo:xmd.osv.ua", 0x906D },
+ { (char*)"x-oma-docomo:xmd.dcs.ua", 0x906E },
+ { (char*)"x-oma-docomo:xmd.wipe.ua", 0x906F },
+ { (char*)"x-oma-docomo:xmd.vdapp.ua ", 0x9070 },
};
@@ -795,7 +808,7 @@ void SmsPluginWapPushHandler::copyDeliverData(SMS_DELIVER_S *pDeliver)
strncpy(tmpAddress.address, pDeliver->originAddress.address, MAX_ADDRESS_LEN);
- MSG_DEBUG("Address [%s]", tmpAddress.address);
+ MSG_SEC_DEBUG("Address [%s]", tmpAddress.address);
tmpTimeStamp.format = pDeliver->timeStamp.format;
@@ -811,7 +824,7 @@ void SmsPluginWapPushHandler::copyDeliverData(SMS_DELIVER_S *pDeliver)
}
-void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSize)
+void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSize, int simIndex)
{
MSG_BEGIN();
@@ -926,7 +939,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
return;
}
- handleWapPushCallback((char *)pPushHeader, (char *)pPushBody, (int)pushBodyLen, (char *)pWspHeader, (int)wspHeaderLen, (char *)pWspBody, (int)wspBodyLen);
+ handleWapPushCallback((char *)pPushHeader, (char *)pPushBody, (int)pushBodyLen, (char *)pWspHeader, (int)wspHeaderLen, (char *)pWspBody, (int)wspBodyLen, simIndex);
MSG_END();
}
@@ -1083,8 +1096,12 @@ static void launchProcessByAppcode(int appcode)
{
MSG_BEGIN();
GError *error = NULL;
- DBusGConnection *connection = NULL;
- DBusGProxy *dbus_proxy;
+ GDBusConnection *connection_agent = NULL;
+ GDBusProxy *dbus_proxy_agent = NULL;
+ GDBusConnection *connection_service = NULL;
+ GDBusProxy *dbus_proxy_service = NULL;
+ GVariant *result_agent = NULL;
+ GVariant *result_service = NULL;
switch(appcode){
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
@@ -1095,47 +1112,125 @@ static void launchProcessByAppcode(int appcode)
case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
{
- connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (error != NULL) {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- g_error_free(error);
- MSG_END();
+ goto _DBUS_ERROR;
+ }
+
+ dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
+ "org.tizen.omadmagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- dbus_proxy = dbus_g_proxy_new_for_name(connection, "com.samsung.omadmagent",
- "/com/samsung/omadmagent", "com.samsung.omadmagent");
- MSG_DEBUG("dbus_proxy %x", dbus_proxy);
- dbus_g_proxy_call(dbus_proxy, "Hello_Agent", &error, G_TYPE_INVALID, G_TYPE_INVALID);
- g_object_unref(dbus_proxy);
- dbus_g_connection_unref(connection);
+
+ connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.tizen.omadmservice", "/org/tizen/omadmservice",
+ "org.tizen.omadmservice", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ Mutex mx;
+ CndVar cv;
+ mx.lock();
+ cv.timedwait(mx.pMutex(), 2);
+ mx.unlock();
+
MSG_END();
}
break;
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
{
- connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (error != NULL) {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- g_error_free(error);
- MSG_END();
+ goto _DBUS_ERROR;
+ }
+
+ dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.tizen.omadsagent", "/org/tizen/omadsagent",
+ "org.tizen.omadsagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking service error: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- dbus_proxy = dbus_g_proxy_new_for_name(connection, "com.samsung.omadsagent",
- "/com/samsung/omadsagent", "com.samsung.omadsagent");
- MSG_DEBUG("dbus_proxy %x", dbus_proxy);
- dbus_g_proxy_call(dbus_proxy, "Hello_Agent", &error, G_TYPE_INVALID, G_TYPE_INVALID);
- g_object_unref(dbus_proxy);
- dbus_g_connection_unref(connection);
- MSG_END();
}
break;
default:
break;
}
+
+_DBUS_ERROR:
+ if (error) {
+ g_error_free(error);
+ error = NULL;
+ }
+
+ if (connection_agent) {
+ g_object_unref(connection_agent);
+ connection_agent = NULL;
+ }
+
+ if (dbus_proxy_agent) {
+ g_object_unref(dbus_proxy_agent);
+ dbus_proxy_agent = NULL;
+ }
+
+ if (result_agent) {
+ g_object_unref(result_service);
+ result_service = NULL;
+ }
+
+ if (connection_service) {
+ g_object_unref(connection_service);
+ connection_service = NULL;
+ }
+
+ if (dbus_proxy_service) {
+ g_object_unref(dbus_proxy_service);
+ dbus_proxy_service = NULL;
+ }
+
+ if (result_service) {
+ g_object_unref(result_service);
+ result_service = NULL;
+ }
+
MSG_END();
}
-void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen)
+void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex)
{
MSG_BEGIN();
@@ -1150,9 +1245,9 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN] = {0,};
SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
- err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id, content_type);
+ err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id, sizeof(app_id), content_type, sizeof(content_type));
MSG_DEBUG("pushEvt_cnt: %d", pushEvt_cnt);
- if(err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS) {
MSG_DEBUG("Fail to get registered push event");
return;
}
@@ -1171,83 +1266,90 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
return;
}
+#ifdef FEATURE_MMS_DISABLE
+ if (appcode == SMS_WAP_APPLICATION_MMS_UA){
+ MSG_DEBUG("Drop MMS Notification for DOCOMO");
+ return;
+ }
+
+#endif
launchProcessByAppcode(appcode);
switch (appcode) {
case SMS_WAP_APPLICATION_MMS_UA:
MSG_DEBUG("Received MMS Notification");
- handleMMSNotification(pPushBody, PushBodyLen);
+ handleMMSNotification(pPushBody, PushBodyLen, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_SI:
MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
- handleSIMessage(pPushBody, PushBodyLen, true);
+ handleSIMessage(pPushBody, PushBodyLen, true, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_SIC:
MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
- handleSIMessage(pPushBody, PushBodyLen, false);
+ handleSIMessage(pPushBody, PushBodyLen, false, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_SL:
MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
- handleSLMessage(pPushBody, PushBodyLen, true);
+ handleSLMessage(pPushBody, PushBodyLen, true, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_SLC:
MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
- handleSLMessage(pPushBody, PushBodyLen, false);
+ handleSLMessage(pPushBody, PushBodyLen, false, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_CO:
MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
- handleCOMessage(pPushBody, PushBodyLen, true);
+ handleCOMessage(pPushBody, PushBodyLen, true, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_COC:
MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
- handleCOMessage(pPushBody, PushBodyLen, false);
+ handleCOMessage(pPushBody, PushBodyLen, false, simIndex);
break;
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
MSG_DEBUG("Received DM BOOTSTRAP");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
MSG_DEBUG("Received DM BOOTSTRAP");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
MSG_DEBUG("Received Provisioning");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
MSG_DEBUG("Received Provisioning");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
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);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
MSG_DEBUG("Received DM Notification");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
MSG_DEBUG("Received DS Notification");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
MSG_DEBUG("Received DS Notification");
- SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
+ SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen, simIndex);
break;
case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
@@ -1266,14 +1368,14 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_DEBUG("Received DRM V2");
// TODO: DRM V2
break;
-#if 0
+
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;
-#endif
+
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
@@ -1302,7 +1404,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
}
#endif
-void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen)
+void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex)
{
MSG_BEGIN();
@@ -1320,13 +1422,18 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
+
createMsgInfo(&msgInfo);
/** Convert Type values */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS;
+ msgInfo.msgType.classType = MSG_CLASS_NONE;
msgInfo.storageId = MSG_STORAGE_PHONE;
msgInfo.dataSize = PushBodyLen;
+ msgInfo.sim_idx = simIndex;
if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
msgInfo.bTextSms = false;
@@ -1352,7 +1459,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
msg_error_t err = MSG_SUCCESS;
/** Add MMS Noti Msg into DB */
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
/** Callback */
@@ -1362,13 +1469,13 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
}
} else {
- MSG_DEBUG("addMessage() Error !! [%d]", err);
+ MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
MSG_END();
}
-void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen, bool isText)
+void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex)
{
MSG_BEGIN();
@@ -1404,7 +1511,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
while (indNode != NULL) {
if (!xmlStrcmp(indNode->name, (const xmlChar*) "indication")) {
- MSG_DEBUG("indNode->name = %s\n", indNode->name);
+ MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name);
break;
}
@@ -1433,7 +1540,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
}
if (tmpXmlChar != NULL)
- strncpy(pushMsg.href, (char*)tmpXmlChar, MAX_WAPPUSH_HREF_LEN-1);
+ strncpy(pushMsg.href, (char*)tmpXmlChar, MAX_WAPPUSH_HREF_LEN-1);
tmpXmlChar = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_SI_ID_TAG);
@@ -1484,6 +1591,10 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
/** Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
+ memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
createMsgInfo(&msgInfo);
@@ -1494,6 +1605,8 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
msgInfo.msgType.subType = MSG_WAP_SI_SMS;
msgInfo.dataSize = sizeof(pushMsg);
+ msgInfo.sim_idx = simIndex;
+ getDisplayName(msgInfo.msgType.subType, msgInfo.addressList[0].addressVal);
xmlFree(xmlDoc);
xmlFree(tmpXmlChar);
@@ -1501,7 +1614,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
msg_error_t err = MSG_SUCCESS;
/** Add WAP Push Msg into DB */
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
/** Callback */
@@ -1511,7 +1624,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
}
} else {
- MSG_DEBUG("addMessage() Error !! [%d]", err);
+ MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
MSG_END();
@@ -1520,7 +1633,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
}
-void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen, bool isText)
+void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex)
{
MSG_BEGIN();
@@ -1553,14 +1666,14 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
xmlFreeDoc(xmlDoc);
return;
} else {
- MSG_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name );
+ MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name );
}
indNode = topNode;
while (indNode != NULL) {
if (!xmlStrcmp(indNode->name, (const xmlChar*) "sl")) {
- MSG_DEBUG("indNode->name = %s\n",indNode->name);
+ MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
break;
}
@@ -1595,7 +1708,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("pushMsg.received : [%d]", pushMsg.received);
MSG_DEBUG("pushMsg.created : [%d]", pushMsg.created);
MSG_DEBUG("pushMsg.expires : [%d]", pushMsg.expires);
- MSG_DEBUG("pushMsg.id : [%s]", pushMsg.id);
+ MSG_SEC_DEBUG("pushMsg.id : [%s]", pushMsg.id);
MSG_DEBUG("pushMsg.href : [%s]", pushMsg.href);
MSG_DEBUG("pushMsg.contents : [%s]", pushMsg.contents);
@@ -1611,6 +1724,10 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
/** Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
+ memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
createMsgInfo(&msgInfo);
@@ -1624,14 +1741,23 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
strncpy(msgInfo.msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
msgInfo.dataSize = sizeof(pushMsg);
+ msgInfo.sim_idx = simIndex;
+ getDisplayName(msgInfo.msgType.subType, msgInfo.addressList[0].addressVal);
MSG_DEBUG("dataSize : %d", msgInfo.dataSize);
- /** Callback to MSG FW */
- err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+ /** Add WAP Push Msg into DB */
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
- if (err != MSG_SUCCESS)
- MSG_DEBUG("callbackMsgIncoming is failed, err=[%d]", err);
+ if (err == MSG_SUCCESS) {
+ /** Callback to MSG FW */
+ err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
+
+ if (err != MSG_SUCCESS)
+ MSG_DEBUG("callbackMsgIncoming is failed, err=[%d]", err);
+ } else {
+ MSG_DEBUG("checkMessage() Error !! [%d]", err);
+ }
xmlFree(xmlDoc);
xmlFree(tmpXmlChar);
@@ -1641,7 +1767,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
return;
}
-void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, bool isText)
+void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex)
{
MSG_PUSH_CACHEOP_S cacheOp;
@@ -1679,7 +1805,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
xmlChar* tmpUrl = NULL;
if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) {
- MSG_DEBUG("indNode->name = %s\n", indNode->name);
+ MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name);
tmpUrl = xmlGetProp(indNode, (xmlChar*) SMS_PUSH_XML_CO_URI);
@@ -1691,7 +1817,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("NO href value from the xmlDoc\n");
}
} else if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_SVC)) {
- MSG_DEBUG("indNode->name = %s\n",indNode->name);
+ MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI);
if (tmpUrl != NULL) {
@@ -1724,6 +1850,10 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
/** Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
+ memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
+
+ msgInfo.addressList = NULL;
+ AutoPtr<MSG_ADDRESS_INFO_S> addressListBuf(&msgInfo.addressList);
createMsgInfo(&msgInfo);
@@ -1734,11 +1864,12 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
msgInfo.msgType.subType = MSG_WAP_CO_SMS;
msgInfo.dataSize = sizeof(cacheOp);
+ msgInfo.sim_idx = simIndex;
msg_error_t err = MSG_SUCCESS;
/** Add WAP Push Msg into DB */
- err = SmsPluginStorage::instance()->addMessage(&msgInfo);
+ err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
/** Callback */
@@ -1748,7 +1879,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
}
} else {
- MSG_DEBUG("addMessage() Error !! [%d]", err);
+ MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
xmlFree(xmlDoc);
@@ -1759,6 +1890,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
void SmsPluginWapPushHandler::handleDrmVer1(char* pPushBody, int PushBodyLen)
{
+#if MSG_DRM_SUPPORT
int drmRt = DRM_RETURN_SUCCESS;
char* cid = NULL;
AutoPtr<char> buf(&cid);
@@ -1784,7 +1916,7 @@ void SmsPluginWapPushHandler::handleDrmVer1(char* pPushBody, int PushBodyLen)
} else {
MSG_DEBUG("Fail to regist DRM to drm-service.");
}
-
+#endif
return;
}
@@ -1803,7 +1935,6 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
-
time_t rawtime = time(NULL);
/*** Comment below lines to save local UTC time..... (it could be used later.)
@@ -1864,13 +1995,16 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
/** Convert Address values */
pMsgInfo->nAddressCnt = 1;
+
+ pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
+ memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
+
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(pMsgInfo->addressList[0].addressVal, tmpAddress.address, MAX_ADDRESS_VAL_LEN);
pMsgInfo->msgPort.valid = false;
pMsgInfo->msgPort.dstPort = 0;
pMsgInfo->msgPort.srcPort = 0;
-
}
void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText)
@@ -1882,7 +2016,7 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
if (isText) {
- *pXmlDoc = xmlParseMemory(pPushBody, strlen(pPushBody));
+ *pXmlDoc = xmlParseMemory(pPushBody, AcStrlen(pPushBody));
} else {
WB_UTINY* xmldata = NULL;
WBXMLConvWBXML2XML *conv = NULL;
@@ -1903,7 +2037,7 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
MSG_DEBUG("xmldata : \n%s\n", xmldata);
- *pXmlDoc = xmlParseMemory((char*)xmldata, strlen((char*)xmldata));
+ *pXmlDoc = xmlParseMemory((char*)xmldata, AcStrlen((char*)xmldata));
}
}
@@ -1919,7 +2053,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
memset(&timeStruct, 0x00, sizeof(struct tm));
/** check pDate */
- if (strlen(pDate)<20)
+ if (AcStrlen(pDate)<20)
return 0;
MSG_DEBUG("pDate [%s]", pDate);
@@ -1987,27 +2121,27 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio
}
/** compare with signal-none. */
- comp = strcmp( "signal-none", pAction );
+ comp = g_strcmp0( "signal-none", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_NONE;
/** compare with signal-low. */
- comp = strcmp( "signal-low", pAction );
+ comp = g_strcmp0( "signal-low", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_LOW;
/** compare with signal-medium. */
- comp = strcmp( "signal-medium", pAction );
+ comp = g_strcmp0( "signal-medium", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
/** compare with signal-high. */
- comp = strcmp( "signal-high", pAction );
+ comp = g_strcmp0( "signal-high", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_HIGH;
/** compare with delete. */
- comp = strcmp( "delete", pAction );
+ comp = g_strcmp0( "delete", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_DELETE;
@@ -2026,17 +2160,17 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
}
/** compare pSrcStr with execute-low. */
- comp = strcmp( "execute-low", pAction );
+ comp = g_strcmp0( "execute-low", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
/** compare pSrcStr with execute-high. */
- comp = strcmp( "execute-high", pAction );
+ comp = g_strcmp0( "execute-high", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_HIGH;
/** compare pSrcStr with cache. */
- comp = strcmp( "cache", pAction );
+ comp = g_strcmp0( "cache", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_CACHE;
@@ -2151,13 +2285,17 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
/* Is it reacehd end of header? */
while (iEncodedHeader < encodedHeaderLen) {
/* Get memory for single header */
- temper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ];
if (temper == NULL) {
- MSG_DEBUG("temper Memory allocation is failed.\n" );
- return;
- }
+ temper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ];
- memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5));
+ if (temper == NULL) {
+ MSG_DEBUG("temper Memory allocation is failed.\n" );
+ return;
+ }
+ memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5));
+ } else {
+ memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5));
+ }
/* this section presents header code page shifting procedure
This part can be implemented by future request.
@@ -2356,6 +2494,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
unsigned long i = 0;
/* encoded content type length body */
unsigned long tempLen;
+ MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
/* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
if (0 == fieldValueLen) {
@@ -2368,8 +2507,8 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
}
- if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
- if (fieldValue[0] > 0x80) {
+ if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
+ if (fieldValue[0] >= 0x80) {
tempLen = 1;
} else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
fieldValue[3] = fieldValue[2];
@@ -2403,7 +2542,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
} else {
contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
- while ((wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspUnregisteredContentsTypeCount)) i++;
+ while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++;
/** If there is a Content-Type assigned, */
if (i < wspUnregisteredContentsTypeCount)
@@ -2514,10 +2653,10 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
for(int i = 0; i < count ; ++i)
{
- if((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
+ if ((unsigned int)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);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
break;
}
}
@@ -2526,7 +2665,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
/* Accept-Application */
case 0x32 :
if (0x80 == fieldValue[0]) {
- strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1 );
+ strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
} else {
unsigned char temp[16];
@@ -2536,7 +2675,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
else
*/
sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
}
break;
@@ -2558,21 +2697,21 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
char* decodedString = NULL;
AutoPtr<char> decodedStringbuf(&decodedString);
wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
- strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1 );
+ strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
}
break;
/* connection */
case 0x09 :
if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1 );
+ strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
break;
/* accept-ranges */
case 0x04 :
if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1 );
+ strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
if (fieldValue[0] == 0x81 )
- strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1 );
+ strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
break;
/* content-md5 */
case 0x0f :
@@ -2631,7 +2770,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
iField = AcStrlen( (char*)authScheme ) + 1;
strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
iField = iField + AcStrlen( (char*)realmValue ) + 1;
- sprintf( (char*)addedString, "%s %s", authScheme, realmValue );
+ snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
if (iField < fieldValueLen) {
@@ -2768,14 +2907,14 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
/* warning */
case 0x2c :
{
-
unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
if (fieldValue[0] < 0x20 )
iField = fieldValue[0];
else
iField = 1;
- sprintf( (char*)temp, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
+
+ snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
if (iField < fieldValueLen) {
unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
@@ -2783,8 +2922,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
iField = iField + AcStrlen((char*)agent ) + 1;
strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
-
- sprintf( (char*)temp, " %s %s", agent, text );
+ snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
wspHeaderCopyDecodedString( temp, &currentLength, &temper );
}
}
@@ -2818,7 +2956,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
{
unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
- sprintf( (char*)temp, "%lX", wspHeaderDecodeInteger(fieldValue ));
+ snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
temp[2] = temp[1];
temp[1] = (unsigned char)0x30;
temp[3] = '\0';
@@ -3196,24 +3334,24 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
{
/* UNIX asciitime function */
case UNIX_DATE_TYPE :
- sprintf( (char*)decodedString, "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
break;
case RFC1123_DATE_TYPE :
- sprintf( (char*)decodedString, "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
break;
case RFC850_DATE_TYPE :
/* Have some Y2K Problems */
/* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */
- sprintf( (char*)decodedString, "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
break;
}
#endif
/**UNIX_DATE_TYPE : */
- sprintf( (char*)*pDecodedString, "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
+ snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
return;
@@ -3251,6 +3389,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
unsigned char userId[WSP_STANDARD_STR_LEN_MAX];
unsigned char passWd[WSP_STANDARD_STR_LEN_MAX];
unsigned long iField = 0;
+ char authStr[256];
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX * 2];
@@ -3261,11 +3400,15 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
/* skip 'basic' code */
iField++;
- sscanf((char*)(fieldValue + iField), "%s", userId );
+ memset(authStr, 0x00, sizeof(authStr));
+ snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
+ sscanf((char*)(fieldValue + iField), authStr, userId );
iField = iField + AcStrlen( (char*)userId ) + 1;
- sscanf( (char*)(fieldValue + iField), "%s", passWd );
+ memset(authStr, 0x00, sizeof(authStr));
+ snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(passWd));
+ sscanf( (char*)(fieldValue + iField), authStr, passWd );
iField = iField + AcStrlen( (char*)userId ) + 1;
- sprintf( (char*)*pDecodedString, "basic %s/%s", userId, passWd );
+ snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd );
return;
}
@@ -3275,6 +3418,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
{
unsigned char userId[WSP_STANDARD_STR_LEN_MAX];
unsigned long iField = 0;
+ char authStr[256];
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
@@ -3285,10 +3429,12 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
/* skip 'basic' code */
iField++;
- sscanf( (char*)(fieldValue + iField), "%s", userId );
+ memset(authStr, 0x00, sizeof(authStr));
+ snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
+ sscanf( (char*)(fieldValue + iField), authStr, userId );
iField = iField + AcStrlen( (char*)userId ) + 1;
- sprintf( (char*)*pDecodedString, "basic realm=\"%s\"", userId );
+ snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId );
return;
}
@@ -3340,14 +3486,14 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
case 0x03 :
/* min-fresh */
case 0x04 :
- sprintf( (char*)paramString, "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
+ snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
break;
default :
break;
}
- sprintf((char*)*pCacheString, "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
+ snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
} else {
/* cache extentions */
/* In case of come directive of doesn't specified string style */
@@ -3362,7 +3508,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
if (fieldValue[stringLen+ 1] > 0x7f) {
int untyped = (int)wspHeaderDecodeIntegerByLength( fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1 ));
- sprintf( szString, "%d", untyped );
+ snprintf( szString, sizeof(szString), "%d", untyped );
strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
strncat( (char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
} else {
@@ -3376,3 +3522,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
return;
}
+
+void SmsPluginWapPushHandler::getDisplayName(MSG_SUB_TYPE_T subType,char* displayName)
+{
+ if(subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS)
+ snprintf(displayName, MAX_ADDRESS_VAL_LEN + 1, "Push message");
+ return;
+}
diff --git a/plugin/sms_plugin/include/SmsPluginCallback.h b/plugin/sms_plugin/include/SmsPluginCallback.h
index 3eabbe2..1634292 100755
--- a/plugin/sms_plugin/include/SmsPluginCallback.h
+++ b/plugin/sms_plugin/include/SmsPluginCallback.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_CALLBACK_H
@@ -31,8 +28,10 @@ extern "C"
{
#include <tapi_common.h>
#include <TelSms.h>
+ #include <TelSim.h>
#include <TapiUtility.h>
#include <ITapiNetText.h>
+ #include <ITapiNetwork.h>
}
/*==================================================================================================
@@ -41,6 +40,7 @@ extern "C"
void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
@@ -54,6 +54,8 @@ void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *use
void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventSetSmscInfo(TapiHandle *handle, int result, void *data, void *user_data);
+
void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data);
@@ -64,6 +66,8 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_
void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, void *user_data);
+
void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_data);
@@ -73,11 +77,19 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *use
void TapiEventSimFileInfo(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSimReadFile(TapiHandle *handle, int result, void *data, void *user_data);
-
void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetMeImei(TapiHandle *handle, int result, void *data, void *user_data);
+
+void TapiEventSimStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+
+void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+
+void TapiEventSimRefreshed(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+
+SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result);
/*==================================================================================================
CLASS DEFINITIONS
diff --git a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
index 0f83c22..ae04ee5 100755
--- a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_CBMSG_HANDLER_H
@@ -43,7 +40,7 @@ extern "C"
/*==================================================================================================
VARIABLES
==================================================================================================*/
-typedef map<unsigned char, string> cbPageMap;
+typedef map<unsigned char, SMS_CBMSG_PAGE_S> cbPageMap;
typedef struct _CB_PAGE_INFO_S
@@ -68,8 +65,8 @@ class SmsPluginCbMsgHandler
public:
static SmsPluginCbMsgHandler* instance();
- void handleCbMsg(TelSmsCbMsg_t *pCbMsg);
- void handleEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg);
+ void handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMsg);
+ void handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *pEtwsMsg);
private:
SmsPluginCbMsgHandler();
@@ -81,24 +78,24 @@ private:
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 );
+ int CMAS_class(unsigned short message_id);
- bool checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg);
+ bool checkCbOpt(SMS_CBMSG_PAGE_S CbPage, bool *pJavaMsg, msg_sim_slot_id_t simIndex);
unsigned char checkCbPage(SMS_CBMSG_PAGE_S CbPage);
void MakeCbMsg(SMS_CBMSG_PAGE_S CbPage, SMS_CBMSG_S *pCbMsg);
- void convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
- void convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
+ void convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex);
+ void convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex);
int convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg);
- void addToPageLiat(SMS_CBMSG_PAGE_S CbPage);
+ void addToPageList(SMS_CBMSG_PAGE_S CbPage);
void removeFromPageList(SMS_CBMSG_PAGE_S CbPage);
void decodeCbMsgDCS(unsigned char dcsData, const unsigned char *pMsgData, SMS_CBMSG_DCS_S* pDcs);
void convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType);
unsigned long getRecvTime();
- void getDisplayName(unsigned short MsgId, char *pDisplayName);
+ void getDisplayName(unsigned short MsgId, char *pDisplayName, msg_sim_slot_id_t simIndex);
vector<CB_PAGE_INFO_S> pageList;
- MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_CBMSG_HANDLER_H
diff --git a/plugin/sms_plugin/include/SmsPluginConcatHandler.h b/plugin/sms_plugin/include/SmsPluginConcatHandler.h
index ab5cc5a..fa3552a 100755
--- a/plugin/sms_plugin/include/SmsPluginConcatHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginConcatHandler.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_CONCAT_HANDLER_H
@@ -57,6 +54,8 @@ typedef struct _SMS_CONCAT_MSG_S
SMS_ADDRESS_S originAddress;
SMS_DCS_S dcs;
bool bRead;
+ int simId;
+ int simIndex;
} SMS_CONCAT_MSG_S;
typedef struct _SMS_CONCAT_INFO_S
@@ -72,6 +71,9 @@ typedef struct _SMS_CONCAT_INFO_S
unsigned int totalSize;
concatDataMap data;
+ int simIdList[MAX_SIM_SMS_NUM];
+ unsigned int display_time;
+ int simIndex;
} SMS_CONCAT_INFO_S;
typedef struct _SMS_SIM_ID_S
@@ -90,7 +92,8 @@ public:
static SmsPluginConcatHandler* instance();
bool IsConcatMsg(SMS_USERDATA_S *pUserData);
- void handleConcatMsg(SMS_TPDU_S *pTpdu);
+ void handleConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu);
+ void handleSimConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList);
// void handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t SimMsgId, bool bRead);
// void handleBrokenMsg();
@@ -102,12 +105,13 @@ private:
static SmsPluginConcatHandler* pInstance;
unsigned char checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMsg, SMS_USERDATA_S *pUserData);
- int makeConcatUserData(unsigned short MsgRef, char **ppTotalData);
+ int makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData);
void convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
+ void convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
// void convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
- void removeFromConcatList(unsigned short MsgRef);
+ void removeFromConcatList(unsigned short MsgRef, int simIndex);
// void addToSimIdList(unsigned short MsgRef, msg_sim_id_t SimMsgId);
// void removeFromSimIdList(unsigned short MsgRef);
@@ -115,7 +119,6 @@ private:
vector<SMS_CONCAT_INFO_S> concatList;
// vector<SMS_SIM_ID_S> simIdList;
- MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_CONCAT_HANDLER_H
diff --git a/plugin/sms_plugin/include/SmsPluginEventHandler.h b/plugin/sms_plugin/include/SmsPluginEventHandler.h
index 87638ec..12a0cdb 100755
--- a/plugin/sms_plugin/include/SmsPluginEventHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginEventHandler.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_EVENT_HANDLER_H
@@ -40,23 +37,29 @@ public:
void registerListener(MSG_PLUGIN_LISTENER_S *pListener);
void handleSentStatus(msg_network_status_t NetStatus);
- void handleMsgIncoming(SMS_TPDU_S *pTpdu);
- void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen);
+ void handleMsgIncoming(struct tapi_handle *handle, SMS_TPDU_S *pTpdu);
+ void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, int simIndex);
void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
void handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *app_id, char *content_type);
+ void handleResendMessage(void);
msg_error_t callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg);
+ msg_error_t callbackCBMsgIncoming(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t callbackInitSimBySat();
msg_error_t callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t handleSimMsg(MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList, msg_message_id_t *retMsgId, int listSize);
+ msg_error_t updateIMSI(int sim_idx);
+ void handleSimMemoryFull(int simIndex);
void SetSentInfo(SMS_SENT_INFO_S *pSentInfo);
- void setDeviceStatus();
- bool getDeviceStatus();
+ void setDeviceStatus(struct tapi_handle *handle);
+ bool getDeviceStatus(struct tapi_handle *handle);
void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
+ MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
+
private:
SmsPluginEventHandler();
virtual ~SmsPluginEventHandler();
@@ -64,7 +67,6 @@ private:
void convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
void convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
void convertStatusRepTpduToMsginfo(const SMS_STATUS_REPORT_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
- MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
static SmsPluginEventHandler* pInstance;
@@ -73,11 +75,12 @@ private:
SMS_SENT_INFO_S sentInfo;
bool devStatus;
+ bool bUdhMwiMethod;
+ int udhMwiCnt;
Mutex mx;
CndVar cv;
-
- MsgTextConvert textCvt;
+ struct tapi_handle *devHandle;
};
#endif //SMS_PLUGIN_EVENT_HANDLER_H
diff --git a/plugin/sms_plugin/include/SmsPluginMain.h b/plugin/sms_plugin/include/SmsPluginMain.h
index 00e8ed1..bedffb8 100755
--- a/plugin/sms_plugin/include/SmsPluginMain.h
+++ b/plugin/sms_plugin/include/SmsPluginMain.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_MAIN_H
@@ -43,32 +40,28 @@ msg_error_t SmsPlgFinalize();
msg_error_t SmsPlgRegisterListener(MSG_PLUGIN_LISTENER_S *pListener);
-msg_error_t SmsPlgCheckSimStatus(MSG_SIM_STATUS_T *pStatus);
-
-msg_error_t SmsPlgCheckDeviceStatus();
-
msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo);
-msg_error_t SmsPlgInitSimMessage();
-
msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList);
-msg_error_t SmsPlgDeleteSimMessage(msg_sim_id_t SimMsgId);
+msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
msg_error_t SmsPlgGetSimMessage(msg_sim_id_t SimMsgId);
msg_error_t SmsPlgGetSimMessageCount();
-msg_error_t SmsPlgSetReadStatus(msg_sim_id_t SimMsgId);
-
-msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error);
+msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
-msg_error_t SmsPlgInitConfigData(MSG_SIM_STATUS_T SimStatus);
+msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error);
msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting);
msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting);
+msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char* pFileData);
+
+msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId);
+
#ifdef __cplusplus
}
#endif
diff --git a/plugin/sms_plugin/include/SmsPluginParamCodec.h b/plugin/sms_plugin/include/SmsPluginParamCodec.h
index ba68087..0795823 100755
--- a/plugin/sms_plugin/include/SmsPluginParamCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginParamCodec.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_PARAMCODEC_H
@@ -47,6 +44,8 @@ public:
static int decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS);
static void decodeSMSC(unsigned char* pAddress, int AddrLen, MSG_SMS_TON_T ton, char *pDecodeAddr);
+ static bool checkCphsVmiMsg(const unsigned char *pTpdu, int *setType, int *indType);
+
private:
static int convertDigitToBcd(char *pDigit, int DigitLen, unsigned char *pBcd);
static int convertBcdToDigit(const unsigned char *pBcd, int BcdLen, char *pDigit);
diff --git a/plugin/sms_plugin/include/SmsPluginSatHandler.h b/plugin/sms_plugin/include/SmsPluginSatHandler.h
index f9f2935..e6a640f 100755
--- a/plugin/sms_plugin/include/SmsPluginSatHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginSatHandler.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_SAT_HANDLER_H
@@ -25,6 +22,12 @@
INCLUDE FILES
==================================================================================================*/
#include "SmsPluginTypes.h"
+#include "MsgMutex.h"
+
+extern "C"
+{
+ #include <TelSat.h>
+}
/*==================================================================================================
CLASS DEFINITIONS
@@ -34,10 +37,10 @@ class SmsPluginSatHandler
public:
static SmsPluginSatHandler* instance();
- void refreshSms(void *pData);
- void sendSms(void *pData);
- void ctrlSms(void *pData);
- void ctrlSms(msg_network_status_t netStatus);
+ void refreshSms(struct tapi_handle *handle, void *pData);
+ void sendSms(struct tapi_handle *handle, void *pData);
+ void ctrlSms(struct tapi_handle *handle, void *pData);
+ void ctrlSms(struct tapi_handle *handle, SMS_NETWORK_STATUS_T netStatus);
void finishSimMsgInit(msg_error_t Err);
@@ -52,16 +55,18 @@ private:
int handleSatTpdu(unsigned char *pTpdu, unsigned char TpduLen, int bIsPackingRequired);
- void sendResult(SMS_SAT_CMD_TYPE_T CmdType, int ResultType);
+ void sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType);
static SmsPluginSatHandler* pInstance;
int commandId;
- bool bSendSms;
bool bInitSim;
bool bSMSPChanged;
bool bCBMIChanged;
+
+ Mutex mx;
+ CndVar cv;
};
#endif //SMS_PLUGIN_SAT_HANDLER_H
diff --git a/plugin/sms_plugin/include/SmsPluginSetting.h b/plugin/sms_plugin/include/SmsPluginSetting.h
index 1c27a1f..05e39d1 100755
--- a/plugin/sms_plugin/include/SmsPluginSetting.h
+++ b/plugin/sms_plugin/include/SmsPluginSetting.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_SETTING_H
@@ -26,7 +23,12 @@
==================================================================================================*/
#include "MsgMutex.h"
#include "MsgSettingTypes.h"
+#include <list>
+extern "C"
+{
+ #include <tapi_common.h>
+}
/*==================================================================================================
CLASS DEFINITIONS
@@ -36,64 +38,88 @@ class SmsPluginSetting
public:
static SmsPluginSetting* instance();
- void initConfigData(MSG_SIM_STATUS_T SimStatus);
-
void setConfigData(const MSG_SETTING_S *pSetting);
void getConfigData(MSG_SETTING_S *pSetting);
+ void getMeImei(char *pImei);
void setParamCntEvent(int ParamCnt);
- void setParamEvent(const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
- void setCbConfigEvent(const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
- void setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess);
- void setMwiInfo(MSG_SUB_TYPE_T type, int count);
- void setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
+ void setParamEvent(struct tapi_handle *handle, const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
+ void setCbConfigEvent(struct tapi_handle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
+ void setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess, bool bMbdn);
+ void setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count);
+ void setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
void setResultFromSim(bool bResult);
+ void setResultImei(bool bResult, char *pImei);
+
+ void setSmscInfo(const MSG_SMSC_LIST_S *pSmscList);
+
+ void setSimChangeStatus(struct tapi_handle *handle, bool bInitializing);
+ void getSmscListInfo(int simIndex, MSG_SMSC_LIST_S *pSmscList);
+ void SimRefreshCb(struct tapi_handle *handle);
private:
SmsPluginSetting();
~SmsPluginSetting();
- msg_error_t addSMSCList(MSG_SMSC_LIST_S *pSmscList);
+ void updateSimStatus(struct tapi_handle *handle);
+
+ void initConfigData(struct tapi_handle *handle);
+ static void* init_config_data(void *data);
+ static void* initSimInfo(void *data);
+ void* processInitSimInfo(void *data);
+
+ void addSMSCList(MSG_SMSC_LIST_S *pSmscList);
msg_error_t addCbOpt(MSG_CBMSG_OPT_S *pCbOpt);
- void getCbOpt(MSG_SETTING_S *pSetting);
+ void getCbOpt(MSG_SETTING_S *pSetting, int simIndex);
void setParamList(const MSG_SMSC_LIST_S *pSMSCList);
void getParamList(MSG_SMSC_LIST_S *pSMSCList);
- int getParamCount();
- bool getParam(int Index, MSG_SMSC_DATA_S *pSmscData);
+ int getParamCount(struct tapi_handle *handle);
+ bool getParam(struct tapi_handle *handle, int Index, MSG_SMSC_DATA_S *pSmscData);
bool setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt);
bool getCbConfig(MSG_CBMSG_OPT_S *pCbOpt);
void setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt);
- bool getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
- bool getMwiInfo(void);
- bool getMsisdnInfo(void);
+ bool getVoiceMailInfo(struct tapi_handle *handle);
+
+ bool getMwiInfo(struct tapi_handle *handle);
+ bool getMsisdnInfo(struct tapi_handle *handle);
+ bool getSimServiceTable(struct tapi_handle *handle);
+ bool getResultImei(char *pImei);
int getParamCntEvent();
- bool getParamEvent(MSG_SMSC_DATA_S *pSmscData);
+ bool getParamEvent(struct tapi_handle *handle, MSG_SMSC_DATA_S *pSmscData);
bool getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt);
- bool getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+ bool getMailboxInfoEvent();
bool getResultFromSim();
SMS_PID_T convertPid(MSG_SMS_PID_T pid);
+ void deliverVoiceMsgNoti(int simIndex, int mwiCnt);
static SmsPluginSetting* pInstance;
-
- MSG_SMSC_DATA_S smscData;
- MSG_CBMSG_OPT_S cbOpt;
-
- /* Message Waiting Indicator */
- SMS_SIM_MAILBOX_LIST_S simMailboxList;
- SMS_SIM_MWI_INFO_S simMwiInfo;
-
- bool bTapiResult;
+ std::list<TapiHandle *> tel_handle_list;
+
+ /* Setting values for keeping in setting instance */
+ MSG_SMSC_LIST_S smscList[MAX_TELEPHONY_HANDLE_CNT+1];
+ MSG_SIM_STATUS_T simStatus[MAX_TELEPHONY_HANDLE_CNT+1];
+ MSG_SMSC_DATA_S smscData[MAX_TELEPHONY_HANDLE_CNT+1];
+ SMS_SIM_MAILBOX_LIST_S simMailboxList[MAX_TELEPHONY_HANDLE_CNT+1];
+ SMS_SIM_MWI_INFO_S simMwiInfo[MAX_TELEPHONY_HANDLE_CNT+1];
+ MSG_CBMSG_OPT_S cbOpt[MAX_TELEPHONY_HANDLE_CNT+1];
+
+ /* Local values for getting from SIM(TAPI) */
+ bool bTapiResult;
int paramCnt;
int selectedParam;
+ int selectedSimIndex;
+ char meImei[MAX_ME_IMEI_LEN + 1];
+
+ bool bMbdnEnable[MAX_TELEPHONY_HANDLE_CNT];
Mutex mx;
CndVar cv;
diff --git a/plugin/sms_plugin/include/SmsPluginSimMsg.h b/plugin/sms_plugin/include/SmsPluginSimMsg.h
index 71dcfed..fed6a1a 100755
--- a/plugin/sms_plugin/include/SmsPluginSimMsg.h
+++ b/plugin/sms_plugin/include/SmsPluginSimMsg.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_SIMMSG_H
@@ -46,46 +43,55 @@ class SmsPluginSimMsg
public:
static SmsPluginSimMsg* instance();
- void initSimMessage();
+ void initSimMessage(struct tapi_handle *handle);
msg_error_t saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList);
msg_error_t saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInfo);
- void deleteSimMessage(msg_sim_id_t SimMsgId);
+ void deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
void getSimMessageList(MSG_SIM_MSG_INFO_LIST_S **ppSimMsgList);
- void setReadStatus(msg_sim_id_t SimMsgId);
- bool checkSimMsgFull(unsigned int SegCnt);
+ void setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
+ bool checkSimMsgFull(msg_sim_slot_id_t sim_idx, unsigned int SegCnt);
- void setSimMsgCntEvent(const MSG_SIM_COUNT_S *pSimMsgCnt);
- void setSimMsgEvent(const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess);
- void setSaveSimMsgEvent(int simMsgId, int result);
- void setSaveClass2MsgEvent(int simMsgId, int result);
+ void setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SIM_COUNT_S *pSimMsgCnt);
+ void setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess);
+ void setSaveSimMsgEvent(struct tapi_handle *handle, int simId, int result);
+ void setSaveClass2MsgEvent(struct tapi_handle *handle, int simId, int result, MSG_MESSAGE_INFO_S *data);
void setSimEvent(msg_sim_id_t SimId, bool bResult);
+ void setUpdateSimEvent(int SimId, bool bResult);
+ void setDelSimEvent(int SimId, bool bResult);
void setSmsData(const char *sca, const char *szData, int msgLength);
+ void setSmsTpduTotalSegCount(int totalSeg);
private:
SmsPluginSimMsg();
~SmsPluginSimMsg();
- void getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt);
- bool getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S* pMsgInfo);
+ void getSimMsgCount(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt);
+ bool getSimMsg(struct tapi_handle *handle, msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S* pMsgInfo, int *simIdList);
- void setSmsOptions(SMS_DELIVER_S *pDeliver);
+ void setSmsOptions(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
void convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELIVER_S *pDeliver);
- bool getSimMsgCntEvent(MSG_SIM_COUNT_S *pSimMsgCnt);
- bool getSimMsgEvent(MSG_MESSAGE_INFO_S *pMsgInfo);
+ bool getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt);
+ bool getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INFO_S *pMsgInfo);
bool getSimEvent(msg_sim_id_t *pSimId);
+ bool getUpdateSimEvent();
+ bool getDelSimEvent(int *pSimId);
+
static SmsPluginSimMsg* pInstance;
msg_sim_id_t simMsgId;
+ int delSimMsgId;
+ int simIdList[MAX_SIM_SMS_NUM]; /** send total simIds to handleSimMsg **/
MSG_SIM_COUNT_S simMsgCnt;
MSG_MESSAGE_INFO_S simMsgInfo;
+ MSG_ADDRESS_INFO_S simAddrInfo;
- unsigned int usedCnt;
- unsigned int totalCnt;
+ int usedCnt;
+ int totalCnt;
bool bTapiResult;
diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h
index d1b987c..0506e8f 100755
--- a/plugin/sms_plugin/include/SmsPluginStorage.h
+++ b/plugin/sms_plugin/include/SmsPluginStorage.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_STORAGE_H
@@ -48,38 +45,44 @@ class SmsPluginStorage
public:
static SmsPluginStorage* instance();
+ msg_error_t insertMsgRef(MSG_MESSAGE_INFO_S *pMsg, unsigned char msgRef, int index);
+ msg_error_t updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInfo, unsigned char msgRef);
+
msg_error_t updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t Status);
+// msg_error_t updateMsgRef(msg_message_id_t MsgId, unsigned char MsgRef);
+// msg_error_t updateStatusReport(unsigned char MsgRef, msg_delivery_report_status_t Status, time_t DeliveryTime);
- msg_error_t addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo);
+ msg_error_t addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int *simIdList);
+ msg_error_t insertSimMessage(int simId, int msgId);
+ msg_error_t deleteSimMessage(int sim_idx, int simId);
- msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
-
+ msg_error_t deleteSmsMessage(msg_message_id_t msgId);
+#if 0
+ msg_error_t isReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage);
+ msg_error_t insertReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage);
+#endif
msg_error_t addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
- msg_error_t deleteSmsMessage(msg_message_id_t MsgId);
+ msg_error_t getReplaceSimMsg(const MSG_MESSAGE_INFO_S *pMsg, int *pMsgId, int *pSimId);
- msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, char *content_type);
+ msg_error_t checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, int app_id_len, char *content_type, int content_type_len);
msg_error_t getnthPushEvent(int index, int *appcode);
msg_error_t releasePushEvent();
private:
SmsPluginStorage();
~SmsPluginStorage();
- msg_error_t updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
-
- msg_error_t addCbMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t addReplaceTypeMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t addWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t handleCOWAPMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t checkPushMsgValidation(MSG_PUSH_MESSAGE_S *pPushMsg, bool *pbProceed);
-
- msg_error_t checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t updateAllAddress();
+ msg_error_t addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo);
static SmsPluginStorage* pInstance;
+ static void* class2_thread(void *data);
+
+ MSG_MESSAGE_INFO_S msgInfo;
+ MSG_ADDRESS_INFO_S addrInfo;
- MsgDbHandler dbHandle;
std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
// unsigned char tmpMsgRef;
};
diff --git a/plugin/sms_plugin/include/SmsPluginTpduCodec.h b/plugin/sms_plugin/include/SmsPluginTpduCodec.h
index 012bac6..597a91d 100755
--- a/plugin/sms_plugin/include/SmsPluginTpduCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginTpduCodec.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_TPDU_CODEC_H
diff --git a/plugin/sms_plugin/include/SmsPluginTransport.h b/plugin/sms_plugin/include/SmsPluginTransport.h
index 3920bcb..59f177c 100755
--- a/plugin/sms_plugin/include/SmsPluginTransport.h
+++ b/plugin/sms_plugin/include/SmsPluginTransport.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_TRANSPORT_H
@@ -31,6 +28,11 @@
#include "SmsPluginTypes.h"
#include "MsgInternalTypes.h"
+extern "C"
+{
+ #include <TelSat.h>
+}
+
/*==================================================================================================
CLASS DEFINITIONS
==================================================================================================*/
@@ -40,17 +42,19 @@ public:
static SmsPluginTransport* instance();
void submitRequest(SMS_REQUEST_INFO_S *pReqInfo);
- void sendDeliverReport(msg_error_t err);
- void sendClass0DeliverReport(msg_error_t err);
+ void sendDeliverReport(struct tapi_handle *handle, msg_error_t err);
+ void sendClass0DeliverReport(struct tapi_handle *handle, msg_error_t err);
- void setSmsSendOptions(SMS_SUBMIT_S *pSubmit);
- void setSmscOptions(SMS_ADDRESS_S *pSmsc);
+ void setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc);
void msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SUBMIT_DATA_S *pData, SMS_CODING_SCHEME_T *pCharType, int addrIndex);
void setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstHeader);
- void setNetStatus(msg_network_status_t netStatus);
- msg_network_status_t getNetStatus();
+ void setNetStatus(SMS_NETWORK_STATUS_T sentStatus);
+ SMS_NETWORK_STATUS_T getNetStatus();
+
+ void setMoCtrlStatus(TelSatMoSmCtrlIndData_t *moCtrlData);
+ int getMoCtrlStatus();
unsigned char getMsgRef();
@@ -58,6 +62,11 @@ private:
SmsPluginTransport();
~SmsPluginTransport();
+ void getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit);
+ void setSmsSendOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu);
+ void setSmsDcsOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu);
+ void setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_S* pSmsTpdu);
+
int getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, MSG_LANGUAGE_ID_T LangId, int ReplyAddrLen);
SMS_PID_T convertPid(MSG_SMS_PID_T pid);
@@ -68,12 +77,11 @@ private:
unsigned char msgRef8bit;
unsigned short msgRef16bit;
- msg_network_status_t curStatus;
+ SMS_NETWORK_STATUS_T curStatus;
+ TelSatMoSmCtrlIndData_t curMoCtrlData;
Mutex mx;
CndVar cv;
-
- MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_TRANSPORT_H
diff --git a/plugin/sms_plugin/include/SmsPluginTypes.h b/plugin/sms_plugin/include/SmsPluginTypes.h
index fea0979..d705686 100755
--- a/plugin/sms_plugin/include/SmsPluginTypes.h
+++ b/plugin/sms_plugin/include/SmsPluginTypes.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_TYPES_H
@@ -37,19 +34,23 @@
#define MAX_USER_DATA_LEN 160
#define MAX_GSM_7BIT_DATA_LEN 160
#define MAX_UCS2_DATA_LEN 140
-#define MAX_TPDU_DATA_LEN 165
+//#define MAX_TPDU_DATA_LEN 165
+//CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow
+#define MAX_TPDU_DATA_LEN 255
+#define MAX_SMS_SEND_RETRY 4
#define MAX_SMSC_LEN 20
#define MAX_ADD_PARAM_LEN 12
#define MAX_ABS_TIME_PARAM_LEN 7
#define MAX_REL_TIME_PARAM_LEN 1
#define MAX_UD_HEADER_NUM 7
#define MAX_SAT_TPDU_LEN 175
-#define MAX_CBMSG_PAGE_SIZE 93
+#define MAX_CBMSG_PAGE_SIZE 1252
#define MAX_ETWS_SIZE 56
#define MAX_CBMSG_PAGE_NUM 15
#define MAX_SIM_SMS_NUM 255
-#define MAX_SIM_XDN_ALPHA_ID_LEN 30
+#define MAX_SIM_IMSI_NUM 20
#define MAX_SIM_MSP_CNT 2
+#define MAX_TELEPHONY_HANDLE_CNT 3
#define SMS_PUSH_XML_HREF_TAG "href"
#define SMS_PUSH_XML_SI_ID_TAG "si-id"
@@ -66,122 +67,53 @@
TYPES
==================================================================================================*/
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_TPDU_TYPE_T;
+typedef unsigned char SMS_TPDU_TYPE_T; /* _SMS_TPDU_TYPE_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_VPF_T;
+typedef unsigned char SMS_VPF_T; /* _SMS_VPF_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_TON_T;
+typedef unsigned char SMS_TON_T; /* _SMS_TON_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_NPI_T;
+typedef unsigned char SMS_NPI_T; /* _SMS_NPI_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_PID_T;
+typedef unsigned char SMS_PID_T; /* _SMS_PID_E */
+typedef unsigned char SMS_MSG_CLASS_T; /* _SMS_MSG_CLASS_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_MSG_CLASS_T;
+typedef unsigned char SMS_CODING_SCHEME_T; /* _SMS_CODING_SCHEME_E */
+typedef unsigned char SMS_CODING_GROUP_T; /* _SMS_CODING_GROUP_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_CODING_SCHEME_T;
+typedef unsigned char SMS_INDICATOR_TYPE_T; /* _SMS_INDICATOR_TYPE_E */
+typedef unsigned char SMS_TIME_FORMAT_T; /* _SMS_TIME_FORMAT_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_CODING_GROUP_T;
+typedef unsigned char SMS_FAIL_CAUSE_T; /* _SMS_FAIL_CAUSE_E */
+typedef unsigned char SMS_STATUS_T; /* _SMS_STATUS_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_INDICATOR_TYPE_T;
+typedef unsigned char SMS_REF_NUMBER_T; /* _SMS_REF_NUMBER_E */
+typedef unsigned char SMS_REPORT_TYPE_T; /* _SMS_REPORT_TYPE_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_TIME_FORMAT_T;
+typedef unsigned char SMS_UDH_TYPE_T; /* _SMS_UDH_TYPE_E */
+typedef unsigned char SMS_WAP_APP_CODE_T; /* _SMS_WAP_APP_CODE_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_FAIL_CAUSE_T;
+typedef unsigned char SMS_CB_NETWORK_TYPE_T; /* _SMS_CB_NETWORK_TYPE_E */
+typedef unsigned char SMS_CBMSG_TYPE_T; /* _SMS_CBMSG_TYPE_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_STATUS_T;
+typedef unsigned char SMS_CBMSG_LANG_TYPE_T; /* _SMS_CBMSG_LANG_TYPE_E */
+typedef unsigned char SMS_CBMSG_CODING_GROUP_T; /* _SMS_CBMSG_CODING_GROUP_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_REF_NUMBER_T;
-
-
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_REPORT_TYPE_T;
+typedef unsigned char SMS_SAT_CMD_TYPE_T; /* _SMS_SAT_CMD_TYPE_E */
+typedef unsigned short SMS_SIM_EFILE_NAME_T; /* _SMS_SIM_EFILE_NAME_E */
-/**
-\brief Represents TPDU Type.
-*/
-typedef unsigned char SMS_UDH_TYPE_T;
+typedef unsigned char SMS_SIM_MAILBOX_TYPE_T; /* _SMS_SIM_MAILBOX_TYPE_E */
-
-/**
-\brief Represents WAP Push App Code.
-*/
-typedef unsigned char SMS_WAP_APP_CODE_T;
-
-
-typedef unsigned char SMS_CB_NETWORK_TYPE_T;
-
-
-typedef unsigned char SMS_CBMSG_TYPE_T;
-
-
-typedef unsigned char SMS_CBMSG_LANG_TYPE_T;
-
-
-typedef unsigned char SMS_CBMSG_CODING_GROUP_T;
-
-
-typedef unsigned char SMS_SAT_CMD_TYPE_T;
-
-
-typedef unsigned short SMS_SIM_EFILE_NAME_T;
-
-
-typedef unsigned char SMS_ETWS_NETWORK_TYPE_T;
-
-/**
-\brief Represents SIM mailbox type. See enum _SMS_SIM_MAILBOX_TYPE_E
-*/
-typedef unsigned char SMS_SIM_MAILBOX_TYPE_T;
+typedef unsigned char SMS_NETWORK_STATUS_T; /* _SMS_NETWORK_STATUS_E */
/*==================================================================================================
ENUMS
@@ -297,6 +229,7 @@ enum _SMS_CODING_GROUP_E
enum _SMS_INDICATOR_TYPE_E
{
SMS_VOICE_INDICATOR = 0,
+ SMS_VOICE2_INDICATOR, // Only for CPSH
SMS_FAX_INDICATOR,
SMS_EMAIL_INDICATOR,
SMS_OTHER_INDICATOR,
@@ -340,6 +273,7 @@ enum _SMS_STATUS_E
SMS_STATUS_TRY_NO_RESPONSE = 0x22,
SMS_STATUS_TRY_SERVICE_REJECTED = 0x23,
SMS_STATUS_TRY_QOS_NOT_AVAILABLE = 0x24,
+ SMS_STATUS_TRY_REQUEST_PENDING = 0x30,
SMS_STATUS_PERM_REMOTE_ERROR = 0x40,
SMS_STATUS_PERM_IMCOMPATIBLE_DEST = 0x41,
@@ -386,6 +320,8 @@ enum _SMS_UDH_TYPE_E
SMS_UDH_SRC_IND = 0x07,
SMS_UDH_CONCAT_16BIT = 0x08,
SMS_UDH_WCMP = 0x09,
+ SMS_UDH_EMS_FIRST = 0x0a,
+ SMS_UDH_EMS_LAST = 0x1f,
SMS_UDH_ALTERNATE_REPLY_ADDRESS = 0x22,
SMS_UDH_SINGLE_SHIFT = 0x24,
SMS_UDH_LOCKING_SHIFT = 0x25,
@@ -551,12 +487,27 @@ enum _SMS_SIM_EFILE_NAME_E
enum _SMS_SIM_MAILBOX_TYPE_E {
- MSG_SIM_MAILBOX_VOICE = 0x01,
- MSG_SIM_MAILBOX_VOICE2 = 0x02,
- MSG_SIM_MAILBOX_FAX = 0x03,
- MSG_SIM_MAILBOX_DATA = 0x04,
- MSG_SIM_MAILBOX_EMAIL = 0x05,
- MSG_SIM_MAILBOX_OTHER = 0x06,
+ SMS_SIM_MAILBOX_VOICE = 0x01,
+ SMS_SIM_MAILBOX_VOICE2 = 0x02,
+ SMS_SIM_MAILBOX_FAX = 0x03,
+ SMS_SIM_MAILBOX_DATA = 0x04,
+ SMS_SIM_MAILBOX_EMAIL = 0x05,
+ SMS_SIM_MAILBOX_OTHER = 0x06,
+};
+
+
+enum _SMS_NETWORK_STATUS_E {
+ SMS_NETWORK_SEND_SUCCESS = 0x00,
+ SMS_NETWORK_SENDING,
+ SMS_NETWORK_SEND_FAIL,
+ SMS_NETWORK_SEND_FAIL_TIMEOUT,
+ SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING,
+ SMS_NETWORK_SEND_FAIL_TEMPORARY,
+ SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD,
+ SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED,
+ SMS_NETWORK_SEND_FAIL_FDN_RESTRICED,
+ SMS_NETWORK_SEND_FAIL_NO_ROUTING,
+ SMS_NETWORK_SEND_PENDING,
};
@@ -828,7 +779,7 @@ typedef struct _SMS_CBMSG_PAGE_S
SMS_CBMSG_TYPE_T cbMsgType; /*CBS Msg or SCHEDULE Msg or CBS41 Msg */
SMS_CBMSG_HEADER_S pageHeader; /**< CB Message Header */
int pageLength; /**< message string length */
- char pageData[MAX_CBMSG_PAGE_SIZE+1]; /**< user data */
+ char pageData[MAX_CBMSG_PAGE_SIZE*8/7+1]; /**< user data */
} SMS_CBMSG_PAGE_S;
@@ -840,7 +791,7 @@ typedef struct _SMS_CBMSG_S
SMS_CODING_SCHEME_T codingScheme; /**< How to encode a message. */
time_t recvTime; /**< Msg Recv Time */
int msgLength; /**< message string length */
- char msgData[MAX_CBMSG_PAGE_SIZE*MAX_CBMSG_PAGE_NUM+1]; /**< user data */
+ char msgData[MAX_CBMSG_PAGE_SIZE*8/7*MAX_CBMSG_PAGE_NUM+1]; /**< user data */
} SMS_CBMSG_S;
typedef struct _SMS_ETWS_PRIMARY_S
@@ -939,6 +890,7 @@ typedef struct {
char num[MAX_PHONE_NUMBER_LEN + 1]; /**< Dialing Number/SSC String */
unsigned char cc_id; /**< Capability/Configuration Identifier */
unsigned char ext1_id; /**< Extensiion1 Record Identifier */
+ int num_len; /**< Length of the original number read from SIM*/
} SMS_SIM_MAILBOX_INFO_S;
@@ -995,13 +947,31 @@ typedef struct {
} SMS_SIM_MWI_INFO_S;
/**
+ * @brief Represents SIM MSISDN Information
+ */
+typedef struct {
+ char simMsisdn[MAX_SIM_MSISDN_LEN + 1];
+ int sim_index;
+} SMS_SIM_MSISDN_INFO_S;
+
+
+/**
* @brief Represents Message Data Information from Telephony.
*/
typedef struct {
unsigned char sca[MAX_ADDRESS_LEN]; /**< Service Center address */
int msgLength; /**< Size of array szData (which is actual TPDU message) */
unsigned char szData[MAX_TPDU_DATA_LEN + 1]; /**< SMS TPDU message */
+ int totalSegment; /** total segment count of TPDU message */
} SMS_DATA_INFO_S;
-#endif //SMS_PLUGIN_TYPES_H
+/**
+ * @brief Represents Telephony Handle from Telephony.
+ */
+typedef struct {
+ int count;
+ struct tapi_handle *handle[MAX_TELEPHONY_HANDLE_CNT]; //max is 3
+} SMS_TELEPHONY_HANDLE_LIST_S;
+
+#endif //SMS_PLUGIN_TYPES_H
diff --git a/plugin/sms_plugin/include/SmsPluginUAManager.h b/plugin/sms_plugin/include/SmsPluginUAManager.h
index 728ac0a..a23e2d2 100755
--- a/plugin/sms_plugin/include/SmsPluginUAManager.h
+++ b/plugin/sms_plugin/include/SmsPluginUAManager.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_UA_MANAGER_H
@@ -45,6 +42,10 @@ public:
private:
SmsPluginUAManager();
~SmsPluginUAManager();
+ void lock() { mx.lock(); };
+ void unlock() { mx.unlock(); };
+ void wait() { cv.wait(mx.pMutex()); };
+ void signal() { cv.signal(); };
virtual void run();
@@ -52,7 +53,7 @@ private:
bool bRunning;
- MsgThdSafeQ <SMS_REQUEST_INFO_S> smsTranQ;
+ MsgSimpleQ <SMS_REQUEST_INFO_S> smsTranQ;
Mutex mx;
CndVar cv;
diff --git a/plugin/sms_plugin/include/SmsPluginUDCodec.h b/plugin/sms_plugin/include/SmsPluginUDCodec.h
index 4cb1aac..c109210 100755
--- a/plugin/sms_plugin/include/SmsPluginUDCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginUDCodec.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_UDCODEC_H
diff --git a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
index e5fa4bc..f47b46e 100755
--- a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
@@ -1,20 +1,17 @@
/*
- * msg-service
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#ifndef SMS_PLUGIN_WAPPUSH_HANDLER_H
@@ -41,7 +38,6 @@
#define WSP_CODE_BUFFER_LEFT_LEN_MAX 1024
#define WSP_CODE_BUFFER_RIGHT_LEN_MAX 2048
-#define MemFree(x) {if(x != NULL) free(x);x=NULL;}
#define AcStrlen(x) ((x==NULL)?0:strlen(x))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
@@ -58,8 +54,8 @@ public:
bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
void copyDeliverData(SMS_DELIVER_S *pDeliver);
- void handleWapPushMsg(const char *pUserData, int DataSize);
- void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen);
+ void handleWapPushMsg(const char *pUserData, int DataSize, int simIndex);
+ void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex);
private:
SmsPluginWapPushHandler();
@@ -69,13 +65,14 @@ private:
SMS_WAP_APP_CODE_T getAppCode(const char *pPushHeader);
- void handleMMSNotification(const char *pPushBody, int PushBodyLen);
- void handleSIMessage(char* pPushBody, int PushBodyLen, bool isText);
- void handleSLMessage(char* pPushBody, int PushBodyLen, bool isText);
- void handleCOMessage(char* pPushBody, int PushBodyLen, bool isText);
+ void handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex);
+ void handleSIMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
+ void handleSLMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
+ void handleCOMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
void handleDrmVer1(char* pPushBody, int PushBodyLen);
void getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText);
void createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo);
+ void getDisplayName(MSG_SUB_TYPE_T subType, char* displayName);
unsigned long convertXmlCharToSec(char* pDate);
msg_push_action_t convertSIActionStrToEnum(char* pAction);
msg_push_action_t convertSLActionStrToEnum(char* pAction);