Skip to content

Commit 24f7f36

Browse files
committed
BLE - Return supported feature based on compile time features.
1 parent 04891b2 commit 24f7f36

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

features/FEATURE_BLE/source/gap/Gap.tpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ namespace interface {
2222
template<class Impl>
2323
bool Gap<Impl>::isFeatureSupported(controller_supported_features_t feature)
2424
{
25+
#if !BLE_FEATURE_PHY_MANAGEMENT
26+
if (feature == ble::controller_supported_features_t::LE_CODED_PHY ||
27+
feature == ble::controller_supported_features_t::LE_2M_PHY
28+
) {
29+
return false;
30+
}
31+
#endif
32+
33+
#if !BLE_FEATURE_EXTENDED_ADVERTISING
34+
if (feature == ble::controller_supported_features_t::LE_EXTENDED_ADVERTISING) {
35+
return false;
36+
}
37+
#endif
38+
39+
#if !BLE_FEATURE_PERIODIC_ADVERTISING
40+
if (feature == ble::controller_supported_features_t::LE_PERIODIC_ADVERTISING) {
41+
return false;
42+
}
43+
#endif
44+
45+
#if !BLE_FEATURE_PRIVACY
46+
if (feature == ble::controller_supported_features_t::LL_PRIVACY) {
47+
return false;
48+
}
49+
#endif
50+
2551
return impl()->isFeatureSupported_(feature);
2652
}
2753

features/FEATURE_BLE/targets/TARGET_CORDIO/source/CordioPalGap.tpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,32 @@ bool Gap<EventHandler>::is_feature_supported_(
3535
ble::controller_supported_features_t feature
3636
)
3737
{
38+
#if !BLE_FEATURE_PHY_MANAGEMENT
39+
if (feature == ble::controller_supported_features_t::LE_CODED_PHY ||
40+
feature == ble::controller_supported_features_t::LE_2M_PHY
41+
) {
42+
return false;
43+
}
44+
#endif
45+
46+
#if !BLE_FEATURE_EXTENDED_ADVERTISING
47+
if (feature == ble::controller_supported_features_t::LE_EXTENDED_ADVERTISING) {
48+
return false;
49+
}
50+
#endif
51+
52+
#if !BLE_FEATURE_PERIODIC_ADVERTISING
53+
if (feature == ble::controller_supported_features_t::LE_PERIODIC_ADVERTISING) {
54+
return false;
55+
}
56+
#endif
57+
58+
#if !BLE_FEATURE_PRIVACY
59+
if (feature == ble::controller_supported_features_t::LL_PRIVACY) {
60+
return false;
61+
}
62+
#endif
63+
3864
return (HciGetLeSupFeat() & (1 << feature.value()));
3965
}
4066

0 commit comments

Comments
 (0)