1 /******************************************************************************
2  *
3  *  Copyright (C) 2014 The Android Open Source Project
4  *  Copyright (C) 2003-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 private interface file for the BTA MCE I/F
23  *
24  ******************************************************************************/
25 #ifndef BTA_MCE_INT_H
26 #define BTA_MCE_INT_H
27 
28 #include "bta_sys.h"
29 #include "bta_api.h"
30 #include "bta_mce_api.h"
31 
32 /*****************************************************************************
33 **  Constants
34 *****************************************************************************/
35 
36 enum
37 {
38     /* these events are handled by the state machine */
39     BTA_MCE_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_MCE),
40     BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT,
41     BTA_MCE_MAX_INT_EVT
42 };
43 
44 /* data type for BTA_MCE_API_ENABLE_EVT */
45 typedef struct
46 {
47     BT_HDR             hdr;
48     tBTA_MCE_DM_CBACK  *p_cback;
49 } tBTA_MCE_API_ENABLE;
50 
51 /* data type for BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT */
52 typedef struct
53 {
54     BT_HDR   hdr;
55     BD_ADDR  bd_addr;
56 } tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES;
57 
58 /* union of all data types */
59 typedef union
60 {
61     /* GKI event buffer header */
62     BT_HDR                                 hdr;
63     tBTA_MCE_API_ENABLE                    enable;
64     tBTA_MCE_API_GET_REMOTE_MAS_INSTANCES  get_rmt_mas;
65 } tBTA_MCE_MSG;
66 
67 /* MCE control block */
68 typedef struct
69 {
70     UINT8              sdp_active;  /* see BTA_MCE_SDP_ACT_* */
71     BD_ADDR            remote_addr;
72     tBTA_MCE_DM_CBACK  *p_dm_cback;
73 } tBTA_MCE_CB;
74 
75 enum
76 {
77     BTA_MCE_SDP_ACT_NONE = 0,
78     BTA_MCE_SDP_ACT_YES       /* waiting for SDP result */
79 };
80 
81 /* MCE control block */
82 #if BTA_DYNAMIC_MEMORY == FALSE
83 extern tBTA_MCE_CB bta_mce_cb;
84 #else
85 extern tBTA_MCE_CB *bta_mce_cb_ptr;
86 #define bta_mce_cb (*bta_mce_cb_ptr)
87 #endif
88 
89 /* config struct */
90 extern tBTA_MCE_CFG *p_bta_mce_cfg;
91 
92 extern BOOLEAN bta_mce_sm_execute(BT_HDR *p_msg);
93 
94 extern void bta_mce_enable (tBTA_MCE_MSG *p_data);
95 extern void bta_mce_get_remote_mas_instances (tBTA_MCE_MSG *p_data);
96 
97 #endif /* BTA_MCE_INT_H */
98