tizen 2.3 release
[framework/telephony/libslp-tapi.git] / include / TelSms.h
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 /**
22  * @file TelSms.h
23  */
24
25 /**
26  * @internal
27  * @addtogroup CAPI_TELEPHONY_SERVICE_SMS
28  * @{
29  */
30
31 #ifndef _TEL_NETTEXT_H_
32 #define _TEL_NETTEXT_H_
33
34 #include <TelSim.h>
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40
41 /* NetText */
42
43 /**
44  * @brief Definition for the EF-SMSP digit length.
45  * @since_tizen 2.3
46  */
47 #define TAPI_SIM_SMSP_ADDRESS_LEN               20
48
49 /**
50  * @brief Definition for the EF-SMSP alpha ID length.
51  * @since_tizen 2.3
52  */
53 #define TAPI_SIM_SMSP_ALPHA_ID_LEN_MAX          128
54
55 /**
56  * @brief Definition for the maximum message size.
57  * @since_tizen 2.3
58  */
59 #define TAPI_NETTEXT_MSG_SIZE_MAX               918
60
61 /**
62  * @brief Definition for the maximum CB message size.
63  * @since_tizen 2.3
64  */
65 #define TAPI_NETTEXT_CB_SIZE_MAX                        1252
66
67 /**
68  * @brief Definition for the maximum ETWS message size.
69  * @since_tizen 2.3
70  */
71 #define TAPI_NETTEXT_ETWS_SIZE_MAX                      1252
72
73 /**
74  * @brief Definition for the nettext address length.
75  * @since_tizen 2.3
76  */
77 #define TAPI_NETTEXT_ADDRESS_LEN_MAX    20
78
79 /**
80  * @brief Definition for the SC address length.
81  * @since_tizen 2.3
82  */
83 #define TAPI_NETTEXT_SCADDRESS_LEN_MAX  18
84
85 /**
86  * @brief Definition for the CB maximum page size.
87  * @since_tizen 2.3
88  */
89 #define TAPI_NETTEXT_CB_PAGE_SIZE_MAX                            9
90
91 /**
92  * @brief Definition for the maximum GSM SMS message number.
93  * @since_tizen 2.3
94  */
95 #define TAPI_NETTEXT_SMS_MSG_NUM_MAX             255    /**< Maximum SMS message number*/
96
97 /**
98  * @brief Definition for the maximum GSM SMS CBMI list size.
99  * @since_tizen 2.3
100  */
101 #define TAPI_NETTEXT_SMS_CBMI_LIST_SIZE_MAX      50    /**< Maximum SMS CBMI list size*/
102
103 /**
104  * @brief Definition for the maximum SMS data size that can be stored.
105  * @since_tizen 2.3
106  */
107 #define TAPI_NETTEXT_SMDATA_SIZE_MAX                           255  /**< Maximum SMS data size that can be stored*/
108
109 /**
110  * @brief Definition for the maximum SMS service center address.
111  * @since_tizen 2.3
112  */
113 #define TAPI_NETTEXT_MAX_SMS_SERVICE_CENTER_ADDR   12
114
115 /**
116  * @brief Definition for the maximum index value of the SMS.
117  * @since_tizen 2.3
118  */
119 #define TAPI_NETTEXT_MAX_INDEX                                        255
120
121 #define TAPI_NETTEXT_SMSP_PARAMS_MAX_LEN                28
122
123 /**
124  * @brief Enumeration for network text status type.
125  * @since_tizen 2.3
126  */
127 typedef enum
128 {
129         TAPI_NETTEXT_STATUS_READ,                                       /**< MT message, stored and read */
130         TAPI_NETTEXT_STATUS_UNREAD,                                     /**< MT message, stored and unread */
131         TAPI_NETTEXT_STATUS_SENT,                                       /**< MO message, stored and sent */
132         TAPI_NETTEXT_STATUS_UNSENT,                                     /**< MO message, stored but not sent */
133         TAPI_NETTEXT_STATUS_DELIVERED,                         /**< Delivered destination */
134         TAPI_NETTEXT_STATUS_DELIVERY_UNCONFIRMED,  /**< Service centre forwarded message but is unable to confirm delivery */
135         TAPI_NETTEXT_STATUS_MESSAGE_REPLACED,          /**< Message has been replaced */
136         TAPI_NETTEXT_STATUS_RESERVED                            /**< Reserved for future use */
137 } TelSmsMsgStatus_t;
138
139 /**
140  * @brief Enumeration for memory status type.
141  * @since_tizen 2.3
142  */
143 typedef enum
144 {
145         TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE                = 0x01, /**< PDA memory is available */
146         TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL                     = 0x02,  /**< PDA memory is full */
147         TAPI_NETTEXT_PHONE_MEMORY_STATUS_AVAILABLE      = 0x03, /**< Phone memory is available */
148         TAPI_NETTEXT_PHONE_MEMORY_STATUS_FULL                   = 0x04, /**< Phone memory is full */
149 }TelSmsMemStatusType;
150
151 /**
152  * @brief Enumeration for different CB message types.
153  * @since_tizen 2.3
154  */
155 typedef enum
156 {
157                 TAPI_NETTEXT_CB_MSG_GSM = 1,            /**< GSM Cell broadcast message */
158                 TAPI_NETTEXT_CB_MSG_UMTS,                       /**< UMTSCell broadcast message */
159                 TAPI_NETTEXT_CB_MSG_CDMA                        /**< CDMA broadcast message */
160 } TelSmsCbMsgType_t;
161
162 /**
163  * @brief Enumeration for different ETWS message types.
164  * @since_tizen 2.3
165  */
166 typedef enum
167 {
168            TAPI_NETTEXT_ETWS_PRIMARY = 0,             /**< Primary ETWS message */
169            TAPI_NETTEXT_ETWS_SECONDARY_GSM,            /**< GSM Secondary ETWS message  */
170            TAPI_NETTEXT_ETWS_SECONDARY_UMTS,               /**< UMTS Secondary ETWS message  */
171            TAPI_NETTEXT_ETWS_SECONDARY_CDMA /*TODO:Will be supported*/
172 } TelSmsEtwsMsgType_t;
173
174 /**
175  * @brief Enumeration for different response types that come in the
176  * sent status acknowledgement/notification after sending a message to the network.
177  * @since_tizen 2.3
178  */
179 typedef enum
180 {
181         TAPI_NETTEXT_SENDSMS_SUCCESS = 0x00,     /**< Message sent successfully */
182         TAPI_NETTEXT_ROUTING_NOT_AVAILABLE,     /**< Message routing not available */
183         TAPI_NETTEXT_INVALID_PARAMETER,             /**< Invalid parameter present in TPDU */
184         TAPI_NETTEXT_DEVICE_FAILURE,                    /**< Device failure */
185         TAPI_NETTEXT_SERVICE_RESERVED,                /**< Reserved Service */
186         TAPI_NETTEXT_INVALID_LOCATION,                /**< Invalid location */
187         TAPI_NETTEXT_NO_SIM,                                    /**< No SIM error */
188         TAPI_NETTEXT_SIM_NOT_READY,            /**< SIM not ready error */
189         TAPI_NETTEXT_NO_NETWORK_RESP,          /**< No response from network */
190         TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED,/**< Destination address restricted */
191         TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED,   /**< Service center address restricted */
192         TAPI_NETTEXT_RESEND_ALREADY_DONE,        /**< Resend an already done operation */
193         TAPI_NETTEXT_SCADDRESS_NOT_AVAILABLE,    /**< SCA address not available */
194         TAPI_NETTEXT_UNASSIGNED_NUMBER = 0x8001,          /**< Unassigned number */
195         TAPI_NETTEXT_OPERATOR_DETERMINED_BARRING = 0x8008,/**< Operator determined barring */
196         TAPI_NETTEXT_CALL_BARRED = 0x800A,                /**< Call barred */
197         TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED = 0x8015,  /**< Message transfer rejected */
198         TAPI_NETTEXT_MEMORY_CAPACITY_EXCEEDED = 0x8016,   /**< Memory capacity exceeded/memory full */
199         TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE = 0x801B,  /**< Destination number/address out of service */
200         TAPI_NETTEXT_UNSPECIFIED_SUBSCRIBER = 0x801C,     /**< Unspecified subscriber */
201         TAPI_NETTEXT_FACILITY_REJECTED = 0x801D,          /**< Facility rejected */
202         TAPI_NETTEXT_UNKNOWN_SUBSCRIBER = 0x801E,         /**< Unknown subscriber */
203         TAPI_NETTEXT_NETWORK_OUTOFORDER = 0x8026,         /**< Network out of order */
204         TAPI_NETTEXT_TEMPORARY_FAILURE = 0x8029,          /**< Temporary failure */
205         TAPI_NETTEXT_CONGESTION = 0x802A,                 /**< Congestion occurred */
206         TAPI_NETTEXT_RESOURCES_UNAVAILABLE = 0x802F,      /**< Resource unavailable */
207         TAPI_NETTEXT_FACILITY_NOT_SUBSCRIBED = 0x8032,    /**< Facility not subscribed by the user */
208         TAPI_NETTEXT_FACILITY_NOT_IMPLEMENTED = 0x8045,   /**< Facility not implemented */
209         TAPI_NETTEXT_INVALID_REF_VALUE = 0x8051,          /**< Invalid reference value */
210         TAPI_NETTEXT_INVALID_MSG = 0x805F,                /**< Invalid message */
211         TAPI_NETTEXT_INVALID_MANDATORY_INFO = 0x8060,     /**< Invalid Mandatory information */
212         TAPI_NETTEXT_MESSAGE_TYPE_NOT_IMPLEMENTED = 0x8061,/**< Message type not implemented */
213         TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL = 0x8062, /**< Message not compact protocol */
214         TAPI_NETTEXT_IE_NOT_IMPLEMENTED = 0x8063,          /**< Information element not implemented */
215         TAPI_NETTEXT_PROTOCOL_ERROR = 0x806F,              /**< Protocol error */
216         TAPI_NETTEXT_INTERWORKING = 0x807F,              /**< Networking error */
217         TAPI_NETTEXT_ME_FULL = 0x8080,                     /**< SMS ME FULL */
218         TAPI_NETTEXT_SIM_FULL = 0x8081,                     /**< SMS SIM FULL */
219         TAPI_NETTEXT_TIMEOUT                                            /**< Timeout error */
220 }TelSmsResponse_t;
221
222 /**
223  * @brief Enumeration for different cause types that come in the
224  * sent status acknowledgement/notification after sending a message to the network.
225  * @since_tizen 2.3
226  */
227 typedef enum
228 {
229
230   TAPI_NETTEXT_SUCCESS,                     /**< SMS operation successful */
231   TAPI_NETTEXT_INVALID_PARAMETER_FORMAT,    /**< Invalid format for some parameters passed in Data package information(TPDU) */
232   TAPI_NETTEXT_PHONE_FAILURE,               /**< SMS operation failed due to Modem failure */
233   TAPI_NETTEXT_SIM_BUSY,                    /**< SMS SIM operation cannot be performed as the SIM is busy with some other operation */
234   TAPI_NETTEXT_SIM_FAILURE,                 /**< SMS SIM operation cannot be performed due to SIM failure */
235   TAPI_NETTEXT_UNKNOWN,                     /**< Unknown error */
236   TAPI_NETTEXT_MEMORY_FAILURE,              /**< Error while accessing memory or allocating memory for SMS operation */
237   TAPI_NETTEXT_OPERATION_NOT_SUPPORTED      /**< Operation not allowed/supported */
238 }  TelSmsCause_t;
239
240 /**
241  * @brief Enumeration for response values.
242  * @since_tizen 2.3
243  */
244 typedef enum
245 {
246         TAPI_NETTEXT_CBSETCONFIG_RSP,     /**< Cell broadcast config response */
247         TAPI_NETTEXT_SETPREFERREDBEARER_RSP,     /**< Set preferred bearer response */
248         TAPI_NETTEXT_SETPARAMETERS_RSP,     /**< Set parameter response */
249         TAPI_NETTEXT_SETMEMORYSTATUS_RSP,     /**< Set memory status response */
250         TAPI_NETTEXT_SETMESSAGESTATUS_RSP,     /**< Set message status response */
251         TAPI_NETTEXT_SETDEVICESTATUS_RSP,    /**< Set device status response */
252         TAPI_NETTEXT_SETSCADDR_RSP,     /**< Set SCA address response */
253         TAPI_NETTEXT_SET_RSP_MAX     /**< Maximum limit */
254 }TelSmsSetResponse;
255
256 /**
257  * @brief Enumeration for the type of Network
258  * @since_tizen 2.3
259  */
260 typedef enum  {
261         TAPI_NETTEXT_NETTYPE_3GPP = 0x01,                                               /**< 3gpp type */
262         TAPI_NETTEXT_NETTYPE_3GPP2 = 0x02,                                      /**< 3gpp2 type (CDMA) */
263 } TelSmsNetType_t;
264
265 /**
266  * @brief Enumeration for the sms ready status type.
267  * @since_tizen 2.3
268  */
269 typedef enum {
270         TAPI_NETTEXT_READY_STATUS_NONE = 0x00,
271         TAPI_NETTEXT_READY_STATUS_3GPP = 0x01,
272         TAPI_NETTEXT_READY_STATUS_3GPP2 = 0x02,
273         TAPI_NETTEXT_READY_STATUS_3GPP_AND_3GPP2 = 0x03,
274 }TelSmsReadyStatus_t;
275
276 /**
277  * @brief The structure type for different parameters of the CB configuration.
278  * @since_tizen 2.3
279  */
280 typedef struct {
281  unsigned short FromMsgId; /**< Starting point of the range of the CBS message ID */
282  unsigned short ToMsgId; /**< Ending point of the range of the CBS message ID */
283  unsigned char Selected; /**< 0x00 . Not selected. 0x01 . Selected */
284 } TelSmsCbMsgInfo3gpp_t;
285
286 typedef struct {
287  unsigned short CBCategory; /**< CB Service category */
288  unsigned short CBLanguage; /**< Language indicator value
289                                                                 . 0x00 . LANGUAGE_UNKNOWN . Unknown or Unspecified
290                                                                 . 0x01 . LANGUAGE_ENGLISH . English
291                                                                 . 0x02 . LANGUAGE_FRENCH . French
292                                                                 . 0x03 . LANGUAGE_SPANISH . Spanish
293                                                                 . 0x04 . LANGUAGE_JAPANESE . Japanese
294                                                                 . 0x05 . LANGUAGE_KOREAN . Korean
295                                                                 . 0x06 . LANGUAGE_CHINESE . Chinese
296                                                                 . 0x07 . LANGUAGE_HEBREW . Hebrew */
297  unsigned char Selected; /**< 0x00 . Not selected. 0x01 . Selected */
298 } TelSmsCbMsgInfo3gpp2_t;
299
300 typedef union {
301         TelSmsCbMsgInfo3gpp_t Net3gpp; /**< 3GPP Broadcast Configuration Information */
302         TelSmsCbMsgInfo3gpp2_t Net3gpp2; /**< 3GPP2 Broadcast Configuration Information, CDMA */
303 } TelSmsCbMsgInfo_t;
304
305 typedef struct {
306         int Net3gppType;  /**< Type of 3GPP, 0x01 . 3gpp. 0x02 . 3gpp2(CDMA) */
307         int CBEnabled; /**< CB service state. If @a CBEnabled is @c true then the cell broadcast service will be enabled and the underlying modem will enable the CB Channel to receive CB messages. Otherwise the CB service will be disabled and the underlying modem will deactivate the CB channel. (enabled/disabled) */
308         unsigned char MsgIdMaxCount; /**< CB Channel List Max Count For Response */
309         int MsgIdRangeCount; /**< Range of CB message ID count */
310         TelSmsCbMsgInfo_t MsgIDs[TAPI_NETTEXT_SMS_CBMI_LIST_SIZE_MAX]; /**< Range of CB message ID information */
311 } TelSmsCbConfig_t;
312
313 /**
314  * @brief The structure type for properties of a dialing number.
315  * @details Those properties are: type of the number, numbering plan indicator, length, and the actual number.
316  * @since_tizen 2.3
317  */
318 typedef struct {
319         unsigned int DialNumLen; /**< Length of the address. If the Service center address is not set, then this will be zero */
320         TelSimTypeOfNum_t Ton; /**< Type of number */
321         TelSimNumberingPlanIdentity_t Npi; /**< Numbering plan identification */
322         unsigned char szDiallingNum[TAPI_SIM_SMSP_ADDRESS_LEN + 1]; /**< Destination address. If the address is not set, then it is set to 0xFF */
323 } TelSmsAddressInfo_t;
324
325 /**
326  * @brief The structure type for different fields involved in setting the parameters of a particular SMS in EFsmsp.
327  * @since_tizen 2.3
328  */
329 typedef struct {
330
331         unsigned char RecordIndex; /**< Index */
332         unsigned char RecordLen; /**< SMS Parameter Record length */
333         unsigned long AlphaIdLen; /**< Alpha ID length */
334         char szAlphaId[TAPI_SIM_SMSP_ALPHA_ID_LEN_MAX + 1]; /**< Alpha ID. It is a unique identifier for each row/record in EFsmsp */
335         unsigned char ParamIndicator; /**< SMS parameter indicator is a 1 byte value. Each bit in this value indicates the presence/absence of the SMS header parameters. If the parameter is present the corresponding bit value is set to @c 0. If the parameter is absent then it is set as @c 1. Refer 3GPP TS 31.02 :4.4.23 */
336         TelSmsAddressInfo_t TpDestAddr; /**< TP-destination address (TP-DA) */
337         TelSmsAddressInfo_t TpSvcCntrAddr; /**< TP-service center address */
338         unsigned short TpProtocolId; /**< TP-protocol ID */
339         unsigned short TpDataCodingScheme; /**< TP-data coding scheme */
340         unsigned short TpValidityPeriod; /**< TP-validity period */
341 } TelSmsParams_t;
342
343 /**
344  * @brief The structure type for the fields related to an SMS like format(3GPP/3GPP2), TPDU and length
345  * @details
346  * SCA will be filled by MSG_SERVICE for GSM/UMTS technology only.\n
347  * For CDMA SCA need not be filled by MSG_SERVICE.
348  * @since_tizen 2.3
349  */
350 typedef struct {
351         unsigned char Sca[TAPI_SIM_SMSP_ADDRESS_LEN]; /**< Service Centre address - an optional parameter. If this parameter is not present, then this field will be Null.If present, the valid service centre address information is filled as per 3GPP TS23.040 9.1.2.5 Address fields */
352         int MsgLength; /**< Size of array szData (which is actual TPDU message) */
353         unsigned char szData[TAPI_NETTEXT_SMDATA_SIZE_MAX + 1]; /**<SMS TPDU message */
354         TelSmsNetType_t format;
355 } TelSmsDatapackageInfo_t;
356
357 /**
358  * @brief The structure type for data related to SimIndex, MessageStatus, and SMS Data Stored.
359  * @since_tizen 2.3
360  */
361 typedef struct {
362         int SimIndex; /**< Index where SMS is stored */
363         TelSmsMsgStatus_t MsgStatus; /**< Message status */
364         TelSmsDatapackageInfo_t SmsData; /**< SMS message */
365 } TelSmsData_t;
366
367 /**
368  * @brief The structure type for different parameters that are related to the message count in a particular memory (Phone/SIM).
369  * @since_tizen 2.3
370  */
371 typedef struct {
372         unsigned int TotalCount; /**< Total count of messages stored in the SIM */
373         int UsedCount; /**< Stored message count in the SIM */
374         int IndexList[TAPI_NETTEXT_SMS_MSG_NUM_MAX]; /**< Message index list stored in the SIM. And the maximum size of this array can be of @a TotalCount. This array contains the list of index values in which the messages are stored, i.e. index_list[totalcount] = [2,3] denotes that indexes 2 and 3 are stored(valid) and others are not(empty) */
375 } TelSmsStoredMsgCountInfo_t;
376
377 /**
378  * @brief The structure type for a cell broadcast message.
379  * @since_tizen 2.3
380  */
381 typedef struct {
382
383         TelSmsCbMsgType_t CbMsgType; /**< Cell Broadcast message type */
384         unsigned short Length; /**< Size of array @a szMsgData (which is the actual TPDU message) */
385         char szMsgData[TAPI_NETTEXT_CB_SIZE_MAX + 1]; /**< Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1] */
386 } TelSmsCbMsg_t;
387
388 /**
389  * @brief The structure type for a ETWS message.
390  * @since_tizen 2.3
391  */
392 typedef struct {
393         TelSmsEtwsMsgType_t EtwsMsgType; /**< Cell Broadcast message type */
394         unsigned short Length; /**< Size of array @a szMsgData (which is the actual TPDU message) */
395         char szMsgData[TAPI_NETTEXT_ETWS_SIZE_MAX + 1]; /**< Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1] */
396 } TelSmsEtwsMsg_t;
397
398 struct tel_noti_sms_incomming_msg {
399         char Sca[TAPI_SIM_SMSP_ADDRESS_LEN];    /**< TBD */
400         int MsgLength;  /**< TBD */
401         char szData[TAPI_NETTEXT_SMDATA_SIZE_MAX + 1];  /**< TBD */
402         TelSmsNetType_t format;
403 };
404
405 struct tel_noti_sms_incomming_cb_msg {
406         TelSmsCbMsgType_t CbMsgType; /**< Cell Broadcast message type */
407         short Length; /**< Size of array @a szMsgData (which is the actual TPDU message) */
408         char szMsgData[TAPI_NETTEXT_CB_SIZE_MAX + 1]; /**< Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1] */
409 };
410
411 struct tel_noti_sms_incomming_etws_msg {
412         TelSmsEtwsMsgType_t EtwsMsgType; /**< ETWS message type */
413         short Length; /**< Size of array @a szMsgData (which is the actual TPDU message) */
414         char szMsgData[TAPI_NETTEXT_ETWS_SIZE_MAX + 1]; /**< ETWS message data[Refer 3GPP TS 23.041 9.4.1] */
415 };
416
417
418 #ifdef __cplusplus
419 }
420 #endif
421
422 #endif  // _TEL_NETTEXT_H_
423
424 /**
425  * @}
426 */