OSDN Git Service

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