summaryrefslogtreecommitdiffstats
path: root/bta/include/bta_ma_def.h
blob: 7202385d566dc87bf23cb4b718b56f0e4586b34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
/*****************************************************************************
**
**  Name:           bta_ma_def.h
**
**  Description:    This file contains the common definitions for the Message Access
**                  profile (MA) related SW modules
**
**  Copyright (c) 2009, Broadcom Corp., All Rights Reserved.
**  Broadcom Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef BTA_MA_DEF_H
#define BTA_MA_DEF_H

#include "obx_api.h"
#include "bta_api.h"
#include "btm_api.h"
#include "bta_sys.h"
#include "bta_fs_co.h"

/*****************************************************************************
**  Constants and data types
*****************************************************************************/


#define BTA_MA_HANDLE_SIZE          8

typedef UINT8  tBTA_MA_MSG_HANDLE[BTA_MA_HANDLE_SIZE];

typedef tOBX_HANDLE tBTA_MA_SESS_HANDLE;   

typedef UINT8 tBTA_MA_INST_ID;   

#define BTA_MA_STATUS_OK                0
#define BTA_MA_STATUS_FAIL              1   /* Used to pass all other errors */
#define BTA_MA_STATUS_ABORTED           2
#define BTA_MA_STATUS_NO_RESOURCE       3
#define BTA_MA_STATUS_EACCES            4
#define BTA_MA_STATUS_ENOTEMPTY         5
#define BTA_MA_STATUS_EOF               6
#define BTA_MA_STATUS_EODIR             7
#define BTA_MA_STATUS_ENOSPACE          8   /* Returned in bta_fs_ci_open if no room */
#define BTA_MA_STATUS_DUPLICATE_ID      9
#define BTA_MA_STATUS_ID_NOT_FOUND      10
#define BTA_MA_STATUS_FULL              11  /* reach the max packet size */ 

typedef UINT8 tBTA_MA_STATUS;

#define BTA_MA_OPER_NONE                0
#define BTA_MA_OPER_GET_MSG             1   
#define BTA_MA_OPER_PUSH_MSG            2

typedef UINT8 tBTA_MA_OPER; 

/* mode field in tBTA_MSE_CO_FOLDER_ENTRY (OR'd together) */
#define BTA_MA_A_RDONLY         1
#define BTA_MA_A_DIR            2      /* Entry is a sub directory */


/* message status inficator */
#define BTA_MA_STS_INDTR_READ       0
#define BTA_MA_STS_INDTR_DELETE     1
typedef UINT8 tBTA_MA_STS_INDCTR;

/* message status value */
#define BTA_MA_STS_VALUE_NO         0
#define BTA_MA_STS_VALUE_YES        1
typedef UINT8 tBTA_MA_STS_VALUE;

/* notification status */
enum
{
    BTA_MA_NOTIF_OFF = 0,
    BTA_MA_NOTIF_ON,
    BTA_MA_NOTIF_MAX

};
typedef UINT8 tBTA_MA_NOTIF_STATUS;


/* Access response types */
enum 
{
    BTA_MA_ACCESS_TYPE_ALLOW = 0,    /* Allow the requested operation */
    BTA_MA_ACCESS_TYPE_FORBID        /* Disallow the requested operation */
};

typedef UINT8 tBTA_MA_ACCESS_TYPE;

/* Structure for in progress related event*/
typedef struct
{
    UINT32              obj_size;   /* Total size of object 0 if unknow*/
    tBTA_MA_SESS_HANDLE mas_session_id;
    UINT16              bytes;      /* Number of bytes read or written since last progress event */
} tBTA_MA_IN_PROG;


/* Message type see SDP supported message type */
#define BTA_MA_MSG_TYPE_EMAIL                (1<<0) 
#define BTA_MA_MSG_TYPE_SMS_GSM              (1<<1)   
#define BTA_MA_MSG_TYPE_SMS_CDMA             (1<<2)  
#define BTA_MA_MSG_TYPE_MMS                  (1<<3)  
typedef UINT8 tBTA_MA_MSG_TYPE;

#define BTA_MA_MAX_FILTER_TEXT_SIZE 255    

/* Message type mask for FilterMessageType in Application parameter */
#define BTA_MA_MSG_TYPE_MASK_SMS_GSM         (1<<0)
#define BTA_MA_MSG_TYPE_MASK_SMS_CDMA        (1<<1) 
#define BTA_MA_MSG_TYPE_MASK_EMAIL           (1<<2)   
#define BTA_MA_MSG_TYPE_MASK_MMS             (1<<3)  


typedef UINT8 tBTA_MA_MSG_TYPE_MASK;



/* Parameter Mask for Messages-Listing   */
#define BTA_MA_ML_MASK_SUBJECT               (1<<0) 
#define BTA_MA_ML_MASK_DATETIME              (1<<1)   
#define BTA_MA_ML_MASK_SENDER_NAME           (1<<2)  
#define BTA_MA_ML_MASK_SENDER_ADDRESSING     (1<<3)  
#define BTA_MA_ML_MASK_RECIPIENT_NAME        (1<<4)   
#define BTA_MA_ML_MASK_RECIPIENT_ADDRESSING  (1<<5)   
#define BTA_MA_ML_MASK_TYPE                  (1<<6)  
#define BTA_MA_ML_MASK_SIZE                  (1<<7)   
#define BTA_MA_ML_MASK_RECEPTION_STATUS      (1<<8)  
#define BTA_MA_ML_MASK_TEXT                  (1<<9)   
#define BTA_MA_ML_MASK_ATTACHMENT_SIZE       (1<<10)  
#define BTA_MA_ML_MASK_PRIORITY              (1<<11) 
#define BTA_MA_ML_MASK_READ                  (1<<12) 
#define BTA_MA_ML_MASK_SENT                  (1<<13) 
#define BTA_MA_ML_MASK_PROTECTED             (1<<14) 
#define BTA_MA_ML_MASK_REPLYTO_ADDRESSING    (1<<15) 

typedef UINT32 tBTA_MA_ML_MASK;

/* Read status used for  message list */
enum 
{
    BTA_MA_READ_STATUS_NO_FILTERING = 0,     
    BTA_MA_READ_STATUS_UNREAD       = 1,
    BTA_MA_READ_STATUS_READ         = 2    
};
typedef UINT8 tBTA_MA_READ_STATUS;

/* Priority status used for filtering message list */
enum 
{
    BTA_MA_PRI_STATUS_NO_FILTERING = 0,     
    BTA_MA_PRI_STATUS_HIGH         = 1,
    BTA_MA_PRI_STATUS_NON_HIGH     = 2 
};
typedef UINT8 tBTA_MA_PRI_STATUS;

#define BTA_MA_LTIME_LEN 15
typedef struct
{
    tBTA_MA_ML_MASK       parameter_mask;
    UINT16                max_list_cnt;
    UINT16                list_start_offset;
    UINT8                 subject_length;  /* valid range 1...255 */
    tBTA_MA_MSG_TYPE_MASK msg_mask;
    char                  period_begin[BTA_MA_LTIME_LEN+1]; /* "yyyymmddTHHMMSS", or "" if none */
    char                  period_end[BTA_MA_LTIME_LEN+1]; /* "yyyymmddTHHMMSS", or "" if none */
    tBTA_MA_READ_STATUS   read_status;
    char                  recipient[BTA_MA_MAX_FILTER_TEXT_SIZE+1]; /* "" if none */
    char                  originator[BTA_MA_MAX_FILTER_TEXT_SIZE+1];/* "" if none */
    tBTA_MA_PRI_STATUS    pri_status;
} tBTA_MA_MSG_LIST_FILTER_PARAM;

/* enum for charset used in GetMEssage */
enum
{
    BTA_MA_CHARSET_NATIVE = 0,     
    BTA_MA_CHARSET_UTF_8  = 1,        
    BTA_MA_CHARSET_UNKNOWN, 
    BTA_MA_CHARSET_MAX
};
typedef UINT8 tBTA_MA_CHARSET;

/* enum for fraction request used in GetMEssage */
enum
{
    BTA_MA_FRAC_REQ_FIRST = 0,     
    BTA_MA_FRAC_REQ_NEXT  = 1,        
    BTA_MA_FRAC_REQ_NO,        /* this is not a fraction request */
    BTA_MA_FRAC_REQ_MAX
};
typedef UINT8 tBTA_MA_FRAC_REQ;

/* enum for fraction delivery used in GetMEssage */
enum
{
    BTA_MA_FRAC_DELIVER_MORE  = 0,     
    BTA_MA_FRAC_DELIVER_LAST  = 1,        
    BTA_MA_FRAC_DELIVER_NO,          /* this is not a fraction deliver*/  
    BTA_MA_FRAC_DELIVER_MAX
};
typedef UINT8 tBTA_MA_FRAC_DELIVER;


typedef struct
{
    BOOLEAN            attachment;
    tBTA_MA_MSG_HANDLE handle;
    tBTA_MA_CHARSET    charset;
    tBTA_MA_FRAC_REQ   fraction_request;
} tBTA_MA_GET_MSG_PARAM;

#define BTA_MA_RETRY_OFF        0
#define BTA_MA_RETRY_ON         1
#define BTA_MA_RETRY_UNKNOWN    0xff
typedef UINT8   tBTA_MA_RETRY_TYPE;


#define BTA_MA_TRANSP_OFF        0
#define BTA_MA_TRANSP_ON         1
#define BTA_MA_TRANSP_UNKNOWN    0xff
typedef UINT8   tBTA_MA_TRANSP_TYPE;

typedef struct
{
    char                  *p_folder;  /* current or child folder
                                         for current folder set 
                                         *p_folder = ""  
                                      */
    char                  *p_msg_name; /* for MCE use only*/
    tBTA_MA_TRANSP_TYPE   transparent;
    tBTA_MA_RETRY_TYPE    retry;
    tBTA_MA_CHARSET       charset; 

} tBTA_MA_PUSH_MSG_PARAM;

/* get or push message multi-packet status */
enum
{
    BTA_MA_MPKT_STATUS_MORE = 0,     
    BTA_MA_MPKT_STATUS_LAST,        
    BTA_MA_MPKT_MAX        
};

typedef UINT8 tBTA_MA_MPKT_STATUS;

/* definitions for directory navigation */
#define BTA_MA_DIR_NAV_ROOT_OR_DOWN_ONE_LVL     2     
#define BTA_MA_DIR_NAV_UP_ONE_LVL               3        

typedef UINT8 tBTA_MA_DIR_NAV;

enum
{
    BTA_MA_ATTACH_OFF = 0,
    BTA_MA_ATTACH_ON
};
typedef UINT8 tBTA_MA_ATTACH_TYPE;

/* MAS tag ID in application parameters header definition */
#define BTA_MA_APH_MAX_LIST_COUNT   0x01    /* MaxListCount     2 bytes     0x0000 to 0xFFFF */
#define BTA_MA_APH_START_STOFF      0x02    /* StartOffset      2 bytes     0x0000 to 0xFFFF */
#define BTA_MA_APH_FILTER_MSG_TYPE  0x03    /* SearchAttribute  1 byte      1,2,4 */
#define BTA_MA_APH_FILTER_PRD_BEGIN 0x04    /* Filter Period Begin  variable */
#define BTA_MA_APH_FILTER_PRD_END   0x05    /* Filter Period End    variable */
#define BTA_MA_APH_FILTER_READ_STS  0x06    /* Filter read status 1 byte      0, 1, 2 */
#define BTA_MA_APH_FILTER_RECEIP    0x07    /* FilterRecipient variable */
#define BTA_MA_APH_FILTER_ORIGIN    0x08    /* FilterOriginator variable */
#define BTA_MA_APH_FILTER_PRIORITY  0x09    /* FilterPriority 1 byte */
#define BTA_MA_APH_ATTACH           0x0a    /* Attachment 1 byte */
#define BTA_MA_APH_TRANSPARENT      0x0b    /* transparent 1 byte */
#define BTA_MA_APH_RETRY            0x0c    /* retry 1 byte */
#define BTA_MA_APH_NEW_MSG          0x0d    /* NewMessage 1 byte */
#define BTA_MA_APH_NOTIF_STATUS     0x0e    /* Notification Status 1 byte */
#define BTA_MA_APH_MAS_INST_ID      0x0f    /* MAS instance ID 1 byte  0 ... 255 */
#define BTA_MA_APH_PARAM_MASK       0x10    /* Parameter mask    2 bytes  */
#define BTA_MA_APH_FOLDER_LST_SIZE  0x11    /* Folder Listing Size    2 bytes  */
#define BTA_MA_APH_MSG_LST_SIZE     0x12    /* Message Listing Size    2 bytes  */
#define BTA_MA_APH_SUBJ_LEN         0x13    /* Subject Length    1 byte  */
#define BTA_MA_APH_CHARSET          0x14    /* Character Set    1 byte :0, 1 */
#define BTA_MA_APH_FRAC_REQ         0x15    /* Fraction request    1 byte :0, 1 */
#define BTA_MA_APH_FRAC_DELVR       0x16    /* Fraction delivery    1 byte :0, 1 */
#define BTA_MA_APH_STS_INDCTR       0x17    /* Status Indicator    1 byte  */
#define BTA_MA_APH_STS_VALUE        0x18    /* Status Value    1 byte: 0, 1  */
#define BTA_MA_APH_MSE_TIME         0x19    /* MSETime variable  */

#define BTA_MA_BODY_FILLER_BYTE     0x30

/* MAS type header */
#define BTA_MA_HDR_TYPE_NOTIF_REG       "x-bt/MAP-NotificationRegistration"
#define BTA_MA_HDR_TYPE_MSG_UPDATE      "x-bt/MAP-messageUpdate"
#define BTA_MA_HDR_TYPE_EVENT_RPT       "x-bt/MAP-event-report"
#define BTA_MA_HDR_TYPE_MSG_LIST        "x-bt/MAP-msg-listing"
#define BTA_MA_HDR_TYPE_MSG             "x-bt/message"
#define BTA_MA_HDR_TYPE_MSG_STATUS      "x-bt/messageStatus"
#define BTA_MA_HDR_TYPE_FOLDER_LIST     "x-obex/folder-listing"

#define BTA_MAS_MESSAGE_ACCESS_TARGET_UUID       "\xBB\x58\x2B\x40\x42\x0C\x11\xDB\xB0\xDE\x08\x00\x20\x0C\x9A\x66"
#define BTA_MAS_MESSAGE_NOTIFICATION_TARGET_UUID "\xBB\x58\x2B\x41\x42\x0C\x11\xDB\xB0\xDE\x08\x00\x20\x0C\x9A\x66"
#define BTA_MAS_UUID_LENGTH                 16
#define BTA_MAS_DEFAULT_VERSION             0x0100

#define BTA_MA_NOTIF_STS_TAG_ID     0x0E
#define BTA_MA_NOTIF_STS_LEN        0x01
#define BTA_MA_NOTIF_STS_ON         0x01
#define BTA_MA_NOTIF_STS_OFF        0x00

#define BTA_MA_NAS_INST_ID_TAG_ID     0x0F
#define BTA_MA_NAS_INST_ID_LEN        0x01

#define BTA_MA_DEFAULT_MAX_LIST_CNT   1024


#define BTA_MA_64BIT_HEX_STR_SIZE               (16+1)
#define BTA_MA_32BIT_HEX_STR_SIZE               (8+1)



/*******************************************************************************
**
** bMessage types
**
** Description      The following types are designed to hold data in memory.
**                  The internal structure of these types are implementation
**                  specific.
**
*******************************************************************************/

enum 
{
    BTA_MA_BMSG_ENC_8BIT = 0,      /* Used for Email/MMS */

    BTA_MA_BMSG_ENC_G7BIT,         /* Used for GSM-SMS */
    BTA_MA_BMSG_ENC_G7BITEXT,
    BTA_MA_BMSG_ENC_GUCS2,
    BTA_MA_BMSG_ENC_G8BIT,

    BTA_MA_BMSG_ENC_C8BIT,         /* Used for CDMA-SMS */
    BTA_MA_BMSG_ENC_CEPM,
    BTA_MA_BMSG_ENC_C7ASCII,
    BTA_MA_BMSG_ENC_CIA5,
    BTA_MA_BMSG_ENC_CUNICODE,
    BTA_MA_BMSG_ENC_CSJIS,
    BTA_MA_BMSG_ENC_CKOREAN,
    BTA_MA_BMSG_ENC_CLATINHEB,
    BTA_MA_BMSG_ENC_CLATIN,

    BTA_MA_BMSG_ENC_UNKNOWN
};
typedef UINT8 tBTA_MA_BMSG_ENCODING;

enum 
{
    BTA_MA_BMSG_LANG_UNSPECIFIED = 0, 

    BTA_MA_BMSG_LANG_UNKNOWN,
    BTA_MA_BMSG_LANG_SPANISH,      /* GSM-SMS or CDMA-SMS */

    BTA_MA_BMSG_LANG_TURKISH,      /* GSM-SMS only */
    BTA_MA_BMSG_LANG_PORTUGUESE,

    BTA_MA_BMSG_LANG_ENGLISH,      /* CDMA-SMS only */
    BTA_MA_BMSG_LANG_FRENCH,
    BTA_MA_BMSG_LANG_JAPANESE,
    BTA_MA_BMSG_LANG_KOREAN,
    BTA_MA_BMSG_LANG_CHINESE,
    BTA_MA_BMSG_LANG_HEBREW
};
typedef UINT8 tBTA_MA_BMSG_LANGUAGE;


enum
{
    BTA_MA_VCARD_VERSION_21=0,
    BTA_MA_VCARD_VERSION_30
};
typedef UINT8 tBTA_MA_VCARD_VERSION;

enum
{
    BTA_MA_VCARD_PROP_N,
    BTA_MA_VCARD_PROP_FN,
    BTA_MA_VCARD_PROP_TEL,
    BTA_MA_VCARD_PROP_EMAIL,

    BTA_MA_VCARD_PROP_MAX
};
typedef UINT8 tBTA_MA_VCARD_PROP;

typedef struct
{
    char *                      p_param;
    char *                      p_value;

    /* link to the next property (if any) */
    void *                      p_next;

} tBTA_MA_VCARD_PROPERTY;

typedef struct
{
    tBTA_MA_VCARD_VERSION         version;

    tBTA_MA_VCARD_PROPERTY *           p_prop[BTA_MA_VCARD_PROP_MAX];

    /* link to the next vCard (if any) */
    void *                      p_next;

} tBTA_MA_BMSG_VCARD;

typedef struct BMSG_MESSAGE_struct
{
    char *                      p_text;

    /* link to the next chunk of message text (if any) */
    void *                      p_next;

} tBTA_MA_BMSG_MESSAGE;

typedef struct BMSG_CONTENT_struct
{
    /* this is the first bit of message text */
    tBTA_MA_BMSG_MESSAGE *             p_message;

    /* this points to the last entered text -or-
    ** it is the last that we returned back to 
    ** 
    */
    tBTA_MA_BMSG_MESSAGE *             p_last;

    /* link to the next chunk of content (if any) */
    void *                      p_next;

} tBTA_MA_BMSG_CONTENT;


typedef struct
{
    /* Part ID */
    UINT16                      part_id;
    BOOLEAN                     is_multipart;

    /* Properties */
    tBTA_MA_BMSG_ENCODING              encoding;
    tBTA_MA_BMSG_LANGUAGE              language;       /* optional */
    tBTA_MA_CHARSET                    charset;   
    /* One or more body content */
    tBTA_MA_BMSG_CONTENT *             p_content;

} tBTA_MA_BMSG_BODY;

typedef struct BMSG_ENVELOPE_struct
{
    /* One or more Recipient (vCards) */
    tBTA_MA_BMSG_VCARD *               p_recip;

    /* There will be either another envelope or the body */
    void *                      p_next;
    tBTA_MA_BMSG_BODY *                p_body;

} tBTA_MA_BMSG_ENVELOPE;

typedef struct
{
    /* Property values */
    BOOLEAN                     read_sts;
    tBTA_MA_MSG_TYPE            msg_type;
    char *                      p_folder;

    /* One or more Originator (vCards) */
    tBTA_MA_BMSG_VCARD *               p_orig;

    /* Envelope */
    tBTA_MA_BMSG_ENVELOPE *            p_envelope;

} tBTA_MA_BMSG;


#endif