• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <cstdint>
30 
31 #include "stack/hid/hid_conn.h"
32 #include "stack/include/hidd_api.h"
33 #include "stack/include/l2c_api.h"  // tL2CAP_CFG_INFO && FLOW_SPEC
34 #include "types/raw_address.h"
35 
36 enum { HIDD_DEV_NO_CONN, HIDD_DEV_CONNECTED };
37 
38 typedef struct device_ctb {
39   bool in_use;
40   RawAddress addr;
41 
42   uint8_t state;
43 
44   tHID_CONN conn;
45 
46   bool boot_mode;
47 
48   uint8_t idle_time;
49 } tHID_DEV_DEV_CTB;
50 
51 typedef struct dev_ctb {
52   tHID_DEV_DEV_CTB device;
53 
54   tHID_DEV_HOST_CALLBACK* callback;
55   tL2CAP_CFG_INFO l2cap_cfg;
56   tL2CAP_CFG_INFO l2cap_intr_cfg;
57 
58   bool use_in_qos;
59   FLOW_SPEC in_qos;
60 
61   bool reg_flag;
62   uint8_t trace_level;
63 
64   bool allow_incoming;
65 
66   BT_HDR* pending_data;
67 
68   bool pending_vc_unplug;
69 } tHID_DEV_CTB;
70 
71 extern tHID_STATUS hidd_conn_reg(void);
72 extern void hidd_conn_dereg(void);
73 extern tHID_STATUS hidd_conn_initiate(void);
74 extern tHID_STATUS hidd_conn_disconnect(void);
75 extern tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type,
76                                        uint8_t param, uint8_t data,
77                                        uint16_t len, uint8_t* p_data);
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 /******************************************************************************
84  * Main Control Block
85  ******************************************************************************/
86 extern tHID_DEV_CTB hd_cb;
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
93