1 /******************************************************************************
2  *
3  *  Copyright (C) 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 "hidh_api.h"
29 #include "hid_conn.h"
30 #include "l2c_api.h"
31 
32 enum {
33     HID_DEV_NO_CONN,
34     HID_DEV_CONNECTED
35 };
36 
37 typedef struct per_device_ctb
38 {
39     BOOLEAN        in_use;
40     BD_ADDR        addr;  /* BD-Addr of the host device */
41     UINT16         attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
42     			                 0x04- sdp_disable; */
43     UINT8          state;  /* Device state if in HOST-KNOWN mode */
44     UINT8          conn_substate;
45     UINT8          conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
46 
47     tHID_CONN      conn; /* L2CAP channel info */
48 } tHID_HOST_DEV_CTB;
49 
50 typedef struct host_ctb
51 {
52     tHID_HOST_DEV_CTB       devices[HID_HOST_MAX_DEVICES];
53     tHID_HOST_DEV_CALLBACK  *callback;             /* Application callbacks */
54     tL2CAP_CFG_INFO         l2cap_cfg;
55 
56 #define MAX_SERVICE_DB_SIZE    4000
57 
58     BOOLEAN                 sdp_busy;
59     tHID_HOST_SDP_CALLBACK  *sdp_cback;
60     tSDP_DISCOVERY_DB       *p_sdp_db;
61     tHID_DEV_SDP_INFO       sdp_rec;
62     BOOLEAN                 reg_flag;
63     UINT8                   trace_level;
64 } tHID_HOST_CTB;
65 
66 extern tHID_STATUS hidh_conn_snd_data(UINT8 dhandle, UINT8 trans_type, UINT8 param, \
67                                       UINT16 data,UINT8 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 dhandle);
71 extern tHID_STATUS hidh_conn_initiate (UINT8 dhandle);
72 extern void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle);
73 
74 #ifdef __cplusplus
75 extern "C"
76 {
77 #endif
78 
79 /******************************************************************************
80 ** Main Control Block
81 *******************************************************************************/
82 #if HID_DYNAMIC_MEMORY == FALSE
83 extern tHID_HOST_CTB  hh_cb;
84 #else
85 extern tHID_HOST_CTB *hidh_cb_ptr;
86 #define hh_cb (*hidh_cb_ptr)
87 #endif
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif
94