PbapSrv.h
14.8 KB
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
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* PhoneBookPBAP.h
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* phonebook access profile
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef __SRV_PBAP_H__
#define __SRV_PBAP_H__
#include "MMI_features.h"
#ifdef __MMI_BT_SUPPORT__
#if defined(__MMI_PBAP_SUPPORT__)
#include "MMIDataType.h"
#include "mmi_res_range_def.h"
#include "bluetooth_struct.h"
#include "fs_type.h"
#include "custom_phb_config.h"
#include "BtcmSrvGprot.h"
#include "PbapSrvGprot.h"
#include "MMI_conn_app_trc.h"
#include "DebugInitDef_Int.h"
#include "kal_general_types.h"
#define MMI_PBAP_INVALID_REQ_ID 0xFF
#define MMI_PBAP_INVALID_CONN_ID 0xFF
#define PBAP_BUILD_LIST_BUFFER 500
#define SRV_PBAP_MAX_HANDLE_NUM 2
#define BEGIN_XML_DECL "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!-- This Folder Object generated by MTK Blue SDK -->\r\n"
#define BEGIN_FOLDER_DECL "<!DOCTYPE vcard-listing SYSTEM \"vcard-listing.dtd\">\r\n<vcard-listing version=\"1.0\">\r\n"
#define END_FOLDER_DECL "</vcard-listing>\r\n"
#define BEGIN_HANDLE " <card handle = \""
#define MIDDLE_HANDLE ".vcf\" name = \""
#define END_HANDLE "\"/>\r\n"
/*---------------------------------------------------------------------------
* PbapVcardFilterBit type
*
* Describes the bit location pertaining to each filter value in
* the 64-bit vCard filter.
*/
typedef U8 PbapVcardFilterBit;
#define PBAP_VCARD_FILTER_VER 0 /* Version (Bit 0) */
#define PBAP_VCARD_FILTER_FN 1 /* Formatted Name (Bit 1) */
#define PBAP_VCARD_FILTER_N 2 /* Structured Presentation of Name (Bit 2) */
#define PBAP_VCARD_FILTER_PHOTO 3 /* Associated Image or Photo (Bit 3) */
#define PBAP_VCARD_FILTER_BDAY 4 /* Birthday (Bit 4) */
#define PBAP_VCARD_FILTER_ADR 5 /* Delivery Address (Bit 5) */
#define PBAP_VCARD_FILTER_LABEL 6 /* Delivery (Bit 6) */
#define PBAP_VCARD_FILTER_TEL 7 /* Telephone (Bit 7) */
#define PBAP_VCARD_FILTER_EMAIL 8 /* Electronic Mail Address (Bit 8) */
#define PBAP_VCARD_FILTER_MAILER 9 /* Electronic Mail (Bit 9) */
#define PBAP_VCARD_FILTER_TZ 10 /* Time Zone (Bit 10) */
#define PBAP_VCARD_FILTER_GEO 11 /* Geographic Position (Bit 11) */
#define PBAP_VCARD_FILTER_TITLE 12 /* Job (Bit 12) */
#define PBAP_VCARD_FILTER_ROLE 13 /* Role within the Organization (Bit 13) */
#define PBAP_VCARD_FILTER_LOGO 14 /* Organization Logo (Bit 14) */
#define PBAP_VCARD_FILTER_AGENT 15 /* vCard of Person Representing (Bit 15) */
#define PBAP_VCARD_FILTER_ORG 16 /* Name of Organization (Bit 16) */
#define PBAP_VCARD_FILTER_NOTE 17 /* Comments (Bit 17) */
#define PBAP_VCARD_FILTER_REV 18 /* Revision (Bit 18) */
#define PBAP_VCARD_FILTER_SOUND 19 /* Pronunciation of Name (Bit 19) */
#define PBAP_VCARD_FILTER_URL 20 /* Uniform Resource Locator (Bit 20) */
#define PBAP_VCARD_FILTER_UID 21 /* Unique ID (Bit 21) */
#define PBAP_VCARD_FILTER_KEY 22 /* Public Encryption Key (Bit 22) */
#define PBAP_VCARD_FILTER_NICK 23 /* Nickname (Bit 23) */
#define PBAP_VCARD_FILTER_CAT 24 /* Categories (Bit 24) */
#define PBAP_VCARD_FILTER_PRODID 25 /* Product Id (Bit 25) */
#define PBAP_VCARD_FILTER_CLASS 26 /* Class Information (Bit 26) */
#define PBAP_VCARD_FILTER_SORT_STR 27 /* Sort string (Bit 27) */
#define PBAP_VCARD_FILTER_TIMESTAMP 28 /* Time stamp (Bit 28) */
/* Bits 29-38 Reserved for future use */
#define PBAP_VCARD_FILTER_PROP 39 /* Use of a proprietary filter (Bit 39) */
/* Bits 40-63 Reserved for proprietary filter usage */
typedef enum
{
SRV_PBAP_STATE_IDLE, /*0*/
SRV_PBAP_STATE_REGISTERING, /*1*/
SRV_PBAP_STATE_DEREGISTERING, /*2*/
SRV_PBAP_STATE_ACTIVE, /*3*/
SRV_PBAP_STATE_AUTHORIZING, /*4*/
SRV_PBAP_STATE_AUTHORIZED, /*5*/
SRV_PBAP_STATE_CONNECTED, /*6*/
SRV_PBAP_STATE_BUILDING_FOLDER, /*7*/
SRV_PBAP_STATE_BUILDING_ENTRY, /*8*/
SRV_PBAP_STATE_BUILDING_LIST, /*9*/
SRV_PBAP_STATE_DISCONNECTING, /*10*/
SRV_PBAP_STATE_DEACTIVATING, /*11*/
SRV_PBPA_STATE_TATOL
} srv_pbap_state_enum;
/****************************************************************************
*
* Constants
*
****************************************************************************/
/****************************************************************************
*
* Types
*
****************************************************************************/
/*---------------------------------------------------------------------------
* PbNameType type
*
* This type is used to identify the portion of path information that
* is provided in the Phonebook Name. For example, a Pull Phonebook
* operation supplies the entire absolute path name for the phonebook,
* while Pull Vcard Listing and Pull Vcard Entry provide only the name
* of the phonebook and the name of the vCard, respectively.
*/
typedef U8 PbNameType;
#define PB_NAME_TYPE_ABSOLUTE 0 /* Absolute path information */
#define PB_NAME_TYPE_LOCAL 1 /* Local path information */
/* End of PbNameType */
/*---------------------------------------------------------------------------
* PbPathFlags type
*
* This type is used to identify the portion of path information that
*/
typedef U16 PbPathFlags;
#define PB_PATH_TELECOM 0x0001 /* Telecom path is used */
#define PB_PATH_SIM 0x0002 /* SIM path is used */
#define PB_PATH_PHONEBOOK 0x0004 /* Phonebook path is used */
#define PB_PATH_INCOMING 0x0008 /* Incoming call path is used */
#define PB_PATH_OUTGOING 0x0010 /* Outgoing call path is used */
#define PB_PATH_MISSED 0x0020 /* Missed call path is used */
#define PB_PATH_COMBINED 0x0040 /* Combined call path is used */
/* End of PbPathFlags */
typedef enum
{
SRV_PBAP_EVENT_REG = PBAP_BASE + 1,
SRV_PBAP_EVENT_DEREG,
SRV_PBAP_EVENT_MAX
}srv_pbap_event_enum;
/*---------------------------------------------------------------------------
* PbUid type
*/
typedef U32 PbUid;
/*--------------------------------------------------------------------------
* PbPullPhonebookOp structure
*
* Description
*/
typedef struct _PbPullPhonebookOp
{
U8 folderName[PBAP_MAX_NAME_LEN + 1]; /*ASCII encoding*/
PbapVcardFilter filter;
PbapVcardFormat format;
U16 maxListCount;
U16 listStartOffset;
U16 new_index;
} PbPullPhonebookOp;
/*--------------------------------------------------------------------------
* PbPullVcardListingOp structure
*
* Description
*/
typedef struct _PbPullVcardListingOp
{
U8 folderName[PBAP_MAX_NAME_LEN/ENCODING_LENGTH + 1];//ASCII encoding
U8 searchAttribute;
U8 searchValue[(MAX_PBAP_SEARCH_VALUE_LENGTH + 1) *ENCODING_LENGTH]; //ucs encoding
U8 searchValueLength;
U8 order;
U16 maxListCount;
U16 listStartOffset;
U16 list_size;
FS_HANDLE listing_fh;
U16 curr_index;
} PbPullVcardListingOp;
/*--------------------------------------------------------------------------
* PbPullVcardEntryOp structure
*
* Description
*/
typedef struct _PbPullVcardEntryOp
{
U16 entry_index;
PbapVcardFilter filter; /* Filter of the required vCard fields */
U8 format; /* Format of vCard (2.1 or 3.0) */
} PbPullVcardEntryOp;
typedef struct
{
MMI_EVT_PARAM_HEADER
S32 event_id;
void *data;
}srv_pbap_event_struct;
/*---------------------------------------------------------------------------
* PBAP_IsSetFilterBit()
*
* Returns the status of the appropriate filter bit in the 64-bit
* vCard filter.
*
* Parameters:
* Bit - Bit to check in the vCard filter.
*
* Filter - vCard filter structure.
*
* Returns:
* TRUE or FALSE
*/
typedef struct
{
srv_pbap_state_enum state;
U16 g_index_list[MMI_PHB_PHONE_ENTRIES];
S8 currentPath[PBAP_MAX_NAME_LEN + 1]; /*ASCII encoding, Indicate the current path that client set*/
S8 pb_storage; /*Indicate the object type*/
U16 pb_size;//record the pb size in pullphonebook or pullvcardlisting
MMI_BOOL index_array_got;
PbPullVcardListingOp vcard_listing;
PbPullPhonebookOp vcard_folder;
PbPullVcardEntryOp vcard_entry;
U16 completed_count;
U32 cm_conn_id;
U32 conn_id;
srv_bt_cm_bt_addr bt_device;
//U8 pbap_dev_name[BT_PBAP_MAX_DEV_NAME_LEN];
MMI_BOOL disconnect_from_cm;
}srv_pbap_cntx_struct;
typedef struct
{
S32 srv_hd;
U32 event_mask;
bt_notify notifier;
srv_pbap_cntx_struct *pbap_cntx;
} srv_pbap_handle_struct;
typedef struct
{
srv_pbap_handle_struct app_hd[SRV_PBAP_MAX_HANDLE_NUM];
srv_pbap_cntx_struct pbap_cntx;
}srv_pbap_context_struct;
extern srv_pbap_context_struct *srv_pbap_p;
#define SRV_PBAP_LOG(x) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x); \
}
#define SRV_PBAP_LOG1(x, x1) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1); \
}
#define SRV_PBAP_LOG2(x, x1, x2) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1, x2); \
}
#define SRV_PBAP_LOG3(x, x1, x2, x3) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1, x2, x3); \
}
#define SRV_PBAP_LOG4(x, x1, x2, x3, x4) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1, x2, x3, x4); \
}
#define SRV_PBAP_LOG6(x, x1, x2, x3, x4, x5, x6) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1, x2, x3, x4, x5, x6); \
}
#define SRV_PBAP_LOG7(x, x1, x2, x3, x4, x5, x6, x7) \
{ \
MMI_TRACE(MMI_CONN_TRC_G7_BT, x, x1, x2, x3, x4, x5, x6, x7); \
}
#define SRV_PBAP_STATE_TRANS(x) \
{ \
SRV_PBAP_LOG2(SRV_PBAP_SERVER_STATE_TRAN, srv_pbap_p->pbap_cntx.state, x); \
srv_pbap_p->pbap_cntx.state = (x); \
}
#define SRV_PBAP_LOG_STATE() \
{ \
SRV_PBAP_LOG1(SRV_PBAP_SERVER_LOG_STATE, srv_pbap_p->pbap_cntx.state); \
}
#endif /* defined(__MMI_PBAP_NEW_SUPPORT__) */
#endif /* __MMI_BT_SUPPORT__ */
#endif /* __BT_MMI_PBAP_H__ */