Initial refactoring merge
[platform/core/telephony/libtapi.git] / include / common / tel_sms.h
1 /*
2  * tel-headers
3  *
4  * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
5  * Copyright (c) 2013 Intel Corporation. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __TEL_SMS_H__
21 #define __TEL_SMS_H__
22
23 #include <tel_if.h>
24
25 /**
26 *  @addtogroup TAPI_SMS
27 *  @{
28 *
29 *  @file tel_sms.h
30 *  @brief TAPI sms Interface
31 */
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 #define TELEPHONY_SMS_INTERFACE         TELEPHONY_SERVICE".Sms"
39
40 #define TEL_SMS_SCA_LEN_MAX             20      /**< Maximum length of SCA (in string format)*/
41
42 #define TEL_SMS_CB_DATA_SIZE_MAX        88      /**< Maximum CB Message Size. Cell broadcast message data [Refer 3GPP TS 23.041 9.4.1] */
43 #define TEL_SMS_ETWS_DATA_SIZE_MAX      1252 /**< Maximum ETWS Message Size */
44
45 #define TEL_SMS_GSM_MSG_NUM_MAX         255     /**< Maximum GSM SMS message number*/
46 #define TEL_SMS_GSM_CBMI_LIST_SIZE_MAX  50      /**< Maximum GSM SMS CBMI list size*/
47 #define TEL_SMS_SMDATA_SIZE_MAX         164     /**< Maximum SMS data size that can be stored*/
48
49 /**
50  * @enum TelSmsMsgStatus
51  * This enumeration defines the sms Response (Result) codes.
52  */
53 typedef enum {
54         TEL_SMS_STATUS_MT_READ, /**< MT message, stored and read */
55         TEL_SMS_STATUS_MT_UNREAD,       /**< MT message, stored and unread */
56         TEL_SMS_STATUS_MO_SENT, /**< MO message, stored and  sent */
57         TEL_SMS_STATUS_MO_NOT_SENT,     /**< MO message, stored but not sent */
58         TEL_SMS_STATUS_MO_DELIVERED, /**< delivered destination */
59         TEL_SMS_STATUS_MO_DELIVERY_NOT_CONFIRMED, /**< Service centre forwarded message but is unable to confirm delivery*/
60         TEL_SMS_STATUS_REPLACED /**< Message has been replaced*/
61 } TelSmsMsgStatus;
62
63
64 /**
65 * @enum TelSmsCbMsgType
66 * This enumeration defines the different CB message types.
67 */
68 typedef enum {
69         TEL_SMS_CB_MSG_GSM,     /**< GSM Cell broadcast message */
70         TEL_SMS_CB_MSG_UMTS     /**< UMTSCell broadcast message */
71 } TelSmsCbMsgType;
72
73 /**
74 * @enum TelSmsEtwsMsgType
75 * This enumeration defines the different ETWS message types.
76 */
77 typedef enum {
78         TEL_SMS_ETWS_PRIMARY,    /**< Primary ETWS message */
79         TEL_SMS_ETWS_SECONDARY_GSM,     /**< GSM Secondary ETWS message  */
80         TEL_SMS_ETWS_SECONDARY_UMTS     /**< UMTS Secondary ETWS message  */
81 } TelSmsEtwsMsgType;
82
83 /**
84  * @enum TelSmsResult
85  * This enum defines the different SMS error causes that come in the
86  * sent status acknowledgement/notification after sending a message to the network
87  */
88 typedef enum {
89         TEL_SMS_RESULT_SUCCESS, /**< Operation completed successfully */
90         TEL_SMS_RESULT_FAILURE, /**< Operation Failed */
91         TEL_SMS_RESULT_INVALID_PARAMETER,       /**< Invalid input parameters */
92         TEL_SMS_RESULT_MEMORY_FAILURE,   /**< Memory allocation failed */
93         TEL_SMS_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
94         TEL_SMS_RESULT_UNKNOWN_FAILURE, /**< Unknown failure */
95
96         TEL_SMS_RESULT_INVALID_MANDATORY_INFO,  /**< Invalid format for some parameters passed in Data package information(TPDU)*/
97         TEL_SMS_RESULT_NETWORK_CONGESTION,      /**< SMS SIM operation cannot be performed due to Network Congestion */
98         TEL_SMS_RESULT_SIM_FAILURE,     /**< SMS SIM operation cannot be performed due to SIM failure */
99         TEL_SMS_RESULT_NETWORK_FAILURE, /**< SMS SIM operation cannot be performed due to Network failure */
100         TEL_SMS_RESULT_OPERATION_NOT_PERMITTED  /** Operation not permitted */
101 } TelSmsResult;
102
103 /**
104  * This structure defines the properties of a dialing number
105  * Type of Number, Numbering Plan Indicator and the actual number.
106  */
107 typedef struct {
108         unsigned char ton; /**< Type of number*/
109         unsigned char npi; /**<Numbering plan identification*/
110         char number[TEL_SMS_SCA_LEN_MAX + 1]; /**< Destination address */
111 } TelSmsSca;
112
113 /**
114  * This structure defines the different parameters of  CB configuration
115  */
116 typedef struct {
117         unsigned short from_msg_id; /**< Starting point of the range of CBS message ID */
118         unsigned short to_msg_id; /**< Ending point of the range of CBS message ID */
119         gboolean selected;      /**< 0x00 . Not selected. 0x01 . Selected */
120 } TelSmsCbMsgInfo3gpp;
121
122 /**
123  * This structure defines the different parameters of  CB configuration informations
124  */
125 typedef struct {
126         gboolean cb_enabled; /**< CB service state. If cb_enabled is true then cell broadcast service will be enabled and
127                                                 * underlying modem will enable CB Channel to receiving CB messages. Otherwise CB service
128                                                 * will be disabled, underlying modem will deactivate the CB channel. (enabled/disabled) */
129         unsigned int msg_id_range_cnt;  /**< Range of CB message ID count */
130         TelSmsCbMsgInfo3gpp msg_ids[TEL_SMS_GSM_CBMI_LIST_SIZE_MAX]; /**< Range of CB message ID information */
131 } TelSmsCbConfigInfo;
132
133 /**
134  * This structure defines different fields involved in setting the parameters of
135  * a particular sms in EFsmsp.
136  */
137 typedef struct {
138         unsigned int index; /**< Index */
139         TelSmsSca sca; /**< Service Centre Address info */
140         unsigned short vp; /**< Validity Period */
141 } TelSmsParamsInfo;
142
143 /**
144  * This structure defines different fields involved in getting the sms parameters
145  */
146 typedef struct {
147         unsigned int count; /**< SMS parameter count */
148         TelSmsParamsInfo *params; /**< SMS parameter informations */
149 } TelSmsParamsInfoList;
150
151 /**
152  * This structure defines the fields related to an Sms like SIM index, TPDU
153  * and length.
154  */
155 typedef struct {
156         TelSmsSca sca; /**< Service Centre Address info */
157         unsigned int tpdu_length; /**< Size of array tpdu (which is actual TPDU message) */
158         unsigned char tpdu[TEL_SMS_SMDATA_SIZE_MAX]; /**< SMS TPDU message */
159 } TelSmsDatapackageInfo;
160
161 /**
162  *This structure defines the data Related to MessageStatus and SMS Data Stored.
163  */
164 typedef struct {
165         TelSmsMsgStatus status; /**< Message status.*/
166         TelSmsDatapackageInfo data; /**<SMS message data*/
167 } TelSmsSimDataInfo;
168
169 /**
170  *This structure defines the data Related to SMS Data to be send.
171  */
172 typedef struct {
173         gboolean more_msgs; /**< More messages to be send exist */
174         TelSmsDatapackageInfo send_data; /**<SMS message data*/
175 } TelSmsSendInfo;
176
177 /**
178  *This structure defines the data Related to set message status
179  */
180 typedef struct {
181         unsigned int index; /**< Index where message status to be set */
182         TelSmsMsgStatus status; /**< Message status.*/
183 } TelSmsStatusInfo;
184
185 /**
186  * @enum TelSmsDeliveryReport
187  * This enum defines the error causes for delivery report
188  */
189 typedef enum {
190         TEL_SMS_DELIVERY_REPORT_SUCCESS,  /**<Message was sent successfully*/
191         TEL_SMS_DELIVERY_REPORT_MEMORY_ERROR,   /**< Memory capacity exceeded/memory full*/
192         TEL_SMS_DELIVERY_REPORT_UNSPECIFIED_ERROR       /**<Unspecified error */
193 } TelSmsDeliveryReport;
194
195 /**
196  *This structure defines the SMS delivery report information
197  */
198 typedef struct {
199         TelSmsDeliveryReport report;    /**<Delivery report response types*/
200         TelSmsDatapackageInfo data;     /**<SMS data */
201 } TelSmsDeliverReportInfo;
202
203 /**
204  * This structure defines the different parameters that are related to the message count
205  * in a particular memory(Phone/SIM)
206  */
207 typedef struct {
208         unsigned int total_count;       /**< Total count of messages stored in SIM*/
209         unsigned int used_count;        /**< Stored message count in SIM in SIM*/
210         unsigned int index_list[TEL_SMS_GSM_MSG_NUM_MAX]; /**< Message index list stored in SIM. And the maximum
211                                                                                                            *size of this array can be of totalCount.This array contains the
212                                                                                                            *list of index values in which the messages are stored.
213                                                                                                            *i.e. index_list[totalcount] = [2,3] denotes that indexs
214                                                                                                            *2 and 3 are stored(valid) and others not(empty).
215                                                                                                            */
216 } TelSmsStoredMsgCountInfo;
217
218 /**
219  * This structure defines a cell broadcast message.
220  */
221 typedef struct {
222         TelSmsCbMsgType cb_type;        /**< Cell Broadcast  message type */
223         unsigned int length;    /**<Length of cb_data (which is actual TPDU message) */
224         unsigned char *cb_data;  /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
225 } TelSmsCbMsgInfo;
226
227 /**
228  * This structure defines a ETWS message.
229  */
230 typedef struct {
231         TelSmsEtwsMsgType etws_type;    /**< Cell Broadcast  message type */
232         unsigned int length;    /**<Length of etws_data (which is actual TPDU message) */
233         unsigned char *etws_data;       /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
234 } TelSmsEtwsMsgInfo;
235
236 /**
237  *  \defgroup TAPI_EVENT TAPI Event IDs
238  *  @{
239  */
240
241 /**
242  *  \defgroup TEL_EVENT_SMS SMS Event IDs
243  *  @{
244  */
245
246 /**
247  *  @hideinitializer
248  *  @brief Incoming Message
249  *  @section subscription Event Subscription
250  *  @details Event can be subscribed with event id TEL_NOTI_SMS_INCOM_MSG
251  *  @sa tapi_register_event_id
252  *  @section handling Event Handling
253  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
254  *  @retval handle #TelHandle used for registering the event
255  *  @retval evt_id TEL_NOTI_SMS_INCOM_MSG
256  *  @retval data reference to \ref TelSmsDatapackageInfo structure
257  *  @retval user_data user data passed while registering the event
258  */
259  #define TEL_NOTI_SMS_INCOM_MSG                 TELEPHONY_SMS_INTERFACE":IncomingMsg"
260
261 /**
262  *  @hideinitializer
263  *  @brief Incoming CB Message
264  *  @section subscription Event Subscription
265  *  @details Event can be subscribed with event id TEL_NOTI_SMS_CB_INCOM_MSG
266  *  @sa tapi_register_event_id
267  *  @section handling Event Handling
268  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
269  *  @retval handle #TelHandle used for registering the event
270  *  @retval evt_id TEL_NOTI_SMS_CB_INCOM_MSG
271  *  @retval data reference to \ref TelSmsCbMsgInfo structure
272  *  @retval user_data user data passed while registering the event
273  */
274 #define TEL_NOTI_SMS_CB_INCOM_MSG                       TELEPHONY_SMS_INTERFACE":IncomingCbMsg"
275
276 /**
277  *  @hideinitializer
278  *  @brief Incoming ETWS Message
279  *  @section subscription Event Subscription
280  *  @details Event can be subscribed with event id TEL_NOTI_SMS_ETWS_INCOM_MSG
281  *  @sa tapi_register_event_id
282  *  @section handling Event Handling
283  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
284  *  @retval handle #TelHandle used for registering the event
285  *  @retval evt_id TEL_NOTI_SMS_ETWS_INCOM_MSG
286  *  @retval data reference to \ref TelSmsEtwsMsgInfo structure
287  *  @retval user_data user data passed while registering the event
288  */
289 #define TEL_NOTI_SMS_ETWS_INCOM_MSG             TELEPHONY_SMS_INTERFACE":IncomingEtwsMsg"
290
291 /**
292  *  @hideinitializer
293  *  @brief SIM memory status for SMS
294  *  @section subscription Event Subscription
295  *  @details Event can be subscribed with event id TEL_NOTI_SMS_SIM_MEMORY_STATUS
296  *  @sa tapi_register_event_id
297  *  @section handling Event Handling
298  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
299  *  @retval handle #TelHandle used for registering the event
300  *  @retval evt_id TEL_NOTI_SMS_SIM_MEMORY_STATUS
301  *  @retval data <b>TRUE</b>: Memory available\n <b>FALSE</b>: Memory NOT available
302  *  @retval user_data user data passed while registering the event
303  */
304 #define TEL_NOTI_SMS_SIM_MEMORY_STATUS          TELEPHONY_SMS_INTERFACE":SimMemoryStatus"
305
306 /**
307  *  @hideinitializer
308  *  @brief SMS init status
309  *  @section subscription Event Subscription
310  *  @details Event can be subscribed with event id TEL_NOTI_SMS_INIT_STATUS
311  *  @sa tapi_register_event_id
312  *  @section handling Event Handling
313  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
314  *  @retval handle #TelHandle used for registering the event
315  *  @retval evt_id TEL_NOTI_SMS_INIT_STATUS
316  *  @retval data <b>TRUE</b>: SMS is Initialized\n <b>FALSE</b>: SMS is NOT initialized
317  *  @retval user_data user data passed while registering the event
318  */
319 #define TEL_NOTI_SMS_INIT_STATUS                        TELEPHONY_SMS_INTERFACE":InitStatus"
320
321 /** @}*/
322 /** @}*/
323
324 #ifdef __cplusplus
325 }
326 #endif
327
328 /**
329  * @}
330  */
331
332 #endif  /* __TEL_SMS_H__ */