1 /****************************************************************************** 2 * 3 * Copyright (C) 2016 The Android Open Source Project 4 * Copyright (C) 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 * This file contains HID DEVICE internal definitions 22 * 23 ******************************************************************************/ 24 #ifndef HID_INT_H 25 #define HID_INT_H 26 27 #include "hid_conn.h" 28 #include "stack/l2c_api.h" 29 #if (BT_HID_INCLUDED == TRUE) 30 31 #if (HID_HOST_INCLUDED == TRUE) 32 #include "stack/hidh_api.h" 33 enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED }; 34 35 typedef struct per_device_ctb { 36 BOOLEAN in_use; 37 BOOLEAN delay_remove; 38 BD_ADDR addr; /* BD-Addr of the host device */ 39 UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate; 40 0x04- sdp_disable; */ 41 UINT8 state; /* Device state if in HOST-KNOWN mode */ 42 UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */ 43 44 tHID_CONN conn; /* L2CAP channel info */ 45 } tHID_HOST_DEV_CTB; 46 47 typedef struct host_ctb { 48 tHID_HOST_DEV_CTB devices[HID_HOST_MAX_DEVICES]; 49 tHID_HOST_DEV_CALLBACK *callback; /* Application callbacks */ 50 tL2CAP_CFG_INFO l2cap_cfg; 51 52 #define MAX_SERVICE_DB_SIZE 4000 53 54 BOOLEAN sdp_busy; 55 tHID_HOST_SDP_CALLBACK *sdp_cback; 56 tSDP_DISCOVERY_DB *p_sdp_db; 57 tHID_DEV_SDP_INFO sdp_rec; 58 BOOLEAN reg_flag; 59 UINT8 trace_level; 60 } tHID_HOST_CTB; 61 62 extern tHID_STATUS hidh_conn_snd_data(UINT8 dhandle, UINT8 trans_type, UINT8 param, \ 63 UINT16 data, UINT8 rpt_id, BT_HDR *buf); 64 extern tHID_STATUS hidh_conn_reg (void); 65 extern void hidh_conn_dereg( void ); 66 extern tHID_STATUS hidh_conn_disconnect (UINT8 dhandle); 67 extern tHID_STATUS hidh_conn_initiate (UINT8 dhandle); 68 extern BOOLEAN hidh_conn_is_orig(UINT8 dhandle); 69 extern void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle); 70 #ifdef __cplusplus 71 extern "C" { 72 #endif 73 74 /****************************************************************************** 75 * Main Control Block 76 ******************************************************************************/ 77 78 #if HID_DYNAMIC_MEMORY == FALSE 79 extern tHID_HOST_CTB hh_cb; 80 #else 81 extern tHID_HOST_CTB *hidh_cb_ptr; 82 #define hh_cb (*hidh_cb_ptr) 83 #endif 84 85 #ifdef __cplusplus 86 } 87 #endif 88 #endif /* HID_HOST_INCLUDED == TRUE */ 89 90 #if (HID_DEV_INCLUDED == TRUE) 91 #include "stack/hidd_api.h" 92 enum { HIDD_DEV_NO_CONN, HIDD_DEV_CONNECTED }; 93 94 typedef struct device_ctb { 95 bool in_use; 96 BD_ADDR addr; 97 uint8_t state; 98 tHID_CONN conn; 99 bool boot_mode; 100 uint8_t idle_time; 101 } tHID_DEV_DEV_CTB; 102 103 typedef struct dev_ctb { 104 tHID_DEV_DEV_CTB device; 105 tHID_DEV_HOST_CALLBACK *callback; 106 tL2CAP_CFG_INFO l2cap_cfg; 107 tL2CAP_CFG_INFO l2cap_intr_cfg; 108 bool use_in_qos; 109 FLOW_SPEC in_qos; 110 bool reg_flag; 111 uint8_t trace_level; 112 bool allow_incoming; 113 BT_HDR *pending_data; 114 bool pending_vc_unplug; 115 } tHID_DEV_CTB; 116 117 extern tHID_STATUS hidd_conn_reg(void); 118 extern void hidd_conn_dereg(void); 119 extern tHID_STATUS hidd_conn_initiate(void); 120 extern tHID_STATUS hidd_conn_disconnect(void); 121 extern tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type, uint8_t param, uint8_t data, uint16_t len, 122 uint8_t *p_data); 123 #ifdef __cplusplus 124 extern "C" { 125 #endif 126 127 /****************************************************************************** 128 * Main Control Block 129 ******************************************************************************/ 130 131 #if HID_DYNAMIC_MEMORY == FALSE 132 extern tHID_DEV_CTB hd_cb; 133 #else 134 extern tHID_DEV_CTB *hidd_cb_ptr; 135 #define hd_cb (*hidd_cb_ptr) 136 #endif 137 138 #ifdef __cplusplus 139 } 140 #endif 141 #endif /* HID_DEV_INCLUDED == TRUE */ 142 143 #endif /* BT_HID_INCLUDED == TRUE */ 144 #endif /* HID_INT_H */ 145