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