1 /******************************************************************************
2  *
3  *  Copyright 2002-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This file contains HID HOST internal definitions
22  *
23  ******************************************************************************/
24 
25 #ifndef HIDH_INT_H
26 #define HIDH_INT_H
27 
28 #include <cstdint>
29 
30 #include "stack/hid/hid_conn.h"
31 #include "stack/include/hidh_api.h"
32 #include "stack/include/l2c_api.h"  // tL2CAP_CFG_INFO
33 #include "types/raw_address.h"
34 
35 enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED };
36 
37 typedef struct per_device_ctb {
38   bool in_use;
39   RawAddress addr;    /* BD-Addr of the host device */
40   uint16_t attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03-
41                          reconn_initiate;
42                                  0x04- sdp_disable; */
43   uint8_t state;      /* Device state if in HOST-KNOWN mode */
44   uint8_t conn_tries; /* Remembers the number of connection attempts while
45                          CONNECTING */
46 
47   tHID_CONN conn; /* L2CAP channel info */
48 } tHID_HOST_DEV_CTB;
49 
50 typedef struct host_ctb {
51   tHID_HOST_DEV_CTB devices[HID_HOST_MAX_DEVICES];
52   tHID_HOST_DEV_CALLBACK* callback; /* Application callbacks */
53   tL2CAP_CFG_INFO l2cap_cfg;
54 
55 #define MAX_SERVICE_DB_SIZE 4000
56 
57   bool sdp_busy;
58   tHID_HOST_SDP_CALLBACK* sdp_cback;
59   tSDP_DISCOVERY_DB* p_sdp_db;
60   tHID_DEV_SDP_INFO sdp_rec;
61   bool reg_flag;
62   uint8_t trace_level;
63 } tHID_HOST_CTB;
64 
65 extern tHID_STATUS hidh_conn_snd_data(uint8_t dhandle, uint8_t trans_type,
66                                       uint8_t param, uint16_t data,
67                                       uint8_t rpt_id, BT_HDR* buf);
68 extern tHID_STATUS hidh_conn_reg(void);
69 extern void hidh_conn_dereg(void);
70 extern tHID_STATUS hidh_conn_disconnect(uint8_t dhandle);
71 extern tHID_STATUS hidh_conn_initiate(uint8_t dhandle);
72 
73 /******************************************************************************
74  * Main Control Block
75  ******************************************************************************/
76 extern tHID_HOST_CTB hh_cb;
77 
78 #endif
79