blob: 5beb8f6e85c8671353b360f11c1e130e802ed5f5 [file] [log] [blame]
Kim Schulz8372aa52015-03-25 10:39:40 +01001/******************************************************************************
2 *
3 * Copyright (C) 2015 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 * This is the public interface file for the BTA SDP I/F
22 *
23 ******************************************************************************/
24#ifndef BTA_SDP_API_H
25#define BTA_SDP_API_H
26
27#include <hardware/bt_sdp.h>
28#include "bt_target.h"
29#include "bt_types.h"
30#include "bta_api.h"
31#include "btm_api.h"
32
Bryce Lee3d6accf2016-05-10 17:10:09 -070033#ifdef __cplusplus
34extern "C" {
35#endif
36
Kim Schulz8372aa52015-03-25 10:39:40 +010037/* status values */
38#define BTA_SDP_SUCCESS 0 /* Successful operation. */
39#define BTA_SDP_FAILURE 1 /* Generic failure. */
40#define BTA_SDP_BUSY 2 /* Temporarily can not handle this request. */
41
42typedef UINT8 tBTA_SDP_STATUS;
43
44/* SDP I/F callback events */
45/* events received by tBTA_SDP_DM_CBACK */
46#define BTA_SDP_ENABLE_EVT 0 /* SDP service i/f enabled*/
47#define BTA_SDP_SEARCH_EVT 1 /* SDP Service started */
48#define BTA_SDP_SEARCH_COMP_EVT 2 /* SDP search complete */
49#define BTA_SDP_CREATE_RECORD_USER_EVT 3 /* SDP search complete */
50#define BTA_SDP_REMOVE_RECORD_USER_EVT 4 /* SDP search complete */
51#define BTA_SDP_MAX_EVT 5 /* max number of SDP events */
52
53#define BTA_SDP_MAX_RECORDS 15
54
55typedef UINT16 tBTA_SDP_EVT;
56
57/* data associated with BTA_SDP_DISCOVERY_COMP_EVT */
58typedef struct
59{
60 tBTA_SDP_STATUS status;
61 BD_ADDR remote_addr;
62 tBT_UUID uuid;
63 int record_count;
64 bluetooth_sdp_record records[BTA_SDP_MAX_RECORDS];
65} tBTA_SDP_SEARCH_COMP;
66
67typedef union
68{
69 tBTA_SDP_STATUS status; /* BTA_SDP_SEARCH_EVT */
70 tBTA_SDP_SEARCH_COMP sdp_search_comp; /* BTA_SDP_SEARCH_COMP_EVT */
71} tBTA_SDP;
72
73/* SDP DM Interface callback */
74typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void * user_data);
75
76/* MCE configuration structure */
77typedef struct
78{
79 UINT16 sdp_db_size; /* The size of p_sdp_db */
80 tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
81} tBTA_SDP_CFG;
82
Kim Schulz8372aa52015-03-25 10:39:40 +010083/*******************************************************************************
84**
85** Function BTA_SdpEnable
86**
87** Description Enable the SDP I/F service. When the enable
88** operation is complete the callback function will be
89** called with a BTA_SDP_ENABLE_EVT. This function must
90** be called before other functions in the MCE API are
91** called.
92**
93** Returns BTA_SDP_SUCCESS if successful.
94** BTA_SDP_FAIL if internal failure.
95**
96*******************************************************************************/
97extern tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK *p_cback);
98
99/*******************************************************************************
100**
101** Function BTA_SdpSearch
102**
103** Description Start a search for sdp records for a specific BD_ADDR with a
104** specific profile uuid.
105** When the search operation is completed, the callback function
106** will be called with a BTA_SDP_SEARCH_EVT.
107** Returns BTA_SDP_SUCCESS if successful.
108** BTA_SDP_FAIL if internal failure.
109**
110*******************************************************************************/
111extern tBTA_SDP_STATUS BTA_SdpSearch(BD_ADDR bd_addr,tSDP_UUID *uuid);
112
113/*******************************************************************************
114**
115** Function BTA_SdpCreateRecordByUser
116**
117** Description This function is used to request a callback to create a SDP
118** record. The registered callback will be called with event
119** BTA_SDP_CREATE_RECORD_USER_EVT.
120**
121** Returns BTA_SDP_SUCCESS, if the request is being processed.
122** BTA_SDP_FAILURE, otherwise.
123**
124*******************************************************************************/
125extern tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void* user_data);
126
127/*******************************************************************************
128**
129** Function BTA_SdpRemoveRecordByUser
130**
131** Description This function is used to request a callback to remove a SDP
132** record. The registered callback will be called with event
133** BTA_SDP_REMOVE_RECORD_USER_EVT.
134**
135** Returns BTA_SDP_SUCCESS, if the request is being processed.
136** BTA_SDP_FAILURE, otherwise.
137**
138*******************************************************************************/
139extern tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void* user_data);
140
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* BTA_SDP_API_H */