1 
2 
3 /******************************************************************************
4  *
5  *  Copyright (C) 2014 The Android Open Source Project
6  *  Copyright (C) 2003-2012 Broadcom Corporation
7  *
8  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  you may not use this file except in compliance with the License.
10  *  You may obtain a copy of the License at:
11  *
12  *  http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *  Unless required by applicable law or agreed to in writing, software
15  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  See the License for the specific language governing permissions and
18  *  limitations under the License.
19  *
20  ******************************************************************************/
21 
22 /******************************************************************************
23  *
24  *  This is the private interface file for the BTA SDP I/F
25  *
26  ******************************************************************************/
27 #ifndef BTA_SDP_INT_H
28 #define BTA_SDP_INT_H
29 
30 #include "bta/bta_sys.h"
31 #include "bta/bta_api.h"
32 #include "bta/bta_sdp_api.h"
33 
34 #if (SDP_INCLUDED == TRUE)
35 /*****************************************************************************
36 **  Constants
37 *****************************************************************************/
38 
39 enum {
40     /* these events are handled by the state machine */
41     BTA_SDP_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SDP),
42     BTA_SDP_API_SEARCH_EVT,
43     BTA_SDP_API_CREATE_RECORD_USER_EVT,
44     BTA_SDP_API_REMOVE_RECORD_USER_EVT,
45     BTA_SDP_API_DISABLE_EVT,
46     BTA_SDP_MAX_INT_EVT
47 };
48 
49 enum {
50     BTA_SDP_ACTIVE_NONE = 0,
51     BTA_SDP_ACTIVE_YES       /* waiting for SDP result */
52 };
53 
54 
55 
56 /* data type for BTA_SDP_API_ENABLE_EVT */
57 typedef struct {
58     BT_HDR             hdr;
59     tBTA_SDP_DM_CBACK  *p_cback;
60 } tBTA_SDP_API_ENABLE;
61 
62 /* data type for BTA_SDP_API_SEARCH_EVT */
63 typedef struct {
64     BT_HDR          hdr;
65     BD_ADDR         bd_addr;
66     tSDP_UUID       uuid;
67 } tBTA_SDP_API_SEARCH;
68 
69 /* data type for BTA_SDP_API_SEARCH_EVT */
70 typedef struct {
71     BT_HDR          hdr;
72     void           *user_data;
73 } tBTA_SDP_API_RECORD_USER;
74 
75 /* union of all data types */
76 typedef union {
77     /* event buffer header */
78     BT_HDR                                 hdr;
79     tBTA_SDP_API_ENABLE                    enable;
80     tBTA_SDP_API_SEARCH                    get_search;
81     tBTA_SDP_API_RECORD_USER               record;
82 } tBTA_SDP_MSG;
83 
84 /* SDP control block */
85 typedef struct {
86     UINT8              sdp_active;  /* see BTA_SDP_SDP_ACT_* */
87     BD_ADDR            remote_addr;
88     tBTA_SDP_DM_CBACK  *p_dm_cback;
89 } tBTA_SDP_CB;
90 
91 
92 /* SDP control block */
93 #if BTA_DYNAMIC_MEMORY == FALSE
94 extern tBTA_SDP_CB bta_sdp_cb;
95 #else
96 extern tBTA_SDP_CB *bta_sdp_cb_ptr;
97 #define bta_sdp_cb (*bta_sdp_cb_ptr)
98 #endif
99 
100 /* config struct */
101 extern tBTA_SDP_CFG *p_bta_sdp_cfg;
102 
103 extern BOOLEAN bta_sdp_sm_execute(BT_HDR *p_msg);
104 
105 extern void bta_sdp_enable (tBTA_SDP_MSG *p_data);
106 extern void bta_sdp_search (tBTA_SDP_MSG *p_data);
107 extern void bta_sdp_create_record(tBTA_SDP_MSG *p_data);
108 extern void bta_sdp_remove_record(tBTA_SDP_MSG *p_data);
109 extern void bta_sdp_disable(tBTA_SDP_MSG *p_data);
110 
111 #endif  ///SDP_INCLUDED == TRUE
112 
113 #endif /* BTA_SDP_INT_H */
114