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 connection internal definitions 22 * 23 ******************************************************************************/ 24 25 #ifndef HID_CONN_H 26 #define HID_CONN_H 27 28 #include "osi/include/alarm.h" 29 30 typedef enum : uint8_t { 31 HID_CONN_STATE_UNUSED = 0, 32 HID_CONN_STATE_CONNECTING_CTRL = 1, 33 HID_CONN_STATE_CONNECTING_INTR = 2, 34 HID_CONN_STATE_CONFIG = 3, 35 HID_CONN_STATE_CONNECTED = 4, 36 HID_CONN_STATE_DISCONNECTING = 5, 37 HID_CONN_STATE_SECURITY = 6, 38 } tHID_CONN_STATE; 39 40 /* Define the HID Connection Block 41 */ 42 typedef struct hid_conn { 43 tHID_CONN_STATE conn_state; 44 45 #define CASE_RETURN_TEXT(code) \ 46 case code: \ 47 return #code 48 state_texthid_conn49 static inline std::string state_text(const tHID_CONN_STATE& state) { 50 switch (state) { 51 CASE_RETURN_TEXT(HID_CONN_STATE_UNUSED); 52 CASE_RETURN_TEXT(HID_CONN_STATE_CONNECTING_CTRL); 53 CASE_RETURN_TEXT(HID_CONN_STATE_CONNECTING_INTR); 54 CASE_RETURN_TEXT(HID_CONN_STATE_CONFIG); 55 CASE_RETURN_TEXT(HID_CONN_STATE_CONNECTED); 56 CASE_RETURN_TEXT(HID_CONN_STATE_DISCONNECTING); 57 CASE_RETURN_TEXT(HID_CONN_STATE_SECURITY); 58 default: 59 return std::string("UNKNOWN[%hhu]", state); 60 } 61 } 62 #undef CASE_RETURN_TEXT 63 64 #define HID_CONN_FLAGS_IS_ORIG (0x01) 65 #define HID_CONN_FLAGS_CONGESTED (0x20) 66 #define HID_CONN_FLAGS_INACTIVE (0x40) 67 68 uint8_t conn_flags; 69 70 uint16_t ctrl_cid; 71 uint16_t intr_cid; 72 uint16_t rem_mtu_size; 73 uint16_t disc_reason; /* Reason for disconnecting (for HID_HDEV_EVT_CLOSE) */ 74 alarm_t* process_repage_timer; 75 } tHID_CONN; 76 77 #define HID_SEC_CHN 1 78 #define HID_NOSEC_CHN 2 79 80 #define HIDD_SEC_CHN 3 81 82 #endif 83