Skip to content

Commit d5c675e

Browse files
paul-szczepanek-armpan-
authored andcommitted
Merge pull request #6 from paul-szczepanek-arm/feature-support
support for controller features
1 parent 954f004 commit d5c675e

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

features/FEATURE_BLE/ble/pal/PalGap.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,33 @@ namespace pal {
3232
* by that layer.
3333
*/
3434
struct Gap {
35+
/** @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B - 4.6 */
36+
struct ControllerSupportedFeatures_t : SafeEnum<ControllerSupportedFeatures_t, uint8_t> {
37+
enum type {
38+
LE_ENCRYPTION = 0,
39+
CONNECTION_PARAMETERS_REQUEST_PROCEDURE,
40+
EXTENDED_REJECT_INDICATION,
41+
SLAVE_INITIATED_FEATURES_EXCHANGE,
42+
LE_PING,
43+
LE_DATA_PACKET_LENGTH_EXTENSION,
44+
LL_PRIVACY,
45+
EXTENDED_SCANNER_FILTER_POLICIES,
46+
LE_2M_PHY,
47+
STABLE_MODULATION_INDEX_TRANSMITTER,
48+
STABLE_MODULATION_INDEX_RECEIVER,
49+
LE_CODED_PHY,
50+
LE_EXTENDED_ADVERTISING,
51+
LE_PERIODIC_ADVERTISING,
52+
CHANNEL_SELECTION_ALGORITHM_2,
53+
LE_POWER_CLASS
54+
};
55+
56+
/**
57+
* Construct a new instance of ControllerSupportedFeatures_t.
58+
*/
59+
ControllerSupportedFeatures_t(type value) : SafeEnum<ControllerSupportedFeatures_t, uint8_t>(value) { }
60+
};
61+
3562
/**
3663
* Initialisation of the instance. An implementation can use this function
3764
* to initialise the subsystems needed to realize the operations of this
@@ -670,6 +697,16 @@ struct Gap {
670697
bool enable
671698
) = 0;
672699

700+
/**
701+
* Checked support for a feature in the link controller.
702+
*
703+
* @param feature feature to be checked.
704+
* @return TRUE if feature is supported.
705+
*/
706+
virtual bool is_feature_supported(
707+
ControllerSupportedFeatures_t feature
708+
) = 0;
709+
673710
/**
674711
* Register a callback which will handle Gap events.
675712
*

features/FEATURE_BLE/source/generic/GenericGap.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ GenericGap::GenericGap(
417417
_scan_timeout(),
418418
_connection_event_handler(NULL)
419419
{
420+
_pal_gap.initialize();
421+
420422
_pal_gap.when_gap_event_received(
421423
mbed::callback(this, &GenericGap::on_gap_event_received)
422424
);

features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalGap.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ namespace cordio {
1313
* Implementation of ble::pal::Gap for the Cordio stack.
1414
*/
1515
class Gap : public ::ble::pal::Gap {
16-
1716
public:
17+
virtual bool is_feature_supported(
18+
Gap::ControllerSupportedFeatures_t feature
19+
) {
20+
return (HciGetLeSupFeat() & (1 << feature.value()));
21+
}
22+
1823
virtual ble_error_t initialize() {
1924
return BLE_ERROR_NONE;
2025
}

0 commit comments

Comments
 (0)