OSDN Git Service

Cleanup and changes of responseCdmaInformationReocrds, Broadcast SMS
[android-x86/hardware-ril.git] / include / telephony / ril_cdma_sms.h
1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /*
18  * ISSUES:
19  *
20  */
21
22 /**
23  * TODO
24  *
25  *  
26  */
27
28
29 #ifndef ANDROID_RIL_CDMA_SMS_H 
30 #define ANDROID_RIL_CDMA_SMS_H 1
31
32 #include <stdlib.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /* Used by RIL_REQUEST_CDMA_SEND_SMS and RIL_UNSOL_RESPONSE_CDMA_NEW_SMS */
39
40 #define RIL_CDMA_SMS_ADDRESS_MAX     36
41 #define RIL_CDMA_SMS_SUBADDRESS_MAX  36
42 #define RIL_CDMA_SMS_BEARER_DATA_MAX 255
43
44 typedef enum {
45     RIL_CDMA_SMS_DIGIT_MODE_4_BIT = 0,     /* DTMF digits */
46     RIL_CDMA_SMS_DIGIT_MODE_8_BIT = 1,
47     RIL_CDMA_SMS_DIGIT_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
48 } RIL_CDMA_SMS_DigitMode;
49
50 typedef enum {
51     RIL_CDMA_SMS_NUMBER_MODE_NOT_DATA_NETWORK = 0,
52     RIL_CDMA_SMS_NUMBER_MODE_DATA_NETWORK     = 1,
53     RIL_CDMA_SMS_NUMBER_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
54 } RIL_CDMA_SMS_NumberMode;
55
56 typedef enum {
57     RIL_CDMA_SMS_NUMBER_TYPE_UNKNOWN                   = 0,
58     RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP  = 1,
59       /* INTERNATIONAL is used when number mode is not data network address.
60        * DATA_IP is used when the number mode is data network address 
61        */
62     RIL_CDMA_SMS_NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2,
63       /* NATIONAL is used when the number mode is not data network address.
64        * INTERNET_MAIL is used when the number mode is data network address. 
65        * For INTERNET_MAIL, in the address data "digits", each byte contains 
66        * an ASCII character. Examples are "x@y.com,a@b.com - ref TIA/EIA-637A 3.4.3.3 
67        */
68     RIL_CDMA_SMS_NUMBER_TYPE_NETWORK                   = 3,
69     RIL_CDMA_SMS_NUMBER_TYPE_SUBSCRIBER                = 4,
70     RIL_CDMA_SMS_NUMBER_TYPE_ALPHANUMERIC              = 5,
71       /* GSM SMS: address value is GSM 7-bit chars */
72     RIL_CDMA_SMS_NUMBER_TYPE_ABBREVIATED               = 6,
73     RIL_CDMA_SMS_NUMBER_TYPE_RESERVED_7                = 7,
74     RIL_CDMA_SMS_NUMBER_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
75 } RIL_CDMA_SMS_NumberType;
76
77 typedef enum {
78     RIL_CDMA_SMS_NUMBER_PLAN_UNKNOWN     = 0,
79     RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY   = 1,      /* CCITT E.164 and E.163, including ISDN plan */
80     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_2  = 2,      
81     RIL_CDMA_SMS_NUMBER_PLAN_DATA        = 3,      /* CCITT X.121 */
82     RIL_CDMA_SMS_NUMBER_PLAN_TELEX       = 4,      /* CCITT F.69 */
83     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_5  = 5,      
84     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_6  = 6,      
85     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_7  = 7,      
86     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_8  = 8,      
87     RIL_CDMA_SMS_NUMBER_PLAN_PRIVATE     = 9,      
88     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_10 = 10,      
89     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_11 = 11,      
90     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_12 = 12,      
91     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_13 = 13,      
92     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_14 = 14,      
93     RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_15 = 15,      
94     RIL_CDMA_SMS_NUMBER_PLAN_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
95 } RIL_CDMA_SMS_NumberPlan;
96
97 typedef struct {
98     RIL_CDMA_SMS_DigitMode digit_mode;
99       /* Indicates 4-bit or 8-bit */
100     RIL_CDMA_SMS_NumberMode number_mode;
101       /* Used only when digitMode is 8-bit */
102     RIL_CDMA_SMS_NumberType number_type;
103       /* Used only when digitMode is 8-bit.
104        * To specify an international address, use the following: 
105        * digitMode = RIL_CDMA_SMS_DIGIT_MODE_8_BIT
106        * numberMode = RIL_CDMA_SMS_NOT_DATA_NETWORK
107        * numberType = RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP
108        * numberPlan = RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY
109        * numberOfDigits = number of digits
110        * digits = ASCII digits, e.g. '1', '2', '3'3, '4', and '5'
111        */
112     RIL_CDMA_SMS_NumberPlan number_plan;
113       /* Used only when digitMode is 8-bit */
114     unsigned char number_of_digits;
115     unsigned char digits[ RIL_CDMA_SMS_ADDRESS_MAX ];
116       /* Each byte in this array represnts a 40bit or 8-bit digit of address data */ 
117 } RIL_CDMA_SMS_Address;
118
119 typedef enum {
120     RIL_CDMA_SMS_SUBADDRESS_TYPE_NSAP           = 0,    /* CCITT X.213 or ISO 8348 AD2 */
121     RIL_CDMA_SMS_SUBADDRESS_TYPE_USER_SPECIFIED = 1,    /* e.g. X.25 */
122     RIL_CDMA_SMS_SUBADDRESS_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
123 } RIL_CDMA_SMS_SubaddressType;
124
125 typedef struct {
126     RIL_CDMA_SMS_SubaddressType subaddressType;
127     /* 1 means the last byte's lower 4 bits should be ignored */
128     unsigned char odd;
129     unsigned char number_of_digits;
130     /* Each byte respresents a 8-bit digit of subaddress data */
131     unsigned char digits[ RIL_CDMA_SMS_SUBADDRESS_MAX ];
132 } RIL_CDMA_SMS_Subaddress;
133
134 typedef struct {
135     int uTeleserviceID;
136     unsigned char bIsServicePresent;
137     int uServicecategory;
138     RIL_CDMA_SMS_Address sAddress;
139     RIL_CDMA_SMS_Subaddress sSubAddress;
140     int uBearerDataLen;
141     unsigned char aBearerData[ RIL_CDMA_SMS_BEARER_DATA_MAX ];
142 } RIL_CDMA_SMS_Message;
143
144 /* Used by RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE */
145
146 typedef enum {
147     RIL_CDMA_SMS_NO_ERROR       = 0,
148     RIL_CDMA_SMS_ERROR          = 1,
149     RIL_CDMA_SMS_ERROR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
150 } RIL_CDMA_SMS_ErrorClass;
151
152 typedef struct {
153     RIL_CDMA_SMS_ErrorClass uErrorClass;
154     int uSMSCauseCode;
155 } RIL_CDMA_SMS_Ack;
156
157 /* Used by RIL_REQUEST_CDMA_SMS_GET_BROADCAST_CONFIG and
158    RIL_REQUEST_CDMA_SMS_SET_BROADCAST_CONFIG */
159
160 typedef struct {
161     int service_category;
162     int language;
163     unsigned char selected;
164 } RIL_CDMA_BroadcastSmsConfigInfo;
165
166 /* Used by RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM */
167
168 typedef struct {
169     int status;     /* Status of message.  See TS 27.005 3.1, "<stat>": */
170                   /*      0 = "REC UNREAD"    */
171                   /*      1 = "REC READ"      */
172                   /*      2 = "STO UNSENT"    */
173                   /*      3 = "STO SENT"      */
174
175     RIL_CDMA_SMS_Message message;
176 } RIL_CDMA_SMS_WriteArgs;
177
178
179 /* Used by RIL_REQUEST_ENCODE_CDMA_SMS and RIL_REQUEST_DECODE_CDMA_SMS*/
180
181 #define RIL_CDMA_SMS_UDH_MAX_SND_SIZE           128 
182 #define RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX    131 /* 140 - 3 - 6 */
183 #define RIL_CDMA_SMS_MAX_UD_HEADERS         7
184 #define RIL_CDMA_SMS_USER_DATA_MAX     229
185 #define RIL_CDMA_SMS_ADDRESS_MAX            36
186 #define RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE     128
187 #define RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE     32
188 #define RIL_CDMA_SMS_UDH_VAR_PIC_SIZE       134
189 #define RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS   4
190 #define RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE  32
191 #define RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE  8
192 #define RIL_CDMA_SMS_UDH_OTHER_SIZE         226
193 #define RIL_CDMA_SMS_IP_ADDRESS_SIZE        4
194
195 /* ------------------- */
196 /* ---- User Data ---- */
197 /* ------------------- */
198 typedef enum {
199     RIL_CDMA_SMS_UDH_CONCAT_8         = 0x00,
200     RIL_CDMA_SMS_UDH_SPECIAL_SM,
201     /* 02 - 03    Reserved */
202     RIL_CDMA_SMS_UDH_PORT_8           = 0x04,
203     RIL_CDMA_SMS_UDH_PORT_16,
204     RIL_CDMA_SMS_UDH_SMSC_CONTROL,
205     RIL_CDMA_SMS_UDH_SOURCE,
206     RIL_CDMA_SMS_UDH_CONCAT_16,
207     RIL_CDMA_SMS_UDH_WCMP,
208     RIL_CDMA_SMS_UDH_TEXT_FORMATING,
209     RIL_CDMA_SMS_UDH_PRE_DEF_SOUND,
210     RIL_CDMA_SMS_UDH_USER_DEF_SOUND,
211     RIL_CDMA_SMS_UDH_PRE_DEF_ANIM,
212     RIL_CDMA_SMS_UDH_LARGE_ANIM,
213     RIL_CDMA_SMS_UDH_SMALL_ANIM,
214     RIL_CDMA_SMS_UDH_LARGE_PICTURE,
215     RIL_CDMA_SMS_UDH_SMALL_PICTURE,
216     RIL_CDMA_SMS_UDH_VAR_PICTURE,
217
218     RIL_CDMA_SMS_UDH_USER_PROMPT      = 0x13,
219     RIL_CDMA_SMS_UDH_EXTENDED_OBJECT  = 0x14,
220
221     /* 15 - 1F    Reserved for future EMS */
222
223     RIL_CDMA_SMS_UDH_RFC822           = 0x20,
224
225     /*  21 - 6F    Reserved for future use */
226     /*  70 - 7f    Reserved for (U)SIM Toolkit Security Headers */
227     /*  80 - 9F    SME to SME specific use */
228     /*  A0 - BF    Reserved for future use */
229     /*  C0 - DF    SC specific use */
230     /*  E0 - FF    Reserved for future use */
231
232     RIL_CDMA_SMS_UDH_OTHER            = 0xFFFF, /* For unsupported or proprietary headers */
233     RIL_CDMA_SMS_UDH_ID_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
234
235 } RIL_CDMA_SMS_UdhId;
236
237 typedef struct {
238     /*indicates the reference number for a particular concatenated short message. */
239     /*it is constant for every short message which makes up a particular concatenated short message*/
240     unsigned char       msg_ref;
241
242     /*indicates the total number of short messages within the concatenated short message.
243      The value shall start at 1 and remain constant for every 
244      short message which makes up the concatenated short message.
245      if it is 0 then the receiving entity shall ignore the whole Information Element*/
246     unsigned char       total_sm;
247
248     /* 
249      * it indicates the sequence number of a particular short message within the concatenated short 
250      * message. The value shall start at 1 and increment by one for every short message sent 
251      * within the concatenated short message. If the value is zero or the value is 
252      * greater than the value in octet 2 then the receiving 
253      * entity shall ignore the whole Information Element.
254      */
255     unsigned char      seq_num;
256 } RIL_CDMA_SMS_UdhConcat8;
257
258 /* GW message waiting actions
259 */
260 typedef enum {
261     RIL_CDMA_SMS_GW_MSG_WAITING_NONE,
262     RIL_CDMA_SMS_GW_MSG_WAITING_DISCARD,
263     RIL_CDMA_SMS_GW_MSG_WAITING_STORE,
264     RIL_CDMA_SMS_GW_MSG_WAITING_NONE_1111,
265     RIL_CDMA_SMS_GW_MSG_WAITING_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
266 } RIL_CDMA_SMS_GWMsgWaiting;
267
268 /* GW message waiting types
269 */
270 typedef enum {
271     RIL_CDMA_SMS_GW_MSG_WAITING_VOICEMAIL,
272     RIL_CDMA_SMS_GW_MSG_WAITING_FAX,
273     RIL_CDMA_SMS_GW_MSG_WAITING_EMAIL,
274     RIL_CDMA_SMS_GW_MSG_WAITING_OTHER,
275     RIL_CDMA_SMS_GW_MSG_WAITING_KIND_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
276 } RIL_CDMA_SMS_GWMsgWaitingKind;
277
278 typedef struct {
279     RIL_CDMA_SMS_GWMsgWaiting                 msg_waiting;
280     RIL_CDMA_SMS_GWMsgWaitingKind             msg_waiting_kind;
281
282     /*it indicates the number of messages of the type specified in Octet 1 waiting.*/
283     unsigned char                             message_count;
284 } RIL_CDMA_SMS_UdhSpecialSM;
285
286 typedef struct {
287     unsigned char  dest_port;
288     unsigned char  orig_port;
289 } RIL_CDMA_SMS_UdhWap8;
290
291 typedef struct {
292     unsigned short  dest_port;
293     unsigned short  orig_port;
294 } RIL_CDMA_SMS_UdhWap16;
295
296 typedef struct {
297     unsigned short      msg_ref;
298     unsigned char       total_sm;
299     unsigned char       seq_num;
300
301 } RIL_CDMA_SMS_UdhConcat16;
302
303 typedef enum {
304     RIL_CDMA_SMS_UDH_LEFT_ALIGNMENT = 0,
305     RIL_CDMA_SMS_UDH_CENTER_ALIGNMENT,
306     RIL_CDMA_SMS_UDH_RIGHT_ALIGNMENT,
307     RIL_CDMA_SMS_UDH_DEFAULT_ALIGNMENT,
308     RIL_CDMA_SMS_UDH_MAX_ALIGNMENT,
309     RIL_CDMA_SMS_UDH_ALIGNMENT_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
310 } RIL_CDMA_SMS_UdhAlignment;
311
312 typedef enum {
313     RIL_CDMA_SMS_UDH_FONT_NORMAL = 0,
314     RIL_CDMA_SMS_UDH_FONT_LARGE,
315     RIL_CDMA_SMS_UDH_FONT_SMALL,
316     RIL_CDMA_SMS_UDH_FONT_RESERVED,
317     RIL_CDMA_SMS_UDH_FONT_MAX,
318     RIL_CDMA_SMS_UDH_FONT_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
319 } RIL_CDMA_SMS_UdhFontSize;
320
321 typedef enum {
322     RIL_CDMA_SMS_UDH_TEXT_COLOR_BLACK          = 0x0,
323     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREY      = 0x1,
324     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_RED       = 0x2,
325     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_YELLOW    = 0x3,
326     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREEN     = 0x4,
327     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_CYAN      = 0x5,
328     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_BLUE      = 0x6,
329     RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_MAGENTA   = 0x7,
330     RIL_CDMA_SMS_UDH_TEXT_COLOR_GREY           = 0x8,
331     RIL_CDMA_SMS_UDH_TEXT_COLOR_WHITE          = 0x9,
332     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_RED     = 0xA,
333     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_YELLOW  = 0xB,
334     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_GREEN   = 0xC,
335     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_CYAN    = 0xD,
336     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_BLUE    = 0xE,
337     RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_MAGENTA = 0xF,
338     RIL_CDMA_SMS_UDH_TEXT_COLOR_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
339 } RIL_CDMA_SMS_UdhTextColor;
340
341 typedef struct {
342     unsigned char              start_position;
343     unsigned char              text_formatting_length;
344     RIL_CDMA_SMS_UdhAlignment  alignment_type ;       /*bit 0 and  bit 1*/
345     RIL_CDMA_SMS_UdhFontSize   font_size ;            /*bit 3 and  bit 2*/
346     unsigned char              style_bold;            /*bit 4 */
347     unsigned char              style_italic;          /*bit 5  */
348     unsigned char              style_underlined;      /*bit 6 */
349     unsigned char              style_strikethrough;   /*bit 7 */
350
351     /* if FALSE, ignore the following color information */
352     unsigned char              is_color_present;
353     RIL_CDMA_SMS_UdhTextColor  text_color_foreground;
354     RIL_CDMA_SMS_UdhTextColor  text_color_background;
355
356 } RIL_CDMA_SMS_UdhTextFormating;
357
358 /* Predefined sound
359 */
360 typedef struct {
361     unsigned char       position;
362     unsigned char       snd_number;
363 } RIL_CDMA_SMS_UdhPreDefSound;
364
365 /* User Defined sound
366 */
367 typedef struct {
368     unsigned char       data_length;
369     unsigned char       position;
370     unsigned char       user_def_sound[RIL_CDMA_SMS_UDH_MAX_SND_SIZE];
371 } RIL_CDMA_SMS_UdhUserDefSound;
372
373 /* Large picture
374 */
375 typedef struct {
376     unsigned char       position;
377     unsigned char       data[RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE];
378 } RIL_CDMA_SMS_UdhLargePictureData;
379
380 /* Small picture
381 */
382 typedef struct {
383     unsigned char       position;
384     unsigned char       data[RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE];
385 } RIL_CDMA_SMS_UdhSmallPictureData;
386
387 /* Variable length picture
388 */
389 typedef struct {
390     unsigned char       position;
391     unsigned char       width;    /* Number of pixels - Should be a mutliple of 8 */
392     unsigned char       height;
393     unsigned char       data[RIL_CDMA_SMS_UDH_VAR_PIC_SIZE];
394 } RIL_CDMA_SMS_UdhVarPicture;
395
396 /* Predefined animation
397 */
398 typedef struct {
399     unsigned char       position;
400     unsigned char       animation_number;
401 } RIL_CDMA_SMS_UdhPreDefAnim;
402
403 /* Large animation
404 */
405 typedef struct {
406     unsigned char       position;
407     unsigned char       data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE];
408 } RIL_CDMA_SMS_UdhLargeAnim;
409
410 /* Small animation
411 */
412 typedef struct {
413     unsigned char       position;
414     unsigned char       data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE];
415 } RIL_CDMA_SMS_UdhSmallAnim;
416
417 /* User Prompt Indicator UDH
418 */
419 typedef struct {
420     unsigned char       number_of_objects;
421     /* Number of objects of the same kind that follow this header which will
422     ** be stitched together by the applications. For example, 5 small pictures
423     ** are to be stitched together horizontally, or 6 iMelody tones are to be
424     ** connected together with intermediate iMelody header and footer ignored.
425     ** Allowed objects to be stitched:
426     **   - Images (small, large, variable)
427     **   - User defined sounds
428     */
429 } RIL_CDMA_SMS_UdhUserPrompt;
430
431 typedef struct {
432     unsigned char         length;
433
434     unsigned char         data[RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX];
435     /* RIL_CDMA_SMS_UDH_EO_VCARD: See http://www.imc.org/pdi/vcard-21.doc for payload */
436     /* RIL_CDMA_SMS_UDH_EO_VCALENDAR: See http://www.imc.org/pdi/vcal-10.doc */
437     /* Or: Unsupported/proprietary extended objects */
438
439 } RIL_CDMA_SMS_UdhEoContent;
440
441 /* Extended Object UDH
442 */
443 /* Extended Object IDs/types
444 */
445 typedef enum {
446     RIL_CDMA_SMS_UDH_EO_VCARD                   = 0x09,
447     RIL_CDMA_SMS_UDH_EO_VCALENDAR               = 0x0A,
448     RIL_CDMA_SMS_UDH_EO_MAX32 = 0x10000000   /* Force constant ENUM size in structures */
449 } RIL_CDMA_SMS_UdhEoId;
450
451 typedef struct {
452     /* Extended objects are to be used together with 16-bit concatenation
453     ** UDH. The max number of segments supported for E.O. is 8 at least.
454     */
455     RIL_CDMA_SMS_UdhEoContent    content;
456
457     unsigned char                                 first_segment;
458     /* The following fields are only present in the first segment of a
459     ** concatenated SMS message.
460     */
461    unsigned char                                   reference;
462     /* Identify those extended object segments which should be linked together
463     */
464    unsigned short                                  length;
465     /* Length of the whole extended object data
466     */
467     unsigned char                                   control;
468     RIL_CDMA_SMS_UdhEoId                    type;
469     unsigned short                                  position;
470     /* Absolute position of the E.O. in the whole text after concatenation,
471     ** starting from 1.
472     */
473 } RIL_CDMA_SMS_UdhEo;
474
475 typedef struct {
476     RIL_CDMA_SMS_UdhId  header_id;
477     unsigned char               header_length;
478     unsigned char              data[RIL_CDMA_SMS_UDH_OTHER_SIZE];
479 } RIL_CDMA_SMS_UdhOther;
480
481 typedef struct {
482     unsigned char        header_length;
483 } RIL_CDMA_SMS_UdhRfc822;
484
485 typedef struct {
486     RIL_CDMA_SMS_UdhId                header_id;
487
488     union {
489         RIL_CDMA_SMS_UdhConcat8             concat_8;       // 00
490     
491         RIL_CDMA_SMS_UdhSpecialSM           special_sm;     // 01
492         RIL_CDMA_SMS_UdhWap8                wap_8;          // 04
493         RIL_CDMA_SMS_UdhWap16               wap_16;         // 05
494         RIL_CDMA_SMS_UdhConcat16            concat_16;      // 08
495         RIL_CDMA_SMS_UdhTextFormating       text_formating; // 0a
496         RIL_CDMA_SMS_UdhPreDefSound         pre_def_sound;  // 0b
497         RIL_CDMA_SMS_UdhUserDefSound        user_def_sound; // 0c
498         RIL_CDMA_SMS_UdhPreDefAnim          pre_def_anim;   // 0d
499         RIL_CDMA_SMS_UdhLargeAnim           large_anim;     // 0e
500         RIL_CDMA_SMS_UdhSmallAnim           small_anim;     // 0f
501         RIL_CDMA_SMS_UdhLargePictureData    large_picture;  // 10
502         RIL_CDMA_SMS_UdhSmallPictureData    small_picture;  // 11
503         RIL_CDMA_SMS_UdhVarPicture          var_picture;    // 12
504     
505         RIL_CDMA_SMS_UdhUserPrompt          user_prompt;    // 13
506         RIL_CDMA_SMS_UdhEo                  eo;             // 14
507     
508         RIL_CDMA_SMS_UdhRfc822              rfc822;         // 20
509         RIL_CDMA_SMS_UdhOther               other;
510
511     }u;   
512 } RIL_CDMA_SMS_Udh;
513
514 /* ----------------------------- */
515 /* -- User data encoding type -- */
516 /* ----------------------------- */
517 typedef enum {
518     RIL_CDMA_SMS_ENCODING_OCTET        = 0,    /* 8-bit */
519     RIL_CDMA_SMS_ENCODING_IS91EP,              /* varies */
520     RIL_CDMA_SMS_ENCODING_ASCII,               /* 7-bit */
521     RIL_CDMA_SMS_ENCODING_IA5,                 /* 7-bit */
522     RIL_CDMA_SMS_ENCODING_UNICODE,             /* 16-bit */
523     RIL_CDMA_SMS_ENCODING_SHIFT_JIS,           /* 8 or 16-bit */
524     RIL_CDMA_SMS_ENCODING_KOREAN,              /* 8 or 16-bit */
525     RIL_CDMA_SMS_ENCODING_LATIN_HEBREW,        /* 8-bit */
526     RIL_CDMA_SMS_ENCODING_LATIN,               /* 8-bit */
527     RIL_CDMA_SMS_ENCODING_GSM_7_BIT_DEFAULT,   /* 7-bit */
528     RIL_CDMA_SMS_ENCODING_MAX32        = 0x10000000
529
530 } RIL_CDMA_SMS_UserDataEncoding;
531
532 /* ------------------------ */
533 /* -- IS-91 EP data type -- */
534 /* ------------------------ */
535 typedef enum {
536     RIL_CDMA_SMS_IS91EP_VOICE_MAIL         = 0x82,
537     RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE_FULL = 0x83,
538     RIL_CDMA_SMS_IS91EP_CLI_ORDER          = 0x84,
539     RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE      = 0x85,
540     RIL_CDMA_SMS_IS91EP_MAX32              = 0x10000000
541
542 } RIL_CDMA_SMS_IS91EPType;
543
544 typedef struct {
545     /* NOTE: If message_id.udh_present == TRUE:
546     **       'num_headers' is the number of User Data Headers (UDHs),
547     **       and 'headers' include all those headers.
548     */
549     unsigned char                              num_headers;
550     RIL_CDMA_SMS_Udh                     headers[RIL_CDMA_SMS_MAX_UD_HEADERS];
551
552     RIL_CDMA_SMS_UserDataEncoding      encoding;
553     RIL_CDMA_SMS_IS91EPType             is91ep_type;
554
555     /*----------------------------------------------------------------------
556      'data_len' indicates the valid number of bytes in the 'data' array.
557
558      'padding_bits' (0-7) indicates how many bits in the last byte of 'data'
559      are invalid bits. This parameter is only used for Mobile-Originated
560      messages. There is no way for the API to tell how many padding bits
561      exist in the received message. Instead, the application can find out how
562      many padding bits exist in the user data when decoding the user data.
563
564      'data' has the raw bits of the user data field of the SMS message.
565      The client software should decode the raw user data according to its
566      supported encoding types and languages.
567
568      EXCEPTION 1: CMT-91 user data raw bits are first translated into BD fields
569      (e.g. num_messages, callback, etc.) The translated user data field in
570      VMN and Short Message is in the form of ASCII characters, each occupying
571      a byte in the resulted 'data'.
572
573      EXCEPTION 2: GSM 7-bit Default characters are decoded so that each byte
574      has one 7-bit GSM character.
575
576      'number_of_digits' is the number of digits/characters (7, 8, 16, or
577      whatever bits) in the raw user data, which can be used by the client
578      when decoding the user data according to the encoding type and language.
579     -------------------------------------------------------------------------*/
580     unsigned char                                data_len;
581     unsigned char                                padding_bits;
582     unsigned char                                data[ RIL_CDMA_SMS_USER_DATA_MAX ];
583     unsigned char                                number_of_digits;
584
585 } RIL_CDMA_SMS_CdmaUserData;
586
587 /* -------------------- */
588 /* ---- Message Id ---- */
589 /* -------------------- */
590 typedef enum {
591     RIL_CDMA_SMS_BD_TYPE_RESERVED_0     = 0,
592     RIL_CDMA_SMS_BD_TYPE_DELIVER,       /* MT only */
593     RIL_CDMA_SMS_BD_TYPE_SUBMIT,        /* MO only */
594     RIL_CDMA_SMS_BD_TYPE_CANCELLATION,  /* MO only */
595     RIL_CDMA_SMS_BD_TYPE_DELIVERY_ACK,  /* MT only */
596     RIL_CDMA_SMS_BD_TYPE_USER_ACK,      /* MT & MO */
597     RIL_CDMA_SMS_BD_TYPE_READ_ACK,      /* MT & MO */
598     RIL_CDMA_SMS_BD_TYPE_MAX32          = 0x10000000
599
600 } RIL_CDMA_SMS_BdMessageType;
601
602 typedef unsigned int  RIL_CDMA_SMS_MessageNumber;
603
604 typedef struct {
605     RIL_CDMA_SMS_BdMessageType   type;
606     RIL_CDMA_SMS_MessageNumber      id_number;
607     unsigned char                      udh_present;
608     /* NOTE: if FEATURE_SMS_UDH is not defined,
609     ** udh_present should be ignored.
610     */
611 } RIL_CDMA_SMS_MessageId;
612
613 typedef unsigned char           RIL_CDMA_SMS_UserResponse;
614
615 /* ------------------- */
616 /* ---- Timestamp ---- */
617 /* ------------------- */
618 typedef struct {
619     /* If 'year' is between 96 and 99, the actual year is 1900 + 'year';
620        if 'year' is between 00 and 95, the actual year is 2000 + 'year'.
621        NOTE: Each field has two BCD digits and byte arrangement is <MSB, ... ,LSB>
622     */
623     unsigned char      year;        /* 0x00-0x99 */
624     unsigned char      month;       /* 0x01-0x12 */
625     unsigned char      day;         /* 0x01-0x31 */
626     unsigned char      hour;        /* 0x00-0x23 */
627     unsigned char      minute;      /* 0x00-0x59 */
628     unsigned char      second;      /* 0x00-0x59 */
629     signed char      timezone;    /* +/-, [-48,+48] number of 15 minutes - GW only */
630 } RIL_CDMA_SMS_Timestamp;
631
632 /* ------------------ */
633 /* ---- Priority ---- */
634 /* ------------------ */
635 typedef enum {
636     RIL_CDMA_SMS_PRIORITY_NORMAL      = 0,
637     RIL_CDMA_SMS_PRIORITY_INTERACTIVE,
638     RIL_CDMA_SMS_PRIORITY_URGENT,
639     RIL_CDMA_SMS_PRIORITY_EMERGENCY,
640     RIL_CDMA_SMS_PRIORITY_MAX32       = 0x10000000
641
642 } RIL_CDMA_SMS_Priority;
643
644 /* ----------------- */
645 /* ---- Privacy ---- */
646 /* ----------------- */
647 typedef enum {
648     RIL_CDMA_SMS_PRIVACY_NORMAL      = 0,
649     RIL_CDMA_SMS_PRIVACY_RESTRICTED,
650     RIL_CDMA_SMS_PRIVACY_CONFIDENTIAL,
651     RIL_CDMA_SMS_PRIVACY_SECRET,
652     RIL_CDMA_SMS_PRIVACY_MAX32       = 0x10000000
653
654 } RIL_CDMA_SMS_Privacy;
655
656 /* ---------------------- */
657 /* ---- Reply option ---- */
658 /* ---------------------- */
659 typedef struct {
660     /* whether user ack is requested
661     */
662     unsigned char          user_ack_requested;
663
664     /* whether delivery ack is requested.
665        Should be FALSE for incoming messages.
666     */
667     unsigned char          delivery_ack_requested;
668
669     /* Message originator requests the receiving phone to send back a READ_ACK
670     ** message automatically when the user reads the received message.
671     */
672     unsigned char          read_ack_requested;
673
674 } RIL_CDMA_SMS_ReplyOption;
675
676 typedef enum {
677     RIL_CDMA_SMS_ALERT_MODE_DEFAULT         = 0,
678     RIL_CDMA_SMS_ALERT_MODE_LOW_PRIORITY    = 1,
679     RIL_CDMA_SMS_ALERT_MODE_MEDIUM_PRIORITY = 2,
680     RIL_CDMA_SMS_ALERT_MODE_HIGH_PRIORITY   = 3,
681
682     /* For pre-IS637A implementations, alert_mode only has values of True/False:
683     */
684     RIL_CDMA_SMS_ALERT_MODE_OFF   = 0,
685     RIL_CDMA_SMS_ALERT_MODE_ON    = 1
686
687 } RIL_CDMA_SMS_AlertMode;
688
689 /* ------------------ */
690 /* ---- Language ---- */
691 /* ------------------ */
692 typedef enum {
693     RIL_CDMA_SMS_LANGUAGE_UNSPECIFIED = 0,
694     RIL_CDMA_SMS_LANGUAGE_ENGLISH,
695     RIL_CDMA_SMS_LANGUAGE_FRENCH,
696     RIL_CDMA_SMS_LANGUAGE_SPANISH,
697     RIL_CDMA_SMS_LANGUAGE_JAPANESE,
698     RIL_CDMA_SMS_LANGUAGE_KOREAN,
699     RIL_CDMA_SMS_LANGUAGE_CHINESE,
700     RIL_CDMA_SMS_LANGUAGE_HEBREW,
701     RIL_CDMA_SMS_LANGUAGE_MAX32       = 0x10000000
702
703 } RIL_CDMA_SMS_Language;
704
705 /* ---------------------------------- */
706 /* ---------- Display Mode ---------- */
707 /* ---------------------------------- */
708 typedef enum {
709     RIL_CDMA_SMS_DISPLAY_MODE_IMMEDIATE   = 0,
710     RIL_CDMA_SMS_DISPLAY_MODE_DEFAULT     = 1,
711     RIL_CDMA_SMS_DISPLAY_MODE_USER_INVOKE = 2,
712     RIL_CDMA_SMS_DISPLAY_MODE_RESERVED    = 3
713 } RIL_CDMA_SMS_DisplayMode;
714
715 /* IS-637B parameters/fields
716 */
717
718 /* ---------------------------------- */
719 /* ---------- Delivery Status ------- */
720 /* ---------------------------------- */
721 typedef enum {
722     RIL_CDMA_SMS_DELIVERY_STATUS_ACCEPTED              = 0,    /* ERROR_CLASS_NONE */
723     RIL_CDMA_SMS_DELIVERY_STATUS_DEPOSITED_TO_INTERNET = 1,    /* ERROR_CLASS_NONE */
724     RIL_CDMA_SMS_DELIVERY_STATUS_DELIVERED             = 2,    /* ERROR_CLASS_NONE */
725     RIL_CDMA_SMS_DELIVERY_STATUS_CANCELLED             = 3,    /* ERROR_CLASS_NONE */
726
727     RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_CONGESTION  = 4,    /* ERROR_CLASS_TEMP & PERM */
728     RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_ERROR       = 5,    /* ERROR_CLASS_TEMP & PERM */
729     RIL_CDMA_SMS_DELIVERY_STATUS_CANCEL_FAILED       = 6,    /* ERROR_CLASS_PERM */
730     RIL_CDMA_SMS_DELIVERY_STATUS_BLOCKED_DESTINATION = 7,    /* ERROR_CLASS_PERM */
731     RIL_CDMA_SMS_DELIVERY_STATUS_TEXT_TOO_LONG       = 8,    /* ERROR_CLASS_PERM */
732     RIL_CDMA_SMS_DELIVERY_STATUS_DUPLICATE_MESSAGE   = 9,    /* ERROR_CLASS_PERM */
733     RIL_CDMA_SMS_DELIVERY_STATUS_INVALID_DESTINATION = 10,   /* ERROR_CLASS_PERM */
734     RIL_CDMA_SMS_DELIVERY_STATUS_MESSAGE_EXPIRED     = 13,   /* ERROR_CLASS_PERM */
735
736     RIL_CDMA_SMS_DELIVERY_STATUS_UNKNOWN_ERROR       = 0x1F  /* ERROR_CLASS_PERM */
737
738     /* All the other values are reserved */
739
740 } RIL_CDMA_SMS_DeliveryStatusE;
741
742 typedef struct {
743     RIL_CDMA_SMS_ErrorClass       error_class;
744     RIL_CDMA_SMS_DeliveryStatusE   status;
745 } RIL_CDMA_SMS_DeliveryStatus;
746
747 typedef struct {
748     unsigned char               address[RIL_CDMA_SMS_IP_ADDRESS_SIZE];
749     unsigned char             is_valid;
750 } RIL_CDMA_SMS_IpAddress;
751
752 /* This special parameter captures any unrecognized/proprietary parameters
753 */
754 typedef struct {
755     unsigned char                         input_other_len;
756     unsigned char                         desired_other_len; /* used during decoding */
757     unsigned char                         * other_data;
758 } RIL_CDMA_SMS_OtherParm;
759
760 typedef struct {
761     /* the mask indicates which fields are present in this message */
762     unsigned int                        mask;
763
764     RIL_CDMA_SMS_MessageId         message_id;
765     RIL_CDMA_SMS_CdmaUserData     user_data;
766     RIL_CDMA_SMS_UserResponse        user_response;
767     RIL_CDMA_SMS_Timestamp          mc_time;
768     RIL_CDMA_SMS_Timestamp          validity_absolute;
769     RIL_CDMA_SMS_Timestamp          validity_relative;
770     RIL_CDMA_SMS_Timestamp          deferred_absolute;
771     RIL_CDMA_SMS_Timestamp          deferred_relative;
772     RIL_CDMA_SMS_Priority           priority;
773     RIL_CDMA_SMS_Privacy            privacy;
774     RIL_CDMA_SMS_ReplyOption       reply_option;
775     unsigned char                         num_messages;  /* the actual value; not BCDs */
776     RIL_CDMA_SMS_AlertMode         alert_mode;
777      /* For pre-IS-637A implementations, alert_mode is either Off or On. */
778     RIL_CDMA_SMS_Language           language;
779     RIL_CDMA_SMS_Address            callback;
780     RIL_CDMA_SMS_DisplayMode       display_mode;
781
782     RIL_CDMA_SMS_DeliveryStatus    delivery_status;
783     unsigned int                        deposit_index;
784
785     RIL_CDMA_SMS_IpAddress         ip_address;
786     unsigned char                         rsn_no_notify;
787
788     /* See function comments of wms_ts_decode() and
789     ** wms_ts_decode_cdma_bd_with_other() for details regarding 'other' parameters
790     */
791     RIL_CDMA_SMS_OtherParm         other;
792
793 } RIL_CDMA_SMS_ClientBd;
794
795 typedef struct {
796     unsigned char length;   /* length, in bytes, of the encoded SMS message */
797     unsigned char * data;   /* the encoded SMS message (max 255 bytes) */
798 } RIL_CDMA_Encoded_SMS;
799
800 #ifdef __cplusplus
801 }
802 #endif
803
804 #endif /*ANDROID_RIL_CDMA_SMS_H*/