1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HCI_DEF_FEATURE_H 17 #define HCI_DEF_FEATURE_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part C 24 // 3.3 FEATURE MASK DEFINITION 25 #define GET_FEATURE_FLAG(feature, byteIndex, bitIndex) ((feature)[(byteIndex)] & 0x01 << (bitIndex)) 26 27 #define HCI_SUPPORT_3_SLOT_PACKETS(x) !!GET_FEATURE_FLAG(x, 0, 0) 28 #define HCI_SUPPORT_5_SLOT_PACKETS(x) !!GET_FEATURE_FLAG(x, 0, 1) 29 #define HCI_SUPPORT_ROLE_SWITCH(x) !!GET_FEATURE_FLAG(x, 0, 5) 30 #define HCI_SUPPORT_HOLD_MODE(x) !!GET_FEATURE_FLAG(x, 0, 6) 31 #define HCI_SUPPORT_SNIFF_MODE(x) !!GET_FEATURE_FLAG(x, 0, 7) 32 #define HCI_SUPPORT_SCO(x) !!GET_FEATURE_FLAG(x, 1, 3) 33 #define HCI_SUPPORT_HV2_PACKET(x) !!GET_FEATURE_FLAG(x, 1, 4) 34 #define HCI_SUPPORT_HV3_PACKET(x) !!GET_FEATURE_FLAG(x, 1, 5) 35 #define HCI_SUPPORT_EDR_ACL_2MBS_MODE(x) !!GET_FEATURE_FLAG(x, 3, 1) 36 #define HCI_SUPPORT_EDR_ACL_3MBS_MODE(x) !!GET_FEATURE_FLAG(x, 3, 2) 37 #define HCI_SUPPORT_RSSI_INQUIRY_RESPONSE(x) !!GET_FEATURE_FLAG(x, 3, 6) 38 #define HCI_SUPPORT_ESCO_EV3(x) !!GET_FEATURE_FLAG(x, 3, 7) 39 #define HCI_SUPPORT_ESCO_EV4(x) !!GET_FEATURE_FLAG(x, 4, 0) 40 #define HCI_SUPPORT_ESCO_EV5(x) !!GET_FEATURE_FLAG(x, 4, 1) 41 #define HCI_SUPPORT_BREDR(x) !GET_FEATURE_FLAG(x, 4, 5) 42 #define HCI_SUPPORT_LE(x) !!GET_FEATURE_FLAG(x, 4, 6) 43 #define HCI_SUPPORT_3_SLOT_EDR_PACKET(x) !!GET_FEATURE_FLAG(x, 4, 7) 44 #define HCI_SUPPORT_5_SLOT_EDR_PACKET(x) !!GET_FEATURE_FLAG(x, 5, 0) 45 #define HCI_SUPPORT_ESCO_2MBS(x) !!GET_FEATURE_FLAG(x, 5, 5) 46 #define HCI_SUPPORT_ESCO_3MBS(x) !!GET_FEATURE_FLAG(x, 5, 6) 47 #define HCI_SUPPORT_3SLOT_ESCO(x) !!GET_FEATURE_FLAG(x, 5, 7) 48 #define HCI_SUPPORT_EIR_INQUIRY_RESPONSE(x) !!GET_FEATURE_FLAG(x, 6, 0) 49 #define HCI_SUPPORT_SECURE_SIMPLE_PAIRING(x) !!GET_FEATURE_FLAG(x, 6, 3) 50 #define HCI_SUPPORT_NON_FLUSHABLE_PACKET_BONDARY_FLAG(x) !!GET_FEATURE_FLAG(x, 6, 6) 51 52 // Page 1 53 #define HCI_SUPPORT_SECURE_SIMPLE_PAIRING_HOST(x) !!GET_FEATURE_FLAG(x, 0, 0) 54 55 // Page 2 56 #define HCI_SUPPORT_SECURE_CONNECTIONS(x) !!GET_FEATURE_FLAG(x, 1, 0) 57 58 #ifdef __cplusplus 59 } 60 #endif 61 62 #endif