2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "MsgPluginManager.h"
19 #include "MsgSettingHandler.h"
20 #include "MsgGconfWrapper.h"
23 #define DEF_BUF_LEN 128
25 /*==================================================================================================
26 STATIC FUNCTION PROTOTYPES
27 ==================================================================================================*/
29 /*==================================================================================================
30 FUNCTION IMPLEMENTATION
31 ==================================================================================================*/
32 msg_error_t MsgInitSimConfig(MSG_SIM_STATUS_T SimStatus)
34 MSG_DEBUG("Start to initialize SIM Configuration");
36 msg_error_t err = MSG_SUCCESS;
38 if (SimStatus != MSG_SIM_STATUS_NOT_FOUND)
40 MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE;
41 MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType);
45 MSG_DEBUG("No plugin for %d type", mainType);
46 return MSG_ERR_INVALID_PLUGIN_HANDLE;
50 MSG_DEBUG(" ** SIM is available - status : [%d] ** ", SimStatus);
52 err = plg->initConfigData(SimStatus);
59 msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting)
61 msg_error_t err = MSG_SUCCESS;
64 err = MsgGconfGetClient();
66 if (err != MSG_SUCCESS)
68 MSG_DEBUG("Get GConf Client Error");
69 return MSG_ERR_NULL_POINTER;
73 MSG_DEBUG("Setting Type : %d", pSetting->type);
75 switch (pSetting->type)
77 case MSG_GENERAL_OPT :
78 err = MsgSetGeneralOpt(pSetting);
80 case MSG_SMS_SENDOPT :
81 err = MsgSetSMSSendOpt(pSetting);
84 err = MsgSetSMSCList(pSetting, true);
86 case MSG_MMS_SENDOPT :
87 err = MsgSetMMSSendOpt(pSetting);
89 case MSG_MMS_RECVOPT :
90 err = MsgSetMMSRecvOpt(pSetting);
92 case MSG_MMS_STYLEOPT :
93 err = MsgSetMMSStyleOpt(pSetting);
95 case MSG_PUSHMSG_OPT :
96 err = MsgSetPushMsgOpt(pSetting);
99 err = MsgSetCBMsgOpt(pSetting, true);
101 case MSG_VOICEMAIL_OPT :
102 err = MsgSetVoiceMailOpt(pSetting, true);
104 case MSG_MSGSIZE_OPT:
105 err = MsgSetMsgSizeOpt(pSetting);
112 MsgGconfUnrefClient();
119 msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting)
122 msg_error_t err = MsgGconfGetClient();
124 if (err != MSG_SUCCESS)
126 MSG_DEBUG("Get GConf Client Error");
127 return MSG_ERR_NULL_POINTER;
131 // Check SIM is present or not
132 MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
134 switch (pSetting->type)
136 case MSG_GENERAL_OPT :
137 MsgGetGeneralOpt(pSetting);
139 case MSG_SMS_SENDOPT :
140 MsgGetSMSSendOpt(pSetting);
144 if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
145 MSG_DEBUG("SIM is not present..");
146 return MSG_ERR_NO_SIM;
148 MsgGetSMSCList(pSetting);
151 case MSG_MMS_SENDOPT :
152 MsgGetMMSSendOpt(pSetting);
154 case MSG_MMS_RECVOPT :
155 MsgGetMMSRecvOpt(pSetting);
157 case MSG_MMS_STYLEOPT :
158 MsgGetMMSStyleOpt(pSetting);
160 case MSG_PUSHMSG_OPT :
161 MsgGetPushMsgOpt(pSetting);
165 if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
166 MSG_DEBUG("SIM is not present..");
167 return MSG_ERR_NO_SIM;
169 MsgGetCBMsgOpt(pSetting);
172 case MSG_VOICEMAIL_OPT :
173 MsgGetVoiceMailOpt(pSetting);
175 case MSG_MSGSIZE_OPT :
176 MsgGetMsgSizeOpt(pSetting);
184 MsgGconfUnrefClient();
191 msg_error_t MsgSetGeneralOpt(const MSG_SETTING_S *pSetting)
193 MSG_GENERAL_OPT_S generalOpt;
196 memcpy(&generalOpt, &(pSetting->option.generalOpt), sizeof(MSG_GENERAL_OPT_S));
198 MsgSettingGetBool(MSG_KEEP_COPY, &bValue);
199 if (bValue != generalOpt.bKeepCopy) {
200 if (MsgSettingSetBool(MSG_KEEP_COPY, generalOpt.bKeepCopy) != MSG_SUCCESS) {
201 MSG_DEBUG("Error to set config data [%s]", MSG_KEEP_COPY);
202 return MSG_ERR_SET_SETTING;
206 MsgSettingGetBool(MSG_AUTO_ERASE, &bValue);
207 if (bValue != generalOpt.bAutoErase) {
208 if (MsgSettingSetBool(MSG_AUTO_ERASE, generalOpt.bAutoErase) != MSG_SUCCESS) {
209 MSG_DEBUG("Error to set config data [%s]", MSG_AUTO_ERASE);
210 return MSG_ERR_SET_SETTING;
214 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
215 iValue = MsgSettingGetInt(MSG_ALERT_TONE);
216 if (iValue != (int)generalOpt.alertTone) {
217 if (MsgSettingSetInt(MSG_ALERT_TONE, (int)generalOpt.alertTone) != MSG_SUCCESS) {
218 MSG_DEBUG("Error to set config data [%s]", MSG_ALERT_TONE);
219 return MSG_ERR_SET_SETTING;
222 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
228 msg_error_t MsgSetSMSSendOpt(const MSG_SETTING_S *pSetting)
230 MSG_SMS_SENDOPT_S sendOpt;
234 memcpy(&sendOpt, &(pSetting->option.smsSendOpt), sizeof(MSG_SMS_SENDOPT_S));
236 iValue = MsgSettingGetInt(SMS_SEND_DCS);
237 if (iValue != (int)sendOpt.dcs) {
238 if (MsgSettingSetInt(SMS_SEND_DCS, (int)sendOpt.dcs) != MSG_SUCCESS) {
239 MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DCS);
240 return MSG_ERR_SET_SETTING;
244 iValue = MsgSettingGetInt(SMS_SEND_NETWORK_MODE);
245 if (iValue != (int)sendOpt.netMode) {
246 if (MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)sendOpt.netMode) != MSG_SUCCESS) {
247 MSG_DEBUG("Error to set config data [%s]", SMS_SEND_NETWORK_MODE);
248 return MSG_ERR_SET_SETTING;
252 MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bValue);
253 if (bValue != sendOpt.bReplyPath) {
254 if (MsgSettingSetBool(SMS_SEND_REPLY_PATH, sendOpt.bReplyPath) != MSG_SUCCESS) {
255 MSG_DEBUG("Error to set config data [%s]", SMS_SEND_REPLY_PATH);
256 return MSG_ERR_SET_SETTING;
260 MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bValue);
261 if (bValue != sendOpt.bDeliveryReport) {
262 if (MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) {
263 MSG_DEBUG("Error to set config data [%s]", SMS_SEND_DELIVERY_REPORT);
264 return MSG_ERR_SET_SETTING;
268 iValue = MsgSettingGetInt(SMS_SEND_SAVE_STORAGE);
269 if (iValue != (int)sendOpt.saveStorage) {
270 if (MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)sendOpt.saveStorage) != MSG_SUCCESS) {
271 MSG_DEBUG("Error to set config data [%s]", SMS_SEND_SAVE_STORAGE);
272 return MSG_ERR_SET_SETTING;
280 msg_error_t MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim)
282 msg_error_t err = MSG_SUCCESS;
284 for (int index = 0; index < pSetting->option.smscList.totalCnt; index++)
286 if(strlen(pSetting->option.smscList.smscData[index].smscAddr.address) > SMSC_ADDR_MAX)
288 MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address));
289 return MSG_ERR_SET_SIM_SET;
295 err = MsgSetConfigInSim(pSetting);
297 if (err != MSG_SUCCESS)
299 MSG_DEBUG("Error to set config data in sim [%d]", err);
304 MSG_SMSC_LIST_S smscList;
306 memcpy(&smscList, &(pSetting->option.smscList), sizeof(MSG_SMSC_LIST_S));
308 char keyName[DEF_BUF_LEN] = {0, };
310 // No selected SMSC Info. in SIM.
313 if (MsgSettingSetInt(SMSC_SELECTED, smscList.selected) != MSG_SUCCESS)
315 MSG_DEBUG("Error to set config data [%s]", SMSC_SELECTED);
316 return MSG_ERR_SET_SETTING;
320 if (MsgSettingSetInt(SMSC_TOTAL_COUNT, smscList.totalCnt) != MSG_SUCCESS)
322 MSG_DEBUG("Error to set config data [%s]", SMSC_TOTAL_COUNT);
323 return MSG_ERR_SET_SETTING;
326 for (int i = 0; i < smscList.totalCnt; i++)
328 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i);
330 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].pid)) != MSG_SUCCESS)
333 memset(keyName, 0x00, sizeof(keyName));
334 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i);
336 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].valPeriod)) != MSG_SUCCESS)
339 memset(keyName, 0x00, sizeof(keyName));
340 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i);
342 if ((err = MsgSettingSetString(keyName, smscList.smscData[i].name)) != MSG_SUCCESS)
345 memset(keyName, 0x00, sizeof(keyName));
346 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i);
348 if (smscList.smscData[i].smscAddr.address[0] == '+')
349 smscList.smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
351 smscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
353 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.ton)) != MSG_SUCCESS)
356 memset(keyName, 0x00, sizeof(keyName));
357 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i);
359 smscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
361 if ((err = MsgSettingSetInt(keyName, (int)smscList.smscData[i].smscAddr.npi)) != MSG_SUCCESS)
364 memset(keyName, 0x00, sizeof(keyName));
365 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i);
367 if ((err = MsgSettingSetString(keyName, smscList.smscData[i].smscAddr.address)) != MSG_SUCCESS)
371 if (err != MSG_SUCCESS)
373 MSG_DEBUG("Error to set config data [%s]", keyName);
380 msg_error_t MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting)
382 MSG_MMS_SENDOPT_S sendOpt;
386 memcpy(&sendOpt, &(pSetting->option.mmsSendOpt), sizeof(MSG_MMS_SENDOPT_S));
388 iValue = MsgSettingGetInt(MMS_SEND_MSG_CLASS);
389 if (iValue != (int)sendOpt.msgClass) {
390 if (MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)sendOpt.msgClass) != MSG_SUCCESS) {
391 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_MSG_CLASS);
392 return MSG_ERR_SET_SETTING;
396 iValue = MsgSettingGetInt(MMS_SEND_PRIORITY);
397 if (iValue != (int)sendOpt.priority) {
398 if (MsgSettingSetInt(MMS_SEND_PRIORITY, (int)sendOpt.priority) != MSG_SUCCESS) {
399 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_PRIORITY);
400 return MSG_ERR_SET_SETTING;
404 iValue = MsgSettingGetInt(MMS_SEND_EXPIRY_TIME);
405 if (iValue != (int)sendOpt.expiryTime) {
406 if (MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, (int)sendOpt.expiryTime) != MSG_SUCCESS) {
407 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_EXPIRY_TIME);
408 return MSG_ERR_SET_SETTING;
412 iValue = MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
413 if (iValue != (int)sendOpt.deliveryTime) {
414 if (MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, (int)sendOpt.deliveryTime) != MSG_SUCCESS) {
415 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_TIME);
416 return MSG_ERR_SET_SETTING;
420 iValue = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY);
421 if (iValue != (int)sendOpt.customDeliveryTime) {
422 if (MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, sendOpt.customDeliveryTime) != MSG_SUCCESS) {
423 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CUSTOM_DELIVERY);
424 return MSG_ERR_SET_SETTING;
428 MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bValue);
429 if (bValue != sendOpt.bSenderVisibility) {
430 if (MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, sendOpt.bSenderVisibility) != MSG_SUCCESS) {
431 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_SENDER_VISIBILITY);
432 return MSG_ERR_SET_SETTING;
436 MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bValue);
437 if (bValue != sendOpt.bDeliveryReport) {
438 if (MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, sendOpt.bDeliveryReport) != MSG_SUCCESS) {
439 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_DELIVERY_REPORT);
440 return MSG_ERR_SET_SETTING;
444 MsgSettingGetBool(MMS_SEND_READ_REPLY, &bValue);
445 if (bValue != sendOpt.bReadReply) {
446 if (MsgSettingSetBool(MMS_SEND_READ_REPLY, sendOpt.bReadReply) != MSG_SUCCESS) {
447 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_READ_REPLY);
448 return MSG_ERR_SET_SETTING;
451 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
452 if (MsgSettingSetBool(MMS_SEND_KEEP_COPY, sendOpt.bKeepCopy) != MSG_SUCCESS)
454 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_KEEP_COPY);
455 return MSG_ERR_SET_SETTING;
457 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
459 MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bValue);
460 if (bValue != sendOpt.bBodyReplying) {
461 if (MsgSettingSetBool(MMS_SEND_BODY_REPLYING, sendOpt.bBodyReplying) != MSG_SUCCESS) {
462 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_BODY_REPLYING);
463 return MSG_ERR_SET_SETTING;
467 MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bValue);
468 if (bValue != sendOpt.bHideRecipients) {
469 if (MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, sendOpt.bHideRecipients) != MSG_SUCCESS)
471 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_HIDE_RECIPIENTS);
472 return MSG_ERR_SET_SETTING;
476 iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING);
477 if (iValue != sendOpt.replyCharging) {
478 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, sendOpt.replyCharging) != MSG_SUCCESS) {
479 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING);
480 return MSG_ERR_SET_SETTING;
484 iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE);
485 if (iValue != (int)sendOpt.replyChargingDeadline) {
486 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, sendOpt.replyChargingDeadline) != MSG_SUCCESS) {
487 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_DEADLINE);
488 return MSG_ERR_SET_SETTING;
492 iValue = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE);
493 if (iValue != (int)sendOpt.replyChargingSize) {
494 if (MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, sendOpt.replyChargingSize) != MSG_SUCCESS) {
495 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_REPLY_CHARGING_SIZE);
496 return MSG_ERR_SET_SETTING;
500 iValue = MsgSettingGetInt(MMS_SEND_CREATION_MODE);
501 if (iValue != sendOpt.creationMode) {
502 if (MsgSettingSetInt(MMS_SEND_CREATION_MODE, sendOpt.creationMode) != MSG_SUCCESS) {
503 MSG_DEBUG("Error to set config data [%s]", MMS_SEND_CREATION_MODE);
504 return MSG_ERR_SET_SETTING;
512 msg_error_t MsgSetMMSRecvOpt(const MSG_SETTING_S *pSetting)
514 MSG_MMS_RECVOPT_S recvOpt;
518 memcpy(&recvOpt, &(pSetting->option.mmsRecvOpt), sizeof(MSG_MMS_RECVOPT_S));
520 iValue = MsgSettingGetInt(MMS_RECV_HOME_NETWORK);
521 if (iValue != (int)recvOpt.homeNetwork) {
522 if (MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)recvOpt.homeNetwork) != MSG_SUCCESS) {
523 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_HOME_NETWORK);
524 return MSG_ERR_SET_SETTING;
528 iValue = MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
529 if (iValue != (int)recvOpt.abroadNetwok) {
530 if (MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)recvOpt.abroadNetwok) != MSG_SUCCESS) {
531 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_ABROAD_NETWORK);
532 return MSG_ERR_SET_SETTING;
536 MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &bValue);
537 if (bValue != recvOpt.readReceipt) {
538 if (MsgSettingSetBool(MMS_RECV_READ_RECEIPT, recvOpt.readReceipt) != MSG_SUCCESS) {
539 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_READ_RECEIPT);
540 return MSG_ERR_SET_SETTING;
544 MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bValue);
545 if (bValue != recvOpt.bDeliveryReceipt) {
546 if (MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, recvOpt.bDeliveryReceipt) != MSG_SUCCESS) {
547 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_DELIVERY_RECEIPT);
548 return MSG_ERR_SET_SETTING;
552 MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bValue);
553 if (bValue != recvOpt.bRejectUnknown) {
554 if (MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, recvOpt.bRejectUnknown) != MSG_SUCCESS) {
555 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_UNKNOWN);
556 return MSG_ERR_SET_SETTING;
560 MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bValue);
561 if (bValue != recvOpt.bRejectAdvertisement) {
562 if (MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, recvOpt.bRejectAdvertisement) != MSG_SUCCESS) {
563 MSG_DEBUG("Error to set config data [%s]", MMS_RECV_REJECT_ADVERTISE);
564 return MSG_ERR_SET_SETTING;
572 msg_error_t MsgSetMMSStyleOpt(const MSG_SETTING_S *pSetting)
574 MSG_MMS_STYLEOPT_S styleOpt;
578 memcpy(&styleOpt, &(pSetting->option.mmsStyleOpt), sizeof(MSG_MMS_STYLEOPT_S));
580 iValue = MsgSettingGetInt(MMS_STYLE_FONT_SIZE);
581 if (iValue != (int)styleOpt.fontSize) {
582 if (MsgSettingSetInt(MMS_STYLE_FONT_SIZE, styleOpt.fontSize) != MSG_SUCCESS) {
583 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_SIZE);
584 return MSG_ERR_SET_SETTING;
588 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &bValue);
589 if (bValue != styleOpt.bFontStyleBold) {
590 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_BOLD, styleOpt.bFontStyleBold) != MSG_SUCCESS) {
591 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_BOLD);
592 return MSG_ERR_SET_SETTING;
596 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &bValue);
597 if (bValue != styleOpt.bFontStyleItalic) {
598 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_ITALIC, styleOpt.bFontStyleItalic) != MSG_SUCCESS) {
599 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_ITALIC);
600 return MSG_ERR_SET_SETTING;
604 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &bValue);
605 if (bValue != styleOpt.bFontStyleUnderline) {
606 if (MsgSettingSetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, styleOpt.bFontStyleUnderline) != MSG_SUCCESS) {
607 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_STYLE_UNDERLINE);
608 return MSG_ERR_SET_SETTING;
612 iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED);
613 if (iValue != (int)styleOpt.fontColorRed) {
614 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, styleOpt.fontColorRed) != MSG_SUCCESS) {
615 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_RED);
616 return MSG_ERR_SET_SETTING;
620 iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN);
621 if (iValue != (int)styleOpt.fontColorGreen) {
622 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, styleOpt.fontColorGreen) != MSG_SUCCESS) {
623 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_GREEN);
624 return MSG_ERR_SET_SETTING;
628 iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE);
629 if (iValue != (int)styleOpt.fontColorBlue) {
630 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, styleOpt.fontColorBlue) != MSG_SUCCESS) {
631 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_BLUE);
632 return MSG_ERR_SET_SETTING;
636 iValue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE);
637 if (iValue != (int)styleOpt.fontColorHue) {
638 if (MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, styleOpt.fontColorHue) != MSG_SUCCESS) {
639 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_FONT_COLOR_HUE);
640 return MSG_ERR_SET_SETTING;
644 iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED);
645 if (iValue != (int)styleOpt.bgColorRed) {
646 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, styleOpt.bgColorRed) != MSG_SUCCESS) {
647 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_RED);
648 return MSG_ERR_SET_SETTING;
652 iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN);
653 if (iValue != (int)styleOpt.bgColorGreen) {
654 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, styleOpt.bgColorGreen) != MSG_SUCCESS) {
655 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_GREEN);
656 return MSG_ERR_SET_SETTING;
660 iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE);
661 if (iValue != (int)styleOpt.bgColorBlue) {
662 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, styleOpt.bgColorBlue) != MSG_SUCCESS) {
663 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_BLUE);
664 return MSG_ERR_SET_SETTING;
668 iValue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE);
669 if (iValue != (int)styleOpt.bgColorHue) {
670 if (MsgSettingSetInt(MMS_STYLE_BG_COLOR_HUE, styleOpt.bgColorHue) != MSG_SUCCESS) {
671 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_BG_COLOR_HUE);
672 return MSG_ERR_SET_SETTING;
676 iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR);
677 if (iValue != (int)styleOpt.pageDur) {
678 if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR, styleOpt.pageDur) != MSG_SUCCESS) {
679 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR);
680 return MSG_ERR_SET_SETTING;
684 iValue = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR);
685 if (iValue != (int)styleOpt.pageCustomDur) {
686 if (MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, styleOpt.pageCustomDur) != MSG_SUCCESS) {
687 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_CUSTOM_DUR);
688 return MSG_ERR_SET_SETTING;
692 iValue = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL);
693 if (iValue != (int)styleOpt.pageDurManual) {
694 if (MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, styleOpt.pageDurManual) != MSG_SUCCESS) {
695 MSG_DEBUG("Error to set config data [%s]", MMS_STYLE_PAGE_DUR_MANUAL);
696 return MSG_ERR_SET_SETTING;
703 msg_error_t MsgSetPushMsgOpt(const MSG_SETTING_S *pSetting)
705 MSG_PUSHMSG_OPT_S pushOpt;
709 memcpy(&pushOpt, &(pSetting->option.pushMsgOpt), sizeof(MSG_PUSHMSG_OPT_S));
711 MsgSettingGetBool(PUSH_RECV_OPTION, &bValue);
712 if (bValue != pushOpt.bReceive) {
713 if (MsgSettingSetBool(PUSH_RECV_OPTION, pushOpt.bReceive) != MSG_SUCCESS) {
714 MSG_DEBUG("Error to set config data [%s]", PUSH_RECV_OPTION);
715 return MSG_ERR_SET_SETTING;
719 iValue = MsgSettingGetInt(PUSH_SERVICE_TYPE);
720 if (iValue != (int)pushOpt.serviceType) {
721 if (MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)pushOpt.serviceType) != MSG_SUCCESS) {
722 MSG_DEBUG("Error to set config data [%s]", PUSH_SERVICE_TYPE);
723 return MSG_ERR_SET_SETTING;
731 msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim)
733 msg_error_t err = MSG_SUCCESS;
735 MSG_CBMSG_OPT_S cbOpt;
739 memcpy(&cbOpt, &(pSetting->option.cbMsgOpt), sizeof(MSG_CBMSG_OPT_S));
741 if (bSetSim == true) {
742 cbOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
744 if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) {
745 MSG_DEBUG("Channel Count is over Max SIM Count [%d]", cbOpt.channelData.channelCnt);
746 return MSG_ERR_SET_SIM_SET;
749 err = MsgSetConfigInSim(pSetting);
750 if (err != MSG_SUCCESS) {
751 MSG_DEBUG("Error to set config data in sim [%d]", err);
756 MsgSettingGetBool(CB_RECEIVE, &bValue);
757 if (bValue != cbOpt.bReceive) {
758 if (MsgSettingSetBool(CB_RECEIVE, cbOpt.bReceive) != MSG_SUCCESS) {
759 MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE);
760 return MSG_ERR_SET_SETTING;
764 iValue = MsgSettingGetInt(CB_MAX_SIM_COUNT);
765 if (iValue != cbOpt.maxSimCnt) {
766 if (MsgSettingSetInt(CB_MAX_SIM_COUNT, cbOpt.maxSimCnt) != MSG_SUCCESS) {
767 MSG_DEBUG("Error to set config data [%s]", CB_MAX_SIM_COUNT);
768 return MSG_ERR_SET_SETTING;
772 iValue = MsgSettingGetInt(CB_CHANNEL_COUNT);
773 if (iValue != cbOpt.channelData.channelCnt) {
774 if (MsgSettingSetInt(CB_CHANNEL_COUNT, cbOpt.channelData.channelCnt) != MSG_SUCCESS) {
775 MSG_DEBUG("Error to set config data [%s]", CB_CHANNEL_COUNT);
776 return MSG_ERR_SET_SETTING;
780 char keyName[DEF_BUF_LEN] = {0, };
782 for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
784 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i);
786 if ((err = MsgSettingSetBool(keyName, cbOpt.channelData.channelInfo[i].bActivate)) != MSG_SUCCESS)
789 memset(keyName, 0x00, sizeof(keyName));
790 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i);
792 if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].from)) != MSG_SUCCESS)
795 memset(keyName, 0x00, sizeof(keyName));
796 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i);
798 if ((err = MsgSettingSetInt(keyName, cbOpt.channelData.channelInfo[i].to)) != MSG_SUCCESS)
801 memset(keyName, 0x00, sizeof(keyName));
802 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i);
804 if ((err = MsgSettingSetString(keyName, cbOpt.channelData.channelInfo[i].name)) != MSG_SUCCESS)
810 for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
812 memset(keyName, 0x00, sizeof(keyName));
813 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i);
815 if (MsgSettingSetBool(keyName, cbOpt.bLanguage[i]) != MSG_SUCCESS)
817 MSG_DEBUG("Error to set config data [%s]", keyName);
818 return MSG_ERR_SET_SETTING;
827 msg_error_t MsgSetVoiceMailOpt(const MSG_SETTING_S *pSetting, bool bSetSim)
829 MSG_VOICEMAIL_OPT_S voiceMailOpt;
831 msg_error_t err = MSG_SUCCESS;
833 memcpy(&voiceMailOpt, &(pSetting->option.voiceMailOpt), sizeof(MSG_VOICEMAIL_OPT_S));
835 pValue = MsgSettingGetString(VOICEMAIL_NUMBER);
836 if (pValue != NULL && strcmp(pValue, voiceMailOpt.mailNumber) == 0) {
837 /* Value is same with previous one. Therefore, we don't need to save it. */
839 if (bSetSim == true) {
840 err = MsgSetConfigInSim(pSetting);
842 if (err == MSG_SUCCESS) {
843 err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber);
844 if (err != MSG_SUCCESS)
845 MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER);
847 MSG_DEBUG("Error to set config data in sim [%d]", err);
850 err = MsgSettingSetString(VOICEMAIL_NUMBER, voiceMailOpt.mailNumber);
851 if (err != MSG_SUCCESS)
852 MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_NUMBER);
856 if (pValue != NULL) {
865 msg_error_t MsgSetMsgSizeOpt(const MSG_SETTING_S *pSetting)
867 MSG_MSGSIZE_OPT_S msgSizeOpt;
870 memcpy(&msgSizeOpt, &(pSetting->option.msgSizeOpt), sizeof(MSG_MSGSIZE_OPT_S));
872 iValue = MsgSettingGetInt(MSGSIZE_OPTION);
873 if (iValue != msgSizeOpt.nMsgSize) {
874 if (MsgSettingSetInt(MSGSIZE_OPTION, msgSizeOpt.nMsgSize) != MSG_SUCCESS) {
875 MSG_DEBUG("Error to set config data [%s]", MSGSIZE_OPTION);
876 return MSG_ERR_SET_SETTING;
884 void MsgGetGeneralOpt(MSG_SETTING_S *pSetting)
886 memset(&(pSetting->option.generalOpt), 0x00, sizeof(MSG_GENERAL_OPT_S));
888 MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.generalOpt.bKeepCopy);
890 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
891 pSetting->option.generalOpt.alertTone = (MSG_ALERT_TONE_T)MsgSettingGetInt(MSG_ALERT_TONE);
893 MsgSettingGetBool(MSG_AUTO_ERASE, &pSetting->option.generalOpt.bAutoErase);
894 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
898 void MsgGetSMSSendOpt(MSG_SETTING_S *pSetting)
900 memset(&(pSetting->option.smsSendOpt), 0x00, sizeof(MSG_SMS_SENDOPT_S));
902 pSetting->option.smsSendOpt.dcs = (msg_encode_type_t)MsgSettingGetInt(SMS_SEND_DCS);
904 pSetting->option.smsSendOpt.netMode = (MSG_SMS_NETWORK_MODE_T)MsgSettingGetInt(SMS_SEND_NETWORK_MODE);
906 MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSetting->option.smsSendOpt.bReplyPath);
908 MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSetting->option.smsSendOpt.bDeliveryReport);
910 pSetting->option.smsSendOpt.saveStorage = (MSG_SMS_SAVE_STORAGE_T)MsgSettingGetInt(SMS_SEND_SAVE_STORAGE);
914 void MsgGetSMSCList(MSG_SETTING_S *pSetting)
916 char keyName[DEF_BUF_LEN] = {0, };
917 char *tmpValue = NULL;
919 memset(&(pSetting->option.smscList), 0x00, sizeof(MSG_SMSC_LIST_S));
921 pSetting->option.smscList.selected = MsgSettingGetInt(SMSC_SELECTED);
923 pSetting->option.smscList.totalCnt = MsgSettingGetInt(SMSC_TOTAL_COUNT);
925 for (int i = 0; i < pSetting->option.smscList.totalCnt; i++)
927 memset(keyName, 0x00, sizeof(keyName));
928 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_PID, i);
930 pSetting->option.smscList.smscData[i].pid = (MSG_SMS_PID_T)MsgSettingGetInt(keyName);
932 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
933 memset(keyName, 0x00, sizeof(keyName));
934 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_DCS, i);
936 pSetting->option.smscList.smscData[i].dcs = (msg_encode_type_t)MsgSettingGetInt(keyName);
937 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
939 memset(keyName, 0x00, sizeof(keyName));
940 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_VAL_PERIOD, i);
942 pSetting->option.smscList.smscData[i].valPeriod = (MSG_VAL_PERIOD_T)MsgSettingGetInt(keyName);
944 memset(keyName, 0x00, sizeof(keyName));
945 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NAME, i);
947 memset(pSetting->option.smscList.smscData[i].name, 0x00, SMSC_NAME_MAX+1);
949 tmpValue = MsgSettingGetString(keyName);
950 if (tmpValue != NULL) {
951 strncpy(pSetting->option.smscList.smscData[i].name, tmpValue, SMSC_NAME_MAX);
956 memset(keyName, 0x00, sizeof(keyName));
957 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_TON, i);
959 pSetting->option.smscList.smscData[i].smscAddr.ton = (MSG_SMS_TON_T)MsgSettingGetInt(keyName);
961 memset(keyName, 0x00, sizeof(keyName));
962 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_NPI, i);
964 pSetting->option.smscList.smscData[i].smscAddr.npi = (MSG_SMS_NPI_T)MsgSettingGetInt(keyName);
966 memset(keyName, 0x00, sizeof(keyName));
967 snprintf(keyName, DEF_BUF_LEN, "%s/%d", SMSC_ADDRESS, i);
969 memset(pSetting->option.smscList.smscData[i].smscAddr.address, 0x00, sizeof(pSetting->option.smscList.smscData[i].smscAddr.address));
971 tmpValue = MsgSettingGetString(keyName);
972 if (tmpValue != NULL) {
973 strncpy(pSetting->option.smscList.smscData[i].smscAddr.address, tmpValue, SMSC_ADDR_MAX);
981 void MsgGetMMSSendOpt(MSG_SETTING_S *pSetting)
983 memset(&(pSetting->option.mmsSendOpt), 0x00, sizeof(MSG_MMS_SENDOPT_S));
985 pSetting->option.mmsSendOpt.msgClass = (MSG_MMS_MSG_CLASS_TYPE_T)MsgSettingGetInt(MMS_SEND_MSG_CLASS);
987 pSetting->option.mmsSendOpt.priority = (msg_priority_type_t)MsgSettingGetInt(MMS_SEND_PRIORITY);
989 pSetting->option.mmsSendOpt.expiryTime = (MSG_MMS_EXPIRY_TIME_T)MsgSettingGetInt(MMS_SEND_EXPIRY_TIME);
991 pSetting->option.mmsSendOpt.deliveryTime = (MSG_MMS_DELIVERY_TIME_T)MsgSettingGetInt(MMS_SEND_DELIVERY_TIME);
993 pSetting->option.mmsSendOpt.customDeliveryTime = MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY);
995 MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &pSetting->option.mmsSendOpt.bSenderVisibility);
997 MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &pSetting->option.mmsSendOpt.bDeliveryReport);
999 MsgSettingGetBool(MMS_SEND_READ_REPLY, &pSetting->option.mmsSendOpt.bReadReply);
1001 #ifdef __NOT_USED_BY_DESIGN_CHANGE__
1002 MsgSettingGetBool(MSG_KEEP_COPY, &pSetting->option.mmsSendOpt.bKeepCopy);
1003 #endif /* __NOT_USED_BY_DESIGN_CHANGE__ */
1005 MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &pSetting->option.mmsSendOpt.bBodyReplying);
1007 MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &pSetting->option.mmsSendOpt.bHideRecipients);
1009 pSetting->option.mmsSendOpt.replyCharging = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING);
1011 pSetting->option.mmsSendOpt.replyChargingDeadline = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE);
1013 pSetting->option.mmsSendOpt.replyChargingSize = MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE);
1015 pSetting->option.mmsSendOpt.creationMode = MsgSettingGetInt(MMS_SEND_CREATION_MODE);
1019 void MsgGetMMSRecvOpt(MSG_SETTING_S *pSetting)
1021 memset(&(pSetting->option.mmsRecvOpt), 0x00, sizeof(MSG_MMS_RECVOPT_S));
1023 pSetting->option.mmsRecvOpt.homeNetwork = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_HOME_NETWORK);
1025 pSetting->option.mmsRecvOpt.abroadNetwok = (MSG_MMS_ABROAD_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
1027 MsgSettingGetBool(MMS_RECV_READ_RECEIPT, &pSetting->option.mmsRecvOpt.readReceipt);
1029 MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &pSetting->option.mmsRecvOpt.bDeliveryReceipt);
1031 MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &pSetting->option.mmsRecvOpt.bRejectUnknown);
1033 MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &pSetting->option.mmsRecvOpt.bRejectAdvertisement);
1037 void MsgGetMMSStyleOpt(MSG_SETTING_S *pSetting)
1039 memset(&(pSetting->option.mmsStyleOpt), 0x00, sizeof(MSG_MMS_STYLEOPT_S));
1041 pSetting->option.mmsStyleOpt.fontSize = MsgSettingGetInt(MMS_STYLE_FONT_SIZE);
1043 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_BOLD, &pSetting->option.mmsStyleOpt.bFontStyleBold);
1045 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_ITALIC, &pSetting->option.mmsStyleOpt.bFontStyleItalic);
1047 MsgSettingGetBool(MMS_STYLE_FONT_STYLE_UNDERLINE, &pSetting->option.mmsStyleOpt.bFontStyleUnderline);
1049 pSetting->option.mmsStyleOpt.fontColorRed = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED);
1051 pSetting->option.mmsStyleOpt.fontColorGreen = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN);
1053 pSetting->option.mmsStyleOpt.fontColorBlue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE);
1055 pSetting->option.mmsStyleOpt.fontColorHue = MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE);
1057 pSetting->option.mmsStyleOpt.bgColorRed = MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED);
1059 pSetting->option.mmsStyleOpt.bgColorGreen = MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN);
1061 pSetting->option.mmsStyleOpt.bgColorBlue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE);
1063 pSetting->option.mmsStyleOpt.bgColorHue = MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE);
1065 pSetting->option.mmsStyleOpt.pageDur = MsgSettingGetInt(MMS_STYLE_PAGE_DUR);
1067 pSetting->option.mmsStyleOpt.pageCustomDur = MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR);
1069 pSetting->option.mmsStyleOpt.pageDurManual = MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL);
1073 void MsgGetPushMsgOpt(MSG_SETTING_S *pSetting)
1075 memset(&(pSetting->option.pushMsgOpt), 0x00, sizeof(MSG_PUSHMSG_OPT_S));
1077 MsgSettingGetBool(PUSH_RECV_OPTION, &pSetting->option.pushMsgOpt.bReceive);
1079 pSetting->option.pushMsgOpt.serviceType = (MSG_PUSH_SERVICE_TYPE_T)MsgSettingGetInt(PUSH_SERVICE_TYPE);
1083 void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting)
1085 char keyName[DEF_BUF_LEN] = {0, };
1086 char *tmpValue = NULL;
1088 memset(&(pSetting->option.cbMsgOpt), 0x00, sizeof(MSG_CBMSG_OPT_S));
1090 MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive);
1092 pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
1094 pSetting->option.cbMsgOpt.channelData.channelCnt = MsgSettingGetInt(CB_CHANNEL_COUNT);
1096 for (int i = 0; i < pSetting->option.cbMsgOpt.channelData.channelCnt; i++)
1098 memset(keyName, 0x00, sizeof(keyName));
1099 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ACTIVATE, i);
1101 MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.channelData.channelInfo[i].bActivate);
1103 memset(keyName, 0x00, sizeof(keyName));
1104 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_FROM, i);
1105 pSetting->option.cbMsgOpt.channelData.channelInfo[i].from = MsgSettingGetInt(keyName);
1106 MSG_DEBUG("channel[%d]: from: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].from);
1108 memset(keyName, 0x00, sizeof(keyName));
1109 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_ID_TO, i);
1110 pSetting->option.cbMsgOpt.channelData.channelInfo[i].to = MsgSettingGetInt(keyName);
1111 MSG_DEBUG("channel[%d]: to: %d", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].to);
1113 memset(keyName, 0x00, sizeof(keyName));
1114 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_CHANNEL_NAME, i);
1116 tmpValue = MsgSettingGetString(keyName);
1117 if (tmpValue != NULL) {
1118 strncpy(pSetting->option.cbMsgOpt.channelData.channelInfo[i].name, tmpValue, CB_CHANNEL_NAME_MAX);
1119 MSG_DEBUG("channel[%d]: channel_name: %s", i, pSetting->option.cbMsgOpt.channelData.channelInfo[i].name);
1125 for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
1127 memset(keyName, 0x00, sizeof(keyName));
1128 snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i);
1130 MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]);
1134 void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting)
1136 char *tmpValue = NULL;
1138 memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
1140 tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
1141 if (tmpValue != NULL) {
1142 strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
1149 void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting)
1151 memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
1153 pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
1157 msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting)
1159 msg_error_t err = MSG_SUCCESS;
1161 MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
1163 // Get Setting Data from SIM
1165 err = plg->setConfigData(pSetting);
1167 err = MSG_ERR_NULL_POINTER;
1169 if (err != MSG_SUCCESS)
1171 MSG_DEBUG("Error. Error code is %d.", err);
1178 #ifdef __NOT_USED_BY_ENV_CHANGE__
1179 void MsgSetDefaultConfig()
1184 // Set Default General SendOpt
1185 if (MsgSettingGetBool(MSG_KEEP_COPY, &bTmp) < 0)
1186 MsgSettingSetBool(MSG_KEEP_COPY, true);
1188 if (MsgSettingGetInt(MSG_ALERT_TONE) < 0)
1189 MsgSettingSetInt(MSG_ALERT_TONE, (int)MSG_ALERT_TONE_ONCE);
1191 if (MsgSettingGetBool(MSG_AUTO_ERASE, &bTmp) < 0)
1192 MsgSettingGetBool(MSG_AUTO_ERASE, false);
1194 // Set Default SMS SendOpt
1195 if (MsgSettingGetInt(SMS_SEND_DCS) < 0)
1196 MsgSettingSetInt(SMS_SEND_DCS, (int)MSG_ENCODE_AUTO);
1198 if (MsgSettingGetInt(SMS_SEND_NETWORK_MODE) < 0)
1199 MsgSettingSetInt(SMS_SEND_NETWORK_MODE, (int)MSG_SMS_NETWORK_CS_ONLY);
1201 if (MsgSettingGetBool(SMS_SEND_REPLY_PATH, &bTmp) < 0)
1202 MsgSettingSetBool(SMS_SEND_REPLY_PATH, false);
1204 if (MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &bTmp) < 0)
1205 MsgSettingSetBool(SMS_SEND_DELIVERY_REPORT, false);
1207 if (MsgSettingGetInt(SMS_SEND_SAVE_STORAGE) < 0)
1208 MsgSettingSetInt(SMS_SEND_SAVE_STORAGE, (int)MSG_SMS_SAVE_STORAGE_PHONE);
1210 // Set Default SMSC List
1211 if (MsgSettingGetInt(SMSC_SELECTED) < 0)
1212 MsgSettingSetInt(SMSC_SELECTED, 0);
1214 if (MsgSettingGetInt(SMSC_TOTAL_COUNT) < 0)
1215 MsgSettingSetInt(SMSC_TOTAL_COUNT, 1);
1217 memset(keyName, 0x00, sizeof(keyName));
1218 sprintf(keyName, "%s/%d", SMSC_PID, 0);
1220 if (MsgSettingGetInt(keyName) < 0)
1221 MsgSettingSetInt(keyName, (int)MSG_PID_TEXT);
1223 memset(keyName, 0x00, sizeof(keyName));
1224 sprintf(keyName, "%s/%d", SMSC_VAL_PERIOD, MSG_VAL_MAXIMUM);
1226 if (MsgSettingGetInt(keyName) < 0)
1227 MsgSettingSetInt(keyName, 0);
1229 memset(keyName, 0x00, sizeof(keyName));
1230 sprintf(keyName, "%s/%d", SMSC_NAME, 0);
1232 char *smscName = NULL;
1234 smscName = MsgSettingGetString(keyName);
1236 if (smscName == NULL) {
1237 MsgSettingSetString(keyName, (char*)"SMS Centre 1");
1243 memset(keyName, 0x00, sizeof(keyName));
1244 sprintf(keyName, "%s/%d", SMSC_TON, 0);
1246 if (MsgSettingGetInt(keyName) < 0)
1247 MsgSettingSetInt(keyName, (int)MSG_TON_INTERNATIONAL);
1249 memset(keyName, 0x00, sizeof(keyName));
1250 sprintf(keyName, "%s/%d", SMSC_NPI, 0);
1252 if (MsgSettingGetInt(keyName) < 0)
1253 MsgSettingSetInt(keyName, (int)MSG_NPI_ISDN);
1255 memset(keyName, 0x00, sizeof(keyName));
1256 sprintf(keyName, "%s/%d", SMSC_ADDRESS, 0);
1258 char *smscAddress = NULL;
1260 smscAddress = MsgSettingGetString(keyName);
1262 if (smscAddress == NULL) {
1263 MsgSettingSetString(keyName, (char*)"8210911111");
1269 // Set Default MMS Send Opt
1270 if (MsgSettingGetInt(MMS_SEND_MSG_CLASS) < 0)
1271 MsgSettingSetInt(MMS_SEND_MSG_CLASS, (int)MSG_CLASS_AUTO);
1273 if (MsgSettingGetInt(MMS_SEND_PRIORITY) < 0)
1274 MsgSettingSetInt(MMS_SEND_PRIORITY, (int)MSG_MESSAGE_PRIORITY_NORMAL);
1276 if (MsgSettingGetInt(MMS_SEND_EXPIRY_TIME) < 0)
1277 MsgSettingSetInt(MMS_SEND_EXPIRY_TIME, 86400);
1279 if (MsgSettingGetInt(MMS_SEND_DELIVERY_TIME) < 0)
1280 MsgSettingSetInt(MMS_SEND_DELIVERY_TIME, 0);
1282 if (MsgSettingGetInt(MMS_SEND_CUSTOM_DELIVERY) < 0)
1283 MsgSettingSetInt(MMS_SEND_CUSTOM_DELIVERY, 0);
1285 if (MsgSettingGetBool(MMS_SEND_SENDER_VISIBILITY, &bTmp) < 0)
1286 MsgSettingSetBool(MMS_SEND_SENDER_VISIBILITY, false);
1288 if (MsgSettingGetBool(MMS_SEND_DELIVERY_REPORT, &bTmp) < 0)
1289 MsgSettingSetBool(MMS_SEND_DELIVERY_REPORT, true);
1291 if (MsgSettingGetBool(MMS_SEND_READ_REPLY, &bTmp) < 0)
1292 MsgSettingSetBool(MMS_SEND_READ_REPLY, false);
1294 if (MsgSettingGetBool(MMS_SEND_KEEP_COPY, &bTmp) < 0)
1295 MsgSettingSetBool(MMS_SEND_KEEP_COPY, false);
1297 if (MsgSettingGetBool(MMS_SEND_BODY_REPLYING, &bTmp) < 0)
1298 MsgSettingSetBool(MMS_SEND_BODY_REPLYING, false);
1300 if (MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bTmp) < 0)
1301 MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, false);
1303 if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING) < 0)
1304 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING, (int)MSG_REPLY_CHARGING_NONE);
1306 if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_DEADLINE) < 0)
1307 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_DEADLINE, 0);
1309 if (MsgSettingGetInt(MMS_SEND_REPLY_CHARGING_SIZE) < 0)
1310 MsgSettingSetInt(MMS_SEND_REPLY_CHARGING_SIZE, 0);
1312 // Set Default MMS Recv Opt
1313 if (MsgSettingGetInt(MMS_RECV_HOME_NETWORK) < 0)
1314 MsgSettingSetInt(MMS_RECV_HOME_NETWORK, (int)MSG_HOME_AUTO_DOWNLOAD);
1316 if (MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK) < 0)
1317 MsgSettingSetInt(MMS_RECV_ABROAD_NETWORK, (int)MSG_ABROAD_RESTRICTED);
1319 if (MsgSettingGetInt(MMS_RECV_READ_RECEIPT) < 0)
1320 MsgSettingSetInt(MMS_RECV_READ_RECEIPT, (int)MSG_SEND_READ_REPORT_NEVER);
1322 if (MsgSettingGetBool(MMS_RECV_DELIVERY_RECEIPT, &bTmp) < 0)
1323 MsgSettingSetBool(MMS_RECV_DELIVERY_RECEIPT, true);
1325 if (MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bTmp) < 0)
1326 MsgSettingSetBool(MMS_RECV_REJECT_UNKNOWN, false);
1328 if (MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bTmp) < 0)
1329 MsgSettingSetBool(MMS_RECV_REJECT_ADVERTISE, false);
1331 // Set Default MMS Style Opt
1332 if (MsgSettingGetInt(MMS_STYLE_FONT_SIZE) < 0)
1333 MsgSettingSetInt(MMS_STYLE_FONT_SIZE, 30);
1335 if (MsgSettingGetInt(MMS_STYLE_FONT_STYLE) < 0)
1336 MsgSettingSetInt(MMS_STYLE_FONT_STYLE, 0);
1338 if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_RED) < 0)
1339 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_RED, 0);
1341 if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_GREEN) < 0)
1342 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_GREEN, 0);
1344 if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_BLUE) < 0)
1345 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_BLUE, 0);
1347 if (MsgSettingGetInt(MMS_STYLE_FONT_COLOR_HUE) < 0)
1348 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255);
1350 if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_RED) < 0)
1351 MsgSettingSetInt(MMS_STYLE_BG_COLOR_RED, 255);
1353 if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_GREEN) < 0)
1354 MsgSettingSetInt(MMS_STYLE_BG_COLOR_GREEN, 255);
1356 if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_BLUE) < 0)
1357 MsgSettingSetInt(MMS_STYLE_BG_COLOR_BLUE, 255);
1359 if (MsgSettingGetInt(MMS_STYLE_BG_COLOR_HUE) < 0)
1360 MsgSettingSetInt(MMS_STYLE_FONT_COLOR_HUE, 255);
1362 if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR) < 0)
1363 MsgSettingSetInt(MMS_STYLE_PAGE_DUR, 2);
1365 if (MsgSettingGetInt(MMS_STYLE_PAGE_CUSTOM_DUR) < 0)
1366 MsgSettingSetInt(MMS_STYLE_PAGE_CUSTOM_DUR, 0);
1368 if (MsgSettingGetInt(MMS_STYLE_PAGE_DUR_MANUAL) < 0)
1369 MsgSettingSetInt(MMS_STYLE_PAGE_DUR_MANUAL, 0);
1371 // Set Default Push Msg Opt
1372 if (MsgSettingGetBool(PUSH_RECV_OPTION, &bTmp) < 0)
1373 MsgSettingSetBool(PUSH_RECV_OPTION, false);
1375 if (MsgSettingGetInt(PUSH_SERVICE_TYPE) < 0)
1376 MsgSettingSetInt(PUSH_SERVICE_TYPE, (int)MSG_PUSH_SERVICE_PROMPT);
1378 // Set Default Cb Msg Opt
1379 if (MsgSettingGetBool(CB_RECEIVE, &bTmp) < 0)
1380 MsgSettingSetBool(CB_RECEIVE, false);
1382 if (MsgSettingGetBool(CB_ALL_CHANNEL, &bTmp) < 0)
1383 MsgSettingSetBool(CB_ALL_CHANNEL, false);
1385 if (MsgSettingGetInt(CB_MAX_SIM_COUNT) < 0)
1386 MsgSettingSetInt(CB_MAX_SIM_COUNT, 0);
1388 if (MsgSettingGetInt(CB_CHANNEL_COUNT) < 0)
1389 MsgSettingSetInt(CB_CHANNEL_COUNT, 0);
1391 for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++)
1393 memset(keyName, 0x00, sizeof(keyName));
1394 sprintf(keyName, "%s/%d", CB_LANGUAGE, i);
1396 if (MsgSettingGetBool(keyName, &bTmp) < 0)
1397 MsgSettingSetBool(keyName, false);
1400 // Set Default SOS Msg Opt
1401 if (MsgSettingGetBool(SOS_SEND_OPTION, &bTmp) < 0)
1402 MsgSettingSetBool(SOS_SEND_OPTION, false);
1404 if (MsgSettingGetInt(SOS_RECIPIENT_COUNT) < 0)
1405 MsgSettingSetInt(SOS_RECIPIENT_COUNT, 0);
1407 if (MsgSettingGetInt(SOS_REPEAT_COUNT) < 0)
1408 MsgSettingSetInt(SOS_REPEAT_COUNT, (int)MSG_SOS_REPEAT_ONCE);
1410 char *tmpValue = NULL;
1412 tmpValue = MsgSettingGetString(keyName);
1414 if (tmpValue == NULL) {
1415 MsgSettingSetString(keyName, NULL);
1421 if (MsgSettingGetInt(SOS_ALERT_TYPE) < 0)
1422 MsgSettingSetInt(SOS_ALERT_TYPE, (int)MSG_SOS_ALERT_TYPE_SOS);
1424 if (MsgSettingGetInt(MSGSIZE_OPTION) < 0)
1425 MsgSettingSetInt(MSGSIZE_OPTION, 300);
1427 #endif /* __NOT_USED_BY_ENV_CHANGE__ */