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 BD_ADDR addr; /* BD-Addr of the host device */ 38 UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate; 39 0x04- sdp_disable; */ 40 UINT8 state; /* Device state if in HOST-KNOWN mode */ 41 UINT8 conn_substate; 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 void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle); 69 #ifdef __cplusplus 70 extern "C" { 71 #endif 72 73 /****************************************************************************** 74 * Main Control Block 75 ******************************************************************************/ 76 77 #if HID_DYNAMIC_MEMORY == FALSE 78 extern tHID_HOST_CTB hh_cb; 79 #else 80 extern tHID_HOST_CTB *hidh_cb_ptr; 81 #define hh_cb (*hidh_cb_ptr) 82 #endif 83 84 #ifdef __cplusplus 85 } 86 #endif 87 #endif /* HID_HOST_INCLUDED == TRUE */ 88 89 #if (HID_DEV_INCLUDED == TRUE) 90 #include "stack/hidd_api.h" 91 enum { HIDD_DEV_NO_CONN, HIDD_DEV_CONNECTED }; 92 93 typedef struct device_ctb { 94 bool in_use; 95 BD_ADDR addr; 96 uint8_t state; 97 tHID_CONN conn; 98 bool boot_mode; 99 uint8_t idle_time; 100 } tHID_DEV_DEV_CTB; 101 102 typedef struct dev_ctb { 103 tHID_DEV_DEV_CTB device; 104 tHID_DEV_HOST_CALLBACK *callback; 105 tL2CAP_CFG_INFO l2cap_cfg; 106 tL2CAP_CFG_INFO l2cap_intr_cfg; 107 bool use_in_qos; 108 FLOW_SPEC in_qos; 109 bool reg_flag; 110 uint8_t trace_level; 111 bool allow_incoming; 112 BT_HDR *pending_data; 113 bool pending_vc_unplug; 114 } tHID_DEV_CTB; 115 116 extern tHID_STATUS hidd_conn_reg(void); 117 extern void hidd_conn_dereg(void); 118 extern tHID_STATUS hidd_conn_initiate(void); 119 extern tHID_STATUS hidd_conn_disconnect(void); 120 extern tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type, uint8_t param, uint8_t data, uint16_t len, 121 uint8_t *p_data); 122 #ifdef __cplusplus 123 extern "C" { 124 #endif 125 126 /****************************************************************************** 127 * Main Control Block 128 ******************************************************************************/ 129 130 #if HID_DYNAMIC_MEMORY == FALSE 131 extern tHID_DEV_CTB hd_cb; 132 #else 133 extern tHID_DEV_CTB *hidd_cb_ptr; 134 #define hd_cb (*hidd_cb_ptr) 135 #endif 136 137 #ifdef __cplusplus 138 } 139 #endif 140 #endif /* HID_DEV_INCLUDED == TRUE */ 141 142 #endif /* BT_HID_INCLUDED == TRUE */ 143 #endif /* HID_INT_H */ 144