bta_mce_api.h revision 24933b5b1a06274c47133debac5251a97128a267
1/******************************************************************************
2 *
3 *  Copyright (C) 2014 The Android Open Source Project
4 *  Copyright (C) 2006-2012 Broadcom Corporation
5 *
6 *  Licensed under the Apache License, Version 2.0 (the "License");
7 *  you may not use this file except in compliance with the License.
8 *  You may obtain a copy of the License at:
9 *
10 *  http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *  Unless required by applicable law or agreed to in writing, software
13 *  distributed under the License is distributed on an "AS IS" BASIS,
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *  See the License for the specific language governing permissions and
16 *  limitations under the License.
17 *
18 ******************************************************************************/
19
20/******************************************************************************
21 *
22 *  This is the public interface file the BTA MCE I/F
23 *
24 ******************************************************************************/
25#ifndef BTA_MCE_API_H
26#define BTA_MCE_API_H
27
28#include "data_types.h"
29#include "bt_target.h"
30#include "bt_types.h"
31#include "bta_api.h"
32#include "btm_api.h"
33
34/*****************************************************************************
35**  Constants and data types
36*****************************************************************************/
37/* status values */
38#define BTA_MCE_SUCCESS             0            /* Successful operation. */
39#define BTA_MCE_FAILURE             1            /* Generic failure. */
40#define BTA_MCE_BUSY                2            /* Temporarily can not handle this request. */
41
42typedef UINT8 tBTA_MCE_STATUS;
43
44/* MCE I/F callback events */
45/* events received by tBTA_MCE_DM_CBACK */
46#define BTA_MCE_ENABLE_EVT               0  /* MCE enabled */
47#define BTA_MCE_MAS_DISCOVERY_COMP_EVT   1  /* SDP MAS discovery complete */
48#define BTA_MCE_MAX_EVT                  2  /* max number of MCE events */
49
50#define BTA_MCE_MAX_MAS_INSTANCES 12
51
52typedef UINT16 tBTA_MCE_EVT;
53
54typedef struct
55{
56    UINT8   scn;
57    char    *p_srv_name;
58    UINT16  srv_name_len;
59    UINT8   instance_id;
60    UINT8   msg_type;
61} tBTA_MCE_MAS_INFO;
62
63/* data associated with BTA_MCE_MAS_DISCOVERY_COMP_EVT */
64typedef struct
65{
66    tBTA_MCE_STATUS    status;
67    BD_ADDR            remote_addr;
68    int                num_mas;
69    tBTA_MCE_MAS_INFO  mas[BTA_MCE_MAX_MAS_INSTANCES];
70} tBTA_MCE_MAS_DISCOVERY_COMP;
71
72/* union of data associated with MCE callback */
73typedef union
74{
75    tBTA_MCE_STATUS              status;         /* BTA_MCE_ENABLE_EVT */
76    tBTA_MCE_MAS_DISCOVERY_COMP  mas_disc_comp;  /* BTA_MCE_MAS_DISCOVERY_COMP_EVT */
77} tBTA_MCE;
78
79/* MCE DM Interface callback */
80typedef void (tBTA_MCE_DM_CBACK)(tBTA_MCE_EVT event, tBTA_MCE *p_data, void * user_data);
81
82/* MCE configuration structure */
83typedef struct
84{
85    UINT16  sdp_db_size;            /* The size of p_sdp_db */
86    tSDP_DISCOVERY_DB   *p_sdp_db;  /* The data buffer to keep SDP database */
87} tBTA_MCE_CFG;
88
89/*****************************************************************************
90**  External Function Declarations
91*****************************************************************************/
92#ifdef __cplusplus
93extern "C"
94{
95#endif
96
97/*******************************************************************************
98**
99** Function         BTA_MceEnable
100**
101** Description      Enable the MCE I/F service. When the enable
102**                  operation is complete the callback function will be
103**                  called with a BTA_MCE_ENABLE_EVT. This function must
104**                  be called before other functions in the MCE API are
105**                  called.
106**
107** Returns          BTA_MCE_SUCCESS if successful.
108**                  BTA_MCE_FAIL if internal failure.
109**
110*******************************************************************************/
111extern tBTA_MCE_STATUS BTA_MceEnable(tBTA_MCE_DM_CBACK *p_cback);
112
113/*******************************************************************************
114**
115** Function         BTA_MceGetRemoteMasInstances
116**
117** Description      This function performs service discovery for the MAS service
118**                  by the given peer device. When the operation is completed
119**                  the tBTA_MCE_DM_CBACK callback function will be  called with
120**                  a BTA_MCE_MAS_DISCOVERY_COMP_EVT.
121**
122** Returns          BTA_MCE_SUCCESS, if the request is being processed.
123**                  BTA_MCE_FAILURE, otherwise.
124**
125*******************************************************************************/
126extern tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(BD_ADDR bd_addr);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* BTA_MCE_API_H */
133