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 <MsgException.h>
19 #include "MsgHandle.h"
22 #include "msg_private.h"
25 /*******************************************************************************
27 *******************************************************************************/
29 int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value)
31 int err = MSG_SUCCESS;
33 switch (msg_struct->type) {
34 case MSG_STRUCT_SETTING_SMSC_OPT :
35 *value = msg_get_smsc_opt_int(msg_struct->data, field);
37 case MSG_STRUCT_SETTING_SMSC_INFO :
38 *value = msg_get_smsc_info_int(msg_struct->data, field);
40 case MSG_STRUCT_SETTING_CB_OPT :
41 *value = msg_get_cb_option_int(msg_struct->data, field);
43 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
44 *value = msg_get_cb_channel_info_int(msg_struct->data, field);
46 case MSG_STRUCT_SETTING_SMS_SEND_OPT :
47 *value = msg_get_sms_send_opt_int(msg_struct->data, field);
49 case MSG_STRUCT_SETTING_MMS_SEND_OPT :
50 *value = msg_get_mms_send_opt_int(msg_struct->data, field);
52 case MSG_STRUCT_SETTING_MMS_RECV_OPT :
53 *value = msg_get_mms_recv_opt_int(msg_struct->data, field);
55 case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
56 *value = msg_get_push_msg_opt_int(msg_struct->data, field);
58 case MSG_STRUCT_SETTING_GENERAL_OPT :
59 *value = msg_get_general_opt_int(msg_struct->data, field);
61 case MSG_STRUCT_SETTING_MSGSIZE_OPT :
62 *value = msg_get_msgsize_opt_int(msg_struct->data, field);
65 err = MSG_ERR_INVALID_PARAMETER;
72 int msg_setting_get_str_value(msg_struct_s *msg_struct, int field, char *src, int size)
74 int err = MSG_SUCCESS;
77 switch (msg_struct->type)
79 case MSG_STRUCT_SETTING_SMSC_INFO :
80 ret_str = msg_get_smsc_info_str(msg_struct->data, field);
82 err = MSG_ERR_UNKNOWN;
84 strncpy(src, ret_str, size);
86 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
87 ret_str = msg_get_cb_channel_info_str(msg_struct->data, field);
89 err = MSG_ERR_UNKNOWN;
91 strncpy(src, ret_str, size);
93 case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
94 ret_str = msg_get_voice_msg_opt_str(msg_struct->data, field);
96 err = MSG_ERR_UNKNOWN;
98 strncpy(src, ret_str, size);
101 err = MSG_ERR_INVALID_PARAMETER;
108 int msg_setting_get_bool_value(msg_struct_s *msg_struct, int field, bool *value)
110 int err = MSG_SUCCESS;
112 switch (msg_struct->type) {
113 case MSG_STRUCT_SETTING_CB_OPT :
114 *value = msg_get_cb_option_bool(msg_struct->data, field);
116 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
117 *value = msg_get_cb_channel_info_bool(msg_struct->data, field);
119 case MSG_STRUCT_SETTING_SMS_SEND_OPT :
120 *value = msg_get_sms_send_opt_bool(msg_struct->data, field);
122 case MSG_STRUCT_SETTING_MMS_SEND_OPT :
123 *value = msg_get_mms_send_opt_bool(msg_struct->data, field);
125 case MSG_STRUCT_SETTING_MMS_RECV_OPT :
126 *value = msg_get_mms_recv_opt_bool(msg_struct->data, field);
128 case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
129 *value = msg_get_push_msg_opt_bool(msg_struct->data, field);
131 case MSG_STRUCT_SETTING_GENERAL_OPT :
132 *value = msg_get_general_opt_bool(msg_struct->data, field);
135 err = MSG_ERR_INVALID_PARAMETER;
142 int msg_setting_get_list_handle(msg_struct_s *msg_struct, int field, void **value)
144 int err = MSG_SUCCESS;
146 switch (msg_struct->type) {
147 case MSG_STRUCT_SETTING_SMSC_OPT :
148 err = msg_get_smsc_opt_list(msg_struct->data, field, value);
150 case MSG_STRUCT_SETTING_CB_OPT :
151 err = msg_get_cb_option_list(msg_struct->data, field, value);
160 int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value)
162 int err = MSG_SUCCESS;
164 switch (msg_struct->type) {
165 case MSG_STRUCT_SETTING_SMSC_OPT :
166 err = msg_set_smsc_opt_int(msg_struct->data, field, value);
168 case MSG_STRUCT_SETTING_SMSC_INFO :
169 err = msg_set_smsc_info_int(msg_struct->data, field, value);
171 case MSG_STRUCT_SETTING_CB_OPT :
172 err = msg_set_cb_option_int(msg_struct->data, field, value);
174 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
175 err = msg_set_cb_channel_info_int(msg_struct->data, field, value);
177 case MSG_STRUCT_SETTING_SMS_SEND_OPT :
178 err = msg_set_sms_send_opt_int(msg_struct->data, field, value);
180 case MSG_STRUCT_SETTING_MMS_SEND_OPT :
181 err = msg_set_mms_send_opt_int(msg_struct->data, field, value);
183 case MSG_STRUCT_SETTING_MMS_RECV_OPT :
184 err = msg_set_mms_recv_opt_int(msg_struct->data, field, value);
186 case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
187 err = msg_set_push_msg_opt_int(msg_struct->data, field, value);
189 case MSG_STRUCT_SETTING_GENERAL_OPT :
190 err = msg_set_general_opt_int(msg_struct->data, field, value);
192 case MSG_STRUCT_SETTING_MSGSIZE_OPT :
193 err = msg_set_msgsize_opt_int(msg_struct->data, field, value);
196 err = MSG_ERR_INVALID_PARAMETER;
203 int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size)
205 int err = MSG_SUCCESS;
207 switch (msg_struct->type)
209 case MSG_STRUCT_SETTING_SMSC_INFO :
210 err = msg_set_smsc_info_str(msg_struct->data, field, value, size);
212 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
213 err = msg_set_cb_channel_info_str(msg_struct->data, field, value, size);
215 case MSG_STRUCT_SETTING_VOICE_MSG_OPT :
216 err = msg_set_voice_msg_opt_str(msg_struct->data, field, value, size);
219 err = MSG_ERR_INVALID_PARAMETER;
226 int msg_setting_set_bool_value(msg_struct_s *msg_struct, int field, bool value)
228 int err = MSG_SUCCESS;
230 switch (msg_struct->type) {
231 case MSG_STRUCT_SETTING_CB_OPT :
232 err = msg_set_cb_option_bool(msg_struct->data, field, value);
234 case MSG_STRUCT_SETTING_CB_CHANNEL_INFO :
235 err = msg_set_cb_channel_info_bool(msg_struct->data, field, value);
237 case MSG_STRUCT_SETTING_SMS_SEND_OPT :
238 err = msg_set_sms_send_opt_bool(msg_struct->data, field, value);
240 case MSG_STRUCT_SETTING_MMS_SEND_OPT :
241 err = msg_set_mms_send_opt_bool(msg_struct->data, field, value);
243 case MSG_STRUCT_SETTING_MMS_RECV_OPT :
244 err = msg_set_mms_recv_opt_bool(msg_struct->data, field, value);
246 case MSG_STRUCT_SETTING_PUSH_MSG_OPT :
247 err = msg_set_push_msg_opt_bool(msg_struct->data, field, value);
249 case MSG_STRUCT_SETTING_GENERAL_OPT :
250 err = msg_set_general_opt_bool(msg_struct->data, field, value);
253 err = MSG_ERR_INVALID_PARAMETER;
261 EXPORT_API int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct)
264 msg_error_t err = MSG_SUCCESS;
271 MsgHandle* pHandle = (MsgHandle*)handle;
275 err = pHandle->getSMSCOption(msg_struct);
277 catch (MsgException& e)
279 MSG_FATAL("%s", e.what());
280 return MSG_ERR_SET_READ_ERROR;
286 EXPORT_API int msg_set_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct)
289 msg_error_t err = MSG_SUCCESS;
291 if (handle == NULL || msg_struct == NULL)
296 MsgHandle* pHandle = (MsgHandle*)handle;
300 err = pHandle->setSMSCOption(msg_struct);
302 catch (MsgException& e)
304 MSG_FATAL("%s", e.what());
305 return MSG_ERR_SET_READ_ERROR;
311 int msg_get_smsc_opt_list(void *smsc_opt, int field, void **value)
314 return MSG_ERR_NULL_POINTER;
316 MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt;
318 int ret = MSG_SUCCESS;
322 case MSG_SMSC_LIST_STRUCT :
323 *value = (void *)smsc_opt_data->smsc_list;
332 int msg_get_smsc_opt_int(void *smsc_opt, int field)
335 return MSG_ERR_NULL_POINTER;
337 int ret = MSG_SUCCESS;
339 MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt;
343 case MSG_SMSC_SELECTED_ID_INT :
344 ret = smsc_opt_data->selected;
347 return MSG_ERR_INVALID_PARAMETER;
353 int msg_set_smsc_opt_int(void *smsc_opt, int field, int value)
356 return MSG_ERR_NULL_POINTER;
358 int ret = MSG_SUCCESS;
360 MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt;
364 case MSG_SMSC_SELECTED_ID_INT :
365 smsc_opt_data->selected = value;
368 ret = MSG_ERR_INVALID_PARAMETER;
375 int msg_get_smsc_info_int(void *smsc_info, int field)
378 return MSG_ERR_NULL_POINTER;
380 int ret = MSG_SUCCESS;
382 MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
386 case MSG_SMSC_ADDR_TON_INT :
387 ret = smsc_data->smscAddr.ton;
389 case MSG_SMSC_ADDR_NPI_INT :
390 ret = smsc_data->smscAddr.npi;
392 case MSG_SMSC_PID_INT :
393 ret = smsc_data->pid;
395 case MSG_SMSC_VAL_PERIOD_INT :
396 ret = smsc_data->valPeriod;
399 return MSG_ERR_INVALID_PARAMETER;
405 int msg_set_smsc_info_int(void *smsc_info, int field, int value)
408 return MSG_ERR_NULL_POINTER;
410 int err = MSG_SUCCESS;
412 MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
416 case MSG_SMSC_ADDR_TON_INT :
417 smsc_data->smscAddr.ton = value;
419 case MSG_SMSC_ADDR_NPI_INT :
420 smsc_data->smscAddr.npi = value;
422 case MSG_SMSC_PID_INT :
423 smsc_data->pid = value;
425 case MSG_SMSC_VAL_PERIOD_INT :
426 smsc_data->valPeriod = value;
429 err = MSG_ERR_INVALID_PARAMETER;
436 char *msg_get_smsc_info_str(void *smsc_info, int field)
441 char *ret_str = NULL;
443 MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
447 case MSG_SMSC_ADDR_STR :
448 ret_str = smsc_data->smscAddr.address;
450 case MSG_SMSC_NAME_STR :
451 ret_str = smsc_data->name;
460 int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size)
463 return MSG_ERR_NULL_POINTER;
465 int err = MSG_SUCCESS;
467 MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info;
471 case MSG_SMSC_ADDR_STR :
472 bzero(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address));
473 snprintf(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address), "%s", val);
475 case MSG_SMSC_NAME_STR :
476 bzero(smsc_data->name, sizeof(smsc_data->name));
477 snprintf(smsc_data->name, sizeof(smsc_data->name), "%s", val);
480 err = MSG_ERR_INVALID_PARAMETER;
487 EXPORT_API int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
490 msg_error_t err = MSG_SUCCESS;
497 MsgHandle* pHandle = (MsgHandle*)handle;
501 err = pHandle->getCBOption(msg_struct);
503 catch (MsgException& e)
505 MSG_FATAL("%s", e.what());
506 return MSG_ERR_SET_READ_ERROR;
512 EXPORT_API int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct)
515 msg_error_t err = MSG_SUCCESS;
517 if (handle == NULL || msg_struct == NULL)
522 MsgHandle* pHandle = (MsgHandle*)handle;
526 err = pHandle->setCBOption(msg_struct);
528 catch (MsgException& e)
530 MSG_FATAL("%s", e.what());
531 return MSG_ERR_SET_READ_ERROR;
537 int msg_get_cb_option_int(void *cb_opt, int field)
540 return MSG_ERR_NULL_POINTER;
542 int ret = MSG_SUCCESS;
544 MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
548 case MSG_CB_MAX_SIM_COUNT_INT :
549 ret = cb_opt_data->maxSimCnt;
552 ret = MSG_ERR_INVALID_PARAMETER;
559 int msg_set_cb_option_int(void *cb_opt, int field, int value)
562 return MSG_ERR_NULL_POINTER;
564 int ret = MSG_SUCCESS;
566 MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
570 case MSG_CB_MAX_SIM_COUNT_INT :
571 cb_opt_data->maxSimCnt = value;
574 ret = MSG_ERR_INVALID_PARAMETER;
582 bool msg_get_cb_option_bool(void *cb_opt, int field)
589 MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
593 case MSG_CB_RECEIVE_BOOL :
594 ret = cb_opt_data->bReceive;
596 case MSG_CB_LANGUAGE_TYPE_ALL_BOOL :
597 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL];
599 case MSG_CB_LANGUAGE_TYPE_ENG_BOOL :
600 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG];
602 case MSG_CB_LANGUAGE_TYPE_GER_BOOL :
603 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER];
605 case MSG_CB_LANGUAGE_TYPE_FRE_BOOL :
606 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE];
608 case MSG_CB_LANGUAGE_TYPE_ITA_BOOL :
609 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA];
611 case MSG_CB_LANGUAGE_TYPE_NED_BOOL :
612 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED];
614 case MSG_CB_LANGUAGE_TYPE_SPA_BOOL :
615 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA];
617 case MSG_CB_LANGUAGE_TYPE_POR_BOOL :
618 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR];
620 case MSG_CB_LANGUAGE_TYPE_SWE_BOOL :
621 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE];
623 case MSG_CB_LANGUAGE_TYPE_TUR_BOOL :
624 ret = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR];
633 int msg_set_cb_option_bool(void *cb_opt, int field, bool value)
636 return MSG_ERR_NULL_POINTER;
638 int ret = MSG_SUCCESS;
640 MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
644 case MSG_CB_RECEIVE_BOOL :
645 cb_opt_data->bReceive = value;
647 case MSG_CB_LANGUAGE_TYPE_ALL_BOOL :
648 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL] = value;
650 case MSG_CB_LANGUAGE_TYPE_ENG_BOOL :
651 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG] = value;
653 case MSG_CB_LANGUAGE_TYPE_GER_BOOL :
654 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER] = value;
656 case MSG_CB_LANGUAGE_TYPE_FRE_BOOL :
657 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE] = value;
659 case MSG_CB_LANGUAGE_TYPE_ITA_BOOL :
660 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA] = value;
662 case MSG_CB_LANGUAGE_TYPE_NED_BOOL :
663 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED] = value;
665 case MSG_CB_LANGUAGE_TYPE_SPA_BOOL :
666 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA] = value;
668 case MSG_CB_LANGUAGE_TYPE_POR_BOOL :
669 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR] = value;
671 case MSG_CB_LANGUAGE_TYPE_SWE_BOOL :
672 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE] = value;
674 case MSG_CB_LANGUAGE_TYPE_TUR_BOOL :
675 cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR] = value;
678 ret = MSG_ERR_INVALID_PARAMETER;
685 int msg_get_cb_option_list(void *cb_opt, int field, void **value)
688 return MSG_ERR_NULL_POINTER;
690 MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt;
692 int ret = MSG_SUCCESS;
696 case MSG_CB_CHANNEL_LIST_STRUCT :
697 *value = (void *)cb_opt_data->channelData;
706 int msg_get_cb_channel_info_int(void *cb_ch_info, int field)
709 return MSG_ERR_NULL_POINTER;
711 int ret = MSG_ERR_INVALID_PARAMETER;
713 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
717 case MSG_CB_CHANNEL_ID_FROM_INT :
718 ret = cb_ch_data->from;
720 case MSG_CB_CHANNEL_ID_TO_INT :
721 ret = cb_ch_data->to;
730 int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value)
733 return MSG_ERR_NULL_POINTER;
735 int ret = MSG_SUCCESS;
737 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
741 case MSG_CB_CHANNEL_ID_FROM_INT :
742 cb_ch_data->from = value;
744 case MSG_CB_CHANNEL_ID_TO_INT :
745 cb_ch_data->to = value;
748 ret = MSG_ERR_INVALID_PARAMETER;
755 bool msg_get_cb_channel_info_bool(void *cb_ch_info, int field)
762 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
766 case MSG_CB_CHANNEL_ACTIVATE_BOOL :
767 ret = cb_ch_data->bActivate;
776 int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value)
779 return MSG_ERR_NULL_POINTER;
781 int ret = MSG_SUCCESS;
783 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
787 case MSG_CB_CHANNEL_ACTIVATE_BOOL :
788 cb_ch_data->bActivate = value;
791 ret = MSG_ERR_INVALID_PARAMETER;
798 char *msg_get_cb_channel_info_str(void *cb_ch_info, int field)
803 char *ret_str = NULL;
805 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
809 case MSG_CB_CHANNEL_NAME_STR :
810 ret_str = cb_ch_data->name;
819 int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size)
822 return MSG_ERR_NULL_POINTER;
824 int ret = MSG_SUCCESS;
826 MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info;
830 case MSG_CB_CHANNEL_NAME_STR :
831 bzero(cb_ch_data->name, sizeof(cb_ch_data->name));
832 snprintf(cb_ch_data->name, sizeof(cb_ch_data->name), "%s", val);
835 ret = MSG_ERR_INVALID_PARAMETER;
842 EXPORT_API int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
845 msg_error_t err = MSG_SUCCESS;
852 MsgHandle* pHandle = (MsgHandle*)handle;
856 err = pHandle->getSmsSendOpt(msg_struct);
858 catch (MsgException& e)
860 MSG_FATAL("%s", e.what());
861 return MSG_ERR_SET_READ_ERROR;
867 EXPORT_API int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
870 msg_error_t err = MSG_SUCCESS;
872 if (handle == NULL || msg_struct == NULL)
877 MsgHandle* pHandle = (MsgHandle*)handle;
881 err = pHandle->setSmsSendOpt(msg_struct);
883 catch (MsgException& e)
885 MSG_FATAL("%s", e.what());
886 return MSG_ERR_SET_READ_ERROR;
892 int msg_get_sms_send_opt_int(void *sms_send_opt, int field)
895 return MSG_ERR_NULL_POINTER;
897 int ret = MSG_ERR_INVALID_PARAMETER;
899 MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
903 case MSG_SMS_SENDOPT_ENCODE_TYPE_INT :
906 case MSG_SMS_SENDOPT_NETWORK_MODE_INT :
907 ret = send_opt->netMode;
909 case MSG_SMS_SENDOPT_SAVE_STORAGE_INT :
910 ret = send_opt->saveStorage;
919 int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value)
922 return MSG_ERR_NULL_POINTER;
924 int ret = MSG_SUCCESS;
926 MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
930 case MSG_SMS_SENDOPT_ENCODE_TYPE_INT :
931 send_opt->dcs = value;
933 case MSG_SMS_SENDOPT_NETWORK_MODE_INT :
934 send_opt->netMode = value;
936 case MSG_SMS_SENDOPT_SAVE_STORAGE_INT :
937 send_opt->saveStorage = value;
940 ret = MSG_ERR_INVALID_PARAMETER;
947 bool msg_get_sms_send_opt_bool(void *sms_send_opt, int field)
954 MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
958 case MSG_SMS_SENDOPT_REPLY_PATH_BOOL :
959 ret = send_opt->bReplyPath;
961 case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL :
962 ret = send_opt->bDeliveryReport;
971 int msg_set_sms_send_opt_bool(void *sms_send_opt, int field, bool value)
976 int ret = MSG_SUCCESS;
978 MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt;
982 case MSG_SMS_SENDOPT_REPLY_PATH_BOOL :
983 send_opt->bReplyPath = value;
985 case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL :
986 send_opt->bDeliveryReport = value;
989 ret = MSG_ERR_INVALID_PARAMETER;
996 EXPORT_API int msg_get_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
999 msg_error_t err = MSG_SUCCESS;
1006 MsgHandle* pHandle = (MsgHandle*)handle;
1010 err = pHandle->getMmsSendOpt(msg_struct);
1012 catch (MsgException& e)
1014 MSG_FATAL("%s", e.what());
1015 return MSG_ERR_SET_READ_ERROR;
1021 EXPORT_API int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct)
1024 msg_error_t err = MSG_SUCCESS;
1026 if (handle == NULL || msg_struct == NULL)
1031 MsgHandle* pHandle = (MsgHandle*)handle;
1035 err = pHandle->setMmsSendOpt(msg_struct);
1037 catch (MsgException& e)
1039 MSG_FATAL("%s", e.what());
1040 return MSG_ERR_SET_READ_ERROR;
1047 int msg_get_mms_send_opt_int(void *mms_send_opt, int field)
1050 return MSG_ERR_NULL_POINTER;
1052 int ret = MSG_ERR_INVALID_PARAMETER;
1054 MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
1058 case MSG_MMS_SENDOPT_CLASS_TYPE_INT :
1059 ret = send_opt->msgClass;
1061 case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT :
1062 ret = send_opt->priority;
1064 case MSG_MMS_SENDOPT_EXPIRY_TIME_INT :
1065 ret = send_opt->expiryTime;
1067 case MSG_MMS_SENDOPT_DELIVERY_TIME_INT :
1068 ret = send_opt->deliveryTime;
1070 case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT :
1071 ret = send_opt->customDeliveryTime;
1073 case MSG_MMS_SENDOPT_REPLY_CHARGING_INT :
1074 ret = send_opt->replyCharging;
1076 case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT :
1077 ret = send_opt->replyChargingDeadline;
1079 case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT :
1080 ret = send_opt->replyChargingSize;
1082 case MSG_MMS_SENDOPT_CREATION_MODE_INT :
1083 ret = send_opt->creationMode;
1092 int msg_set_mms_send_opt_int(void *mms_send_opt, int field, int value)
1095 return MSG_ERR_NULL_POINTER;
1097 int ret = MSG_SUCCESS;
1099 MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
1103 case MSG_MMS_SENDOPT_CLASS_TYPE_INT :
1104 send_opt->msgClass = value;
1106 case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT :
1107 send_opt->priority = value;
1109 case MSG_MMS_SENDOPT_EXPIRY_TIME_INT :
1110 send_opt->expiryTime = value;
1112 case MSG_MMS_SENDOPT_DELIVERY_TIME_INT :
1113 send_opt->deliveryTime = value;
1115 case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT :
1116 send_opt->customDeliveryTime = value;
1118 case MSG_MMS_SENDOPT_REPLY_CHARGING_INT :
1119 send_opt->replyCharging = value;
1121 case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT :
1122 send_opt->replyChargingDeadline = value;
1124 case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT :
1125 send_opt->replyChargingSize = value;
1127 case MSG_MMS_SENDOPT_CREATION_MODE_INT :
1128 send_opt->creationMode = value;
1131 ret = MSG_ERR_INVALID_PARAMETER;
1138 bool msg_get_mms_send_opt_bool(void *mms_send_opt, int field)
1145 MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
1149 case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL :
1150 ret = send_opt->bSenderVisibility;
1152 case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL :
1153 ret = send_opt->bDeliveryReport;
1155 case MSG_MMS_SENDOPT_READ_REPLY_BOOL :
1156 ret = send_opt->bReadReply;
1158 case MSG_MMS_SENDOPT_KEEP_COPY_BOOL :
1159 ret = send_opt->bKeepCopy;
1161 case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL :
1162 ret = send_opt->bBodyReplying;
1164 case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL :
1165 ret = send_opt->bHideRecipients;
1174 int msg_set_mms_send_opt_bool(void *mms_send_opt, int field, bool value)
1177 return MSG_ERR_NULL_POINTER;
1179 int ret = MSG_SUCCESS;
1181 MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt;
1185 case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL :
1186 send_opt->bSenderVisibility = value;
1188 case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL :
1189 send_opt->bDeliveryReport = value;
1191 case MSG_MMS_SENDOPT_READ_REPLY_BOOL :
1192 send_opt->bReadReply = value;
1194 case MSG_MMS_SENDOPT_KEEP_COPY_BOOL :
1195 send_opt->bKeepCopy = value;
1197 case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL :
1198 send_opt->bBodyReplying = value;
1200 case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL :
1201 send_opt->bHideRecipients = value;
1204 ret = MSG_ERR_INVALID_PARAMETER;
1211 EXPORT_API int msg_get_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct)
1214 msg_error_t err = MSG_SUCCESS;
1221 MsgHandle* pHandle = (MsgHandle*)handle;
1225 err = pHandle->getMmsRecvOpt(msg_struct);
1227 catch (MsgException& e)
1229 MSG_FATAL("%s", e.what());
1230 return MSG_ERR_SET_READ_ERROR;
1236 EXPORT_API int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct)
1239 msg_error_t err = MSG_SUCCESS;
1241 if (handle == NULL || msg_struct == NULL)
1246 MsgHandle* pHandle = (MsgHandle*)handle;
1250 err = pHandle->setMmsRecvOpt(msg_struct);
1252 catch (MsgException& e)
1254 MSG_FATAL("%s", e.what());
1255 return MSG_ERR_SET_READ_ERROR;
1261 int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field)
1264 return MSG_ERR_NULL_POINTER;
1266 int ret = MSG_ERR_INVALID_PARAMETER;
1268 MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
1272 case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT :
1273 ret = recv_opt->homeNetwork;
1275 case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT :
1276 ret = recv_opt->abroadNetwok;
1285 int msg_set_mms_recv_opt_int(void *mms_recv_opt, int field, int value)
1288 return MSG_ERR_NULL_POINTER;
1290 int ret = MSG_SUCCESS;
1292 MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
1296 case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT :
1297 recv_opt->homeNetwork = value;
1299 case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT :
1300 recv_opt->abroadNetwok = value;
1303 ret = MSG_ERR_INVALID_PARAMETER;
1310 bool msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field)
1317 MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
1321 case MSG_MMS_RECVOPT_READ_REPORT_BOOL :
1322 ret = recv_opt->readReceipt;
1324 case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL :
1325 ret = recv_opt->bDeliveryReceipt;
1327 case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL :
1328 ret = recv_opt->bRejectUnknown;
1330 case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL :
1331 ret = recv_opt->bRejectAdvertisement;
1340 int msg_set_mms_recv_opt_bool(void *mms_recv_opt, int field, bool value)
1343 return MSG_ERR_NULL_POINTER;
1345 int ret = MSG_SUCCESS;
1347 MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt;
1351 case MSG_MMS_RECVOPT_READ_REPORT_BOOL :
1352 recv_opt->readReceipt = value;
1354 case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL :
1355 recv_opt->bDeliveryReceipt = value;
1357 case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL :
1358 recv_opt->bRejectUnknown = value;
1360 case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL :
1361 recv_opt->bRejectAdvertisement = value;
1364 ret = MSG_ERR_INVALID_PARAMETER;
1371 EXPORT_API int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
1373 msg_error_t err = MSG_SUCCESS;
1380 MsgHandle* pHandle = (MsgHandle*)handle;
1384 err = pHandle->getPushMsgOpt(msg_struct);
1386 catch (MsgException& e)
1388 MSG_FATAL("%s", e.what());
1389 return MSG_ERR_SET_READ_ERROR;
1395 EXPORT_API int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
1397 msg_error_t err = MSG_SUCCESS;
1399 if (handle == NULL || msg_struct == NULL)
1404 MsgHandle* pHandle = (MsgHandle*)handle;
1408 err = pHandle->setPushMsgOpt(msg_struct);
1410 catch (MsgException& e)
1412 MSG_FATAL("%s", e.what());
1413 return MSG_ERR_SET_READ_ERROR;
1419 int msg_get_push_msg_opt_int(void *push_msg_opt, int field)
1422 return MSG_ERR_NULL_POINTER;
1424 int ret = MSG_ERR_INVALID_PARAMETER;
1426 MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
1430 case MSG_PUSHMSG_SERVICE_TYPE_INT :
1431 ret = push_opt->serviceType;
1440 int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value)
1443 return MSG_ERR_NULL_POINTER;
1445 int ret = MSG_SUCCESS;
1447 MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
1451 case MSG_PUSHMSG_SERVICE_TYPE_INT :
1452 push_opt->serviceType = value;
1455 ret = MSG_ERR_INVALID_PARAMETER;
1462 bool msg_get_push_msg_opt_bool(void *push_msg_opt, int field)
1469 MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
1473 case MSG_PUSHMSG_RECEIVE_BOOL :
1474 ret = push_opt->bReceive;
1483 int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value)
1486 return MSG_ERR_NULL_POINTER;
1488 int ret = MSG_SUCCESS;
1490 MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt;
1494 case MSG_PUSHMSG_RECEIVE_BOOL :
1495 push_opt->bReceive = value;
1498 ret = MSG_ERR_INVALID_PARAMETER;
1505 EXPORT_API int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
1507 msg_error_t err = MSG_SUCCESS;
1514 MsgHandle* pHandle = (MsgHandle*)handle;
1518 err = pHandle->getVoiceMsgOpt(msg_struct);
1520 catch (MsgException& e)
1522 MSG_FATAL("%s", e.what());
1523 return MSG_ERR_SET_READ_ERROR;
1529 EXPORT_API int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct)
1531 msg_error_t err = MSG_SUCCESS;
1533 if (handle == NULL || msg_struct == NULL)
1538 MsgHandle* pHandle = (MsgHandle*)handle;
1542 err = pHandle->setVoiceMsgOpt(msg_struct);
1544 catch (MsgException& e)
1546 MSG_FATAL("%s", e.what());
1547 return MSG_ERR_SET_READ_ERROR;
1553 char *msg_get_voice_msg_opt_str(void *voice_msg_opt, int field)
1558 char *ret_str = NULL;
1560 MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
1564 case MSG_VOICEMSG_ADDRESS_STR :
1565 ret_str = voice_opt->mailNumber;
1574 int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size)
1577 return MSG_ERR_NULL_POINTER;
1579 int ret = MSG_SUCCESS;
1581 MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt;
1585 case MSG_VOICEMSG_ADDRESS_STR :
1586 bzero(voice_opt->mailNumber, sizeof(voice_opt->mailNumber));
1587 snprintf(voice_opt->mailNumber, sizeof(voice_opt->mailNumber), "%s", val);
1590 ret = MSG_ERR_INVALID_PARAMETER;
1597 EXPORT_API int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
1599 msg_error_t err = MSG_SUCCESS;
1606 MsgHandle* pHandle = (MsgHandle*)handle;
1610 err = pHandle->getGeneralOpt(msg_struct);
1612 catch (MsgException& e)
1614 MSG_FATAL("%s", e.what());
1615 return MSG_ERR_SET_READ_ERROR;
1621 EXPORT_API int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct)
1623 msg_error_t err = MSG_SUCCESS;
1625 if (handle == NULL || msg_struct == NULL)
1630 MsgHandle* pHandle = (MsgHandle*)handle;
1634 err = pHandle->setGeneralOpt(msg_struct);
1636 catch (MsgException& e)
1638 MSG_FATAL("%s", e.what());
1639 return MSG_ERR_SET_READ_ERROR;
1645 int msg_get_general_opt_int(void *general_opt, int field)
1648 return MSG_ERR_NULL_POINTER;
1650 int ret = MSG_ERR_INVALID_PARAMETER;
1652 MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
1656 case MSG_GENERAL_ALERT_TONE_INT :
1657 ret = opt->alertTone;
1666 int msg_set_general_opt_int(void *general_opt, int field, int value)
1669 return MSG_ERR_NULL_POINTER;
1671 int ret = MSG_SUCCESS;
1673 MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
1677 case MSG_GENERAL_ALERT_TONE_INT :
1678 opt->alertTone = value;
1681 ret = MSG_ERR_INVALID_PARAMETER;
1688 bool msg_get_general_opt_bool(void *general_opt, int field)
1695 MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
1699 case MSG_GENERAL_KEEP_COPY_BOOL :
1700 ret = opt->bKeepCopy;
1702 case MSG_GENERAL_AUTO_ERASE_BOOL :
1703 ret = opt->bAutoErase;
1712 int msg_set_general_opt_bool(void *general_opt, int field, bool value)
1715 return MSG_ERR_NULL_POINTER;
1717 int ret = MSG_SUCCESS;
1719 MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt;
1723 case MSG_GENERAL_KEEP_COPY_BOOL :
1724 opt->bKeepCopy = value;
1726 case MSG_GENERAL_AUTO_ERASE_BOOL :
1727 opt->bAutoErase = value;
1730 ret = MSG_ERR_INVALID_PARAMETER;
1737 EXPORT_API int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
1739 msg_error_t err = MSG_SUCCESS;
1746 MsgHandle* pHandle = (MsgHandle*)handle;
1750 err = pHandle->getMsgSizeOpt(msg_struct);
1752 catch (MsgException& e)
1754 MSG_FATAL("%s", e.what());
1755 return MSG_ERR_SET_READ_ERROR;
1761 EXPORT_API int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct)
1763 msg_error_t err = MSG_SUCCESS;
1765 if (handle == NULL || msg_struct == NULL)
1770 MsgHandle* pHandle = (MsgHandle*)handle;
1774 err = pHandle->setMsgSizeOpt(msg_struct);
1776 catch (MsgException& e)
1778 MSG_FATAL("%s", e.what());
1779 return MSG_ERR_SET_READ_ERROR;
1785 int msg_get_msgsize_opt_int(void *size_opt, int field)
1788 return MSG_ERR_NULL_POINTER;
1790 int ret = MSG_ERR_INVALID_PARAMETER;
1792 MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt;
1796 case MSG_MESSAGE_SIZE_INT :
1797 ret = msg_opt->nMsgSize;
1806 int msg_set_msgsize_opt_int(void *size_opt, int field, int value)
1809 return MSG_ERR_NULL_POINTER;
1811 int ret = MSG_SUCCESS;
1813 MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt;
1817 case MSG_MESSAGE_SIZE_INT :
1818 msg_opt->nMsgSize = value;
1821 ret = MSG_ERR_INVALID_PARAMETER;