#include "SmsPluginDSHandler.h"
#include <gio/gio.h>
-extern "C"
-{
+extern "C" {
#include <tapi_common.h>
#include <TelSms.h>
#include <TapiUtility.h>
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle == NULL)
- {
+ if (pPluginHandle == NULL) {
MSG_DEBUG("SMS plugin: create handler error ");
return MSG_ERR_NULL_POINTER;
- }
- else
- {
+ } else {
pPluginHandle->pfInitialize = SmsPlgInitialize;
pPluginHandle->pfFinalize = SmsPlgFinalize;
pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle != NULL)
- {
+ if (pPluginHandle != NULL) {
free(pPluginHandle);
pPluginHandle = NULL;
}
SmsPluginCallback::instance()->registerEvent();
- for(int i=1; i <= simCnt; ++i)
- {
- struct tapi_handle *handle;
+ for (int i = 1; i <= simCnt; ++i) {
+ TapiHandle *handle;
handle = SmsPluginDSHandler::instance()->getTelHandle(i);
SmsPluginSetting::instance()->setSimChangeStatus(handle, true);
}
- // set resource monitor
+ /* set resource monitor */
MsgResourceMonitorInit();
MSG_END();
{
msg_error_t err = MSG_SUCCESS;
- // Add Submit SMS into DB
+ /* Add Submit SMS into DB */
if (pReqInfo->msgInfo.msgId == 0) {
if (pReqInfo->msgInfo.msgPort.valid == false) {
err = SmsPluginStorage::instance()->checkMessage(&(pReqInfo->msgInfo));
}
}
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
snprintf(keyName, sizeof(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)
- {
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
- // Update Msg Status
+ /* Update Msg Status */
if (pReqInfo->msgInfo.msgPort.valid == false)
SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pMsgInfo->sim_idx);
msg_error_t err = MSG_SUCCESS;
- try
- {
+ try {
err = SmsPluginSimMsg::instance()->saveSimMessage(pMsgInfo, pSimIdList);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
return MSG_ERR_NO_SIM;
}
- try
- {
+ try {
SmsPluginSimMsg::instance()->deleteSimMessage(sim_idx, SimMsgId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
return MSG_ERR_NO_SIM;
}
- try
- {
+ try {
SmsPluginSimMsg::instance()->setReadStatus(sim_idx, SimMsgId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL)
- {
status = TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL;
- }
MSG_DEBUG("Set Status : [%d]", status);
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
tapiRet = tel_set_sms_memory_status(handle, status, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
- }
return MSG_SUCCESS;
}
msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
{
- try
- {
- SmsPluginSetting::instance()->setConfigData(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;
}
- catch (MsgException& e)
- {
+
+ try {
+ SmsPluginSetting::instance()->setConfigData(pSetting);
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
{
- try
- {
- SmsPluginSetting::instance()->getConfigData(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;
}
- catch (MsgException& e)
- {
+
+ try {
+ SmsPluginSetting::instance()->getConfigData(pSetting);
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
{
int *simIdList = (int*)pFileData;
- try
- {
+ try {
SmsPluginStorage::instance()->addSmsSendOption(pMsgInfo, pSendOptInfo);
if (simIdList)
SmsPluginStorage::instance()->addSimMessage(pMsgInfo, simIdList);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId)
{
- try
- {
+ try {
SmsPluginDSHandler::instance()->getDefaultNetworkSimId(simId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
gint memStatus;
g_variant_get(parameters, "(i)", &memStatus);
MSG_DEBUG("memStatus = [%d]", memStatus);
- if(memStatus == 0) {
+ if (memStatus == 0) {
int sim_count = SmsPluginDSHandler::instance()->getTelHandleCount();
for (int i = 0; i < sim_count; i++) {
void MsgResourceMonitorInit(void)
{
- MSG_BEGIN();
+ MSG_BEGIN();
GError *error = NULL;