2 * Copyright 2012-2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.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.
20 /*==================================================================================================
22 ==================================================================================================*/
25 #include "msg_types.h"
33 * @ingroup MESSAGING_FRAMEWORK
34 * @defgroup MESSAGING_CONTROL_API Messaging Control API
38 /*==================================================================================================
40 ==================================================================================================*/
45 * Opens a channel between an application and messaging framework.
48 * For application to utilize the services of Messaging Framework, this API should be called to establish connection between the application and Messaging Framework.
50 * \par Typical use case:
51 * Any application which utilizes the services of Messaging Framework needs to call this API.
53 * \par Method of function operation:
54 * Check for Message Server ready status. If ready connect to the Messaging Server socket and pass the handle application.
56 * \par Sync (or) Async:
57 * This is a Synchronous API.
59 * \par Important notes:
60 * - The handle parameter returned must be used by application for further API calls to Messaging Service \n
61 * - memory for the handle need not be allocated by the application \n
62 * - An error will be returned in case Messaging Service is not running.
64 * \param msg_handle_t input - handle to be passed for all Messaging Services .
66 * \return Return Type (int) \n
67 * - MSG_SUCCESS - Successfully connected to Messaging Service \n
68 * - MSG_ERR_NULL_POINTER - Input parameter is NULL.
69 * - MSG_ERR_MEMORY_ERROR - Memory error.
70 * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n
72 * \par Prospective clients:
73 * External/Native Apps using Messaging Services.
75 * \par Related functions:
78 * \par Known issues/bugs:
85 * msg_handle_t msgHandle = NULL;
86 * msg_error_t err = MSG_SUCCESS;
88 * err = msg_open_msg_handle(&msgHandle);
90 * if (err != MSG_SUCCESS)
92 * sprintf(str, "msg_open_msg_handle() Fail [%d]", err);
95 * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code.
101 /*================================================================================================*/
102 int msg_open_msg_handle(msg_handle_t *handle);
108 * Closes the channel between application and messaging framework.
111 * Once application utilizes services of Messaging Service, this API needs to be invoked the close the channel between application and Messaging Service.
113 * \par Typical use case:
114 * Any application which has completed using services of Messaging Framework needs to call this API.
116 * \par Method of function operation:
117 * Closes the connection to Messaging Service and deleted the reference to the handle object
119 * \par Sync (or) Async:
120 * This is a Synchronous API.
122 * \par Important notes:
123 * - The handle parameter returned must be used by application for further API calls to Messaging Service \n
124 * - memory for the handle need not be allocated by the application \n
125 * - An error will be returned in case Messaging Service is not running.
127 * \param msg_handle_t input - handle to be passed for all Messaging Services .
129 * \return Return Type (int) \n
130 * - MSG_SUCCESS - Successfully connected to Messaging Service \n
131 * - MSG_ERR_NULL_POINTER - Input parameter is NULL.
132 * - MSG_ERR_COMMUNICATION_ERROR - Communication error between client and server \n
134 * \par Prospective clients:
135 * External/Native Apps using Messaging Services.
137 * \par Related functions:
140 * \par Known issues/bugs:
147 * msg_handle_t msgHandle = NULL;
148 * msg_error_t err = MSG_SUCCESS;
152 * err = msg_open_msg_handle(&msgHandle);
156 * err = msg_close_msg_handle(&msgHandle);
158 * if (err != MSG_SUCCESS)
160 * sprintf(str, "msg_close_msg_handle() Fail [%d]", err);
163 * return err; // if success, return OPERATION_SUCCESS. Or if fail, return related error code.
169 /*================================================================================================*/
170 int msg_close_msg_handle(msg_handle_t *handle);
174 msg_struct_t msg_create_struct(int field);
175 int msg_release_struct(msg_struct_t *msg_struct_handle);
176 int msg_release_list_struct(msg_struct_list_s *msg_struct_list);
178 int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int *value);
179 int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size);
180 int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, bool *value);
181 int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t *value);
182 int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, void **value);
184 int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int value);
185 int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size);
186 int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, bool value);
187 int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_t value);
188 int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, void *value);
190 int msg_mms_add_item(msg_struct_t msg_struct_handle, int field, msg_struct_t *item);
192 int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle);
193 int msg_set_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_handle);
196 msg_struct_t msg_list_nth_data(msg_list_handle_t list_handle, int index);
197 int msg_list_length(msg_list_handle_t list_handle);
200 int msg_add_filter(msg_handle_t handle, const msg_struct_t filter);
201 int msg_update_filter(msg_handle_t handle, const msg_struct_t filter);
202 int msg_delete_filter(msg_handle_t handle, msg_filter_id_t filter_id);
203 int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filter_list);
204 int msg_set_filter_operation(msg_handle_t handle, bool set_flag);
205 int msg_get_filter_operation(msg_handle_t handle, bool *set_flag);
206 int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active);
209 int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct);
210 int msg_set_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct);
212 int msg_get_cb_opt(msg_handle_t handle, msg_struct_t msg_struct);
213 int msg_set_cb_opt(msg_handle_t handle, msg_struct_t msg_struct);
215 int msg_get_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct);
216 int msg_set_sms_send_opt(msg_handle_t handle, msg_struct_t msg_struct);
218 int msg_get_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct);
219 int msg_set_mms_send_opt(msg_handle_t handle, msg_struct_t msg_struct);
221 int msg_get_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct);
222 int msg_set_mms_recv_opt(msg_handle_t handle, msg_struct_t msg_struct);
224 int msg_get_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct);
225 int msg_set_push_msg_opt(msg_handle_t handle, msg_struct_t msg_struct);
227 int msg_get_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct);
228 int msg_set_voice_msg_opt(msg_handle_t handle, msg_struct_t msg_struct);
230 int msg_get_general_opt(msg_handle_t handle, msg_struct_t msg_struct);
231 int msg_set_general_opt(msg_handle_t handle, msg_struct_t msg_struct);
233 int msg_get_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct);
234 int msg_set_msgsize_opt(msg_handle_t handle, msg_struct_t msg_struct);
236 // text length calculate
237 int msg_util_calculate_text_length(const char* msg_text, msg_encode_type_t msg_encode_type_to, unsigned int *text_size, unsigned int *segment_size, msg_encode_type_t *msg_encode_type_in);