1 /******************************************************************************
2  *
3  *  Copyright 2016 The Android Open Source Project
4  *  Copyright 2002-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 file contains HID DEVICE internal definitions
23  *
24  ******************************************************************************/
25 
26 #ifndef HIDD_INT_H
27 #define HIDD_INT_H
28 
29 #include "hid_conn.h"
30 #include "hidd_api.h"
31 #include "l2c_api.h"
32 
33 enum { HIDD_DEV_NO_CONN, HIDD_DEV_CONNECTED };
34 
35 typedef struct device_ctb {
36   bool in_use;
37   RawAddress addr;
38 
39   uint8_t state;
40 
41   tHID_CONN conn;
42 
43   bool boot_mode;
44 
45   uint8_t idle_time;
46 } tHID_DEV_DEV_CTB;
47 
48 typedef struct dev_ctb {
49   tHID_DEV_DEV_CTB device;
50 
51   tHID_DEV_HOST_CALLBACK* callback;
52   tL2CAP_CFG_INFO l2cap_cfg;
53   tL2CAP_CFG_INFO l2cap_intr_cfg;
54 
55   bool use_in_qos;
56   FLOW_SPEC in_qos;
57 
58   bool reg_flag;
59   uint8_t trace_level;
60 
61   bool allow_incoming;
62 
63   BT_HDR* pending_data;
64 
65   bool pending_vc_unplug;
66 } tHID_DEV_CTB;
67 
68 extern tHID_STATUS hidd_conn_reg(void);
69 extern void hidd_conn_dereg(void);
70 extern tHID_STATUS hidd_conn_initiate(void);
71 extern tHID_STATUS hidd_conn_disconnect(void);
72 extern tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type,
73                                        uint8_t param, uint8_t data,
74                                        uint16_t len, uint8_t* p_data);
75 
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 
80 /******************************************************************************
81  * Main Control Block
82  ******************************************************************************/
83 extern tHID_DEV_CTB hd_cb;
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
90