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 "hid_conn.h"
29 #include "hidh_api.h"
30 #include "l2c_api.h"
31 
32 enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED };
33 
34 typedef struct per_device_ctb {
35   bool in_use;
36   RawAddress addr;    /* BD-Addr of the host device */
37   uint16_t attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03-
38                          reconn_initiate;
39                                  0x04- sdp_disable; */
40   uint8_t state;      /* Device state if in HOST-KNOWN mode */
41   uint8_t conn_substate;
42   uint8_t conn_tries; /* Remembers the number of connection attempts while
43                          CONNECTING */
44 
45   tHID_CONN conn; /* L2CAP channel info */
46 } tHID_HOST_DEV_CTB;
47 
48 typedef struct host_ctb {
49   tHID_HOST_DEV_CTB devices[HID_HOST_MAX_DEVICES];
50   tHID_HOST_DEV_CALLBACK* callback; /* Application callbacks */
51   tL2CAP_CFG_INFO l2cap_cfg;
52 
53 #define MAX_SERVICE_DB_SIZE 4000
54 
55   bool sdp_busy;
56   tHID_HOST_SDP_CALLBACK* sdp_cback;
57   tSDP_DISCOVERY_DB* p_sdp_db;
58   tHID_DEV_SDP_INFO sdp_rec;
59   bool reg_flag;
60   uint8_t trace_level;
61 } tHID_HOST_CTB;
62 
63 extern tHID_STATUS hidh_conn_snd_data(uint8_t dhandle, uint8_t trans_type,
64                                       uint8_t param, uint16_t data,
65                                       uint8_t rpt_id, BT_HDR* buf);
66 extern tHID_STATUS hidh_conn_reg(void);
67 extern void hidh_conn_dereg(void);
68 extern tHID_STATUS hidh_conn_disconnect(uint8_t dhandle);
69 extern tHID_STATUS hidh_conn_initiate(uint8_t dhandle);
70 extern void hidh_process_repage_timer_timeout(void* data);
71 extern void hidh_try_repage(uint8_t dhandle);
72 
73 /******************************************************************************
74  * Main Control Block
75  ******************************************************************************/
76 extern tHID_HOST_CTB hh_cb;
77 
78 #endif
79