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_LE_FEATURE_H
17 #define HCI_DEF_LE_FEATURE_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B
24 // 4.6 FEATURE SUPPORT
25 #define GET_LINK_LAYER_FEATURE_FLAG(features, bitIndex) ((features)[(bitIndex) / 8] & 0x01 << ((bitIndex) % 8))
26 
27 #define HCI_SUPPORT_CONNECTION_PARAMETERS_REQUEST_PROCEDURE(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 1)
28 #define HCI_SUPPORT_LE_PING(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 4)
29 #define HCI_SUPPORT_LE_DATA_PACKET_LENGTH_EXTENSION(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 5)
30 #define HCI_SUPPORT_LL_PRIVACY(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 6)
31 #define HCI_SUPPORT_LE_2M_PHY(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 8)
32 #define HCI_SUPPORT_LE_CODED_PHY(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 11)
33 #define HCI_SUPPORT_LE_EXTENDED_ADVERTISING(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 12)
34 #define HCI_SUPPORT_LE_PERIODIC_ADVERTISING(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 13)
35 #define HCI_SUPPURT_CHANNEL_SELECTION_ALGORITHM_2(x) !!GET_LINK_LAYER_FEATURE_FLAG(x, 14)
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif