Merge pull request #6 from paul-szczepanek-arm/feature-support

support for controller features
pull/7899/head
Paul Szczepanek 2018-08-23 11:26:27 +01:00 committed by Vincent Coubard
parent 954f004d16
commit d5c675e300
3 changed files with 45 additions and 1 deletions

View File

@ -32,6 +32,33 @@ namespace pal {
* by that layer.
*/
struct Gap {
/** @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B - 4.6 */
struct ControllerSupportedFeatures_t : SafeEnum<ControllerSupportedFeatures_t, uint8_t> {
enum type {
LE_ENCRYPTION = 0,
CONNECTION_PARAMETERS_REQUEST_PROCEDURE,
EXTENDED_REJECT_INDICATION,
SLAVE_INITIATED_FEATURES_EXCHANGE,
LE_PING,
LE_DATA_PACKET_LENGTH_EXTENSION,
LL_PRIVACY,
EXTENDED_SCANNER_FILTER_POLICIES,
LE_2M_PHY,
STABLE_MODULATION_INDEX_TRANSMITTER,
STABLE_MODULATION_INDEX_RECEIVER,
LE_CODED_PHY,
LE_EXTENDED_ADVERTISING,
LE_PERIODIC_ADVERTISING,
CHANNEL_SELECTION_ALGORITHM_2,
LE_POWER_CLASS
};
/**
* Construct a new instance of ControllerSupportedFeatures_t.
*/
ControllerSupportedFeatures_t(type value) : SafeEnum<ControllerSupportedFeatures_t, uint8_t>(value) { }
};
/**
* Initialisation of the instance. An implementation can use this function
* to initialise the subsystems needed to realize the operations of this
@ -670,6 +697,16 @@ struct Gap {
bool enable
) = 0;
/**
* Checked support for a feature in the link controller.
*
* @param feature feature to be checked.
* @return TRUE if feature is supported.
*/
virtual bool is_feature_supported(
ControllerSupportedFeatures_t feature
) = 0;
/**
* Register a callback which will handle Gap events.
*

View File

@ -417,6 +417,8 @@ GenericGap::GenericGap(
_scan_timeout(),
_connection_event_handler(NULL)
{
_pal_gap.initialize();
_pal_gap.when_gap_event_received(
mbed::callback(this, &GenericGap::on_gap_event_received)
);

View File

@ -13,8 +13,13 @@ namespace cordio {
* Implementation of ble::pal::Gap for the Cordio stack.
*/
class Gap : public ::ble::pal::Gap {
public:
virtual bool is_feature_supported(
Gap::ControllerSupportedFeatures_t feature
) {
return (HciGetLeSupFeat() & (1 << feature.value()));
}
virtual ble_error_t initialize() {
return BLE_ERROR_NONE;
}