mirror of https://github.com/ARMmbed/mbed-os.git
move feature support into user api
parent
05fb66a987
commit
09f71d278d
|
@ -44,6 +44,7 @@ void clamp(T& value, const R& min, const R& max) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BLE units, using microseconds as the common denominator */
|
||||||
typedef Duration<uint32_t, 625, Range<0x20, 0xFFFFFF> > adv_interval_t;
|
typedef Duration<uint32_t, 625, Range<0x20, 0xFFFFFF> > adv_interval_t;
|
||||||
typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF> > adv_duration_t;
|
typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF> > adv_duration_t;
|
||||||
typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF> > scan_duration_t;
|
typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF> > scan_duration_t;
|
||||||
|
@ -61,6 +62,34 @@ typedef Duration<uint32_t, 1> us_t;
|
||||||
|
|
||||||
typedef Bounded<uint16_t, 0, 0x01F3> slave_latency_t;
|
typedef Bounded<uint16_t, 0, 0x01F3> slave_latency_t;
|
||||||
|
|
||||||
|
/** Features supported by the controller.
|
||||||
|
* @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) { }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opaque reference to a connection.
|
* Opaque reference to a connection.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1768,6 +1768,15 @@ public:
|
||||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check controller support for a specific feature.
|
||||||
|
*
|
||||||
|
* @param feature Feature to check.
|
||||||
|
* @return True if feature is supported.
|
||||||
|
*/
|
||||||
|
bool IsFeatureSupported(
|
||||||
|
ble::ControllerSupportedFeatures_t feature
|
||||||
|
);
|
||||||
|
|
||||||
/* advertising */
|
/* advertising */
|
||||||
|
|
||||||
/** Return currently available number of supported advertising sets.
|
/** Return currently available number of supported advertising sets.
|
||||||
|
|
|
@ -76,6 +76,12 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~GenericGap();
|
virtual ~GenericGap();
|
||||||
|
|
||||||
|
/** @copydoc Gap::IsFeatureSupported
|
||||||
|
*/
|
||||||
|
bool IsFeatureSupported(
|
||||||
|
ble::ControllerSupportedFeatures_t feature
|
||||||
|
);
|
||||||
|
|
||||||
/** @copydoc Gap::getMaxAdvertisingSetNumber
|
/** @copydoc Gap::getMaxAdvertisingSetNumber
|
||||||
*/
|
*/
|
||||||
uint8_t getMaxAdvertisingSetNumber();
|
uint8_t getMaxAdvertisingSetNumber();
|
||||||
|
|
|
@ -33,33 +33,6 @@ namespace pal {
|
||||||
* by that layer.
|
* by that layer.
|
||||||
*/
|
*/
|
||||||
struct Gap {
|
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) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EventHandler {
|
struct EventHandler {
|
||||||
/**
|
/**
|
||||||
* @copydoc Gap::EventHandler::onReadPhy
|
* @copydoc Gap::EventHandler::onReadPhy
|
||||||
|
|
|
@ -444,6 +444,12 @@ GenericGap::~GenericGap()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GenericGap::IsFeatureSupported(
|
||||||
|
ble::ControllerSupportedFeatures_t feature
|
||||||
|
) {
|
||||||
|
return _pal_gap.is_feature_supported(feature);
|
||||||
|
}
|
||||||
|
|
||||||
ble_error_t GenericGap::setAddress(
|
ble_error_t GenericGap::setAddress(
|
||||||
LegacyAddressType_t type,
|
LegacyAddressType_t type,
|
||||||
const Address_t address
|
const Address_t address
|
||||||
|
@ -2601,8 +2607,8 @@ void GenericGap::use_non_deprecated_scan_api() const
|
||||||
|
|
||||||
bool GenericGap::is_extended_advertising_available()
|
bool GenericGap::is_extended_advertising_available()
|
||||||
{
|
{
|
||||||
return _pal_gap.is_feature_supported(
|
return IsFeatureSupported(
|
||||||
pal::Gap::ControllerSupportedFeatures_t::LE_EXTENDED_ADVERTISING
|
ble::ControllerSupportedFeatures_t::LE_EXTENDED_ADVERTISING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace cordio {
|
||||||
class Gap : public ::ble::pal::Gap {
|
class Gap : public ::ble::pal::Gap {
|
||||||
public:
|
public:
|
||||||
virtual bool is_feature_supported(
|
virtual bool is_feature_supported(
|
||||||
Gap::ControllerSupportedFeatures_t feature
|
ble::ControllerSupportedFeatures_t feature
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ble_error_t initialize();
|
virtual ble_error_t initialize();
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace vendor {
|
||||||
namespace cordio {
|
namespace cordio {
|
||||||
|
|
||||||
bool Gap::is_feature_supported(
|
bool Gap::is_feature_supported(
|
||||||
Gap::ControllerSupportedFeatures_t feature
|
ble::ControllerSupportedFeatures_t feature
|
||||||
) {
|
) {
|
||||||
return (HciGetLeSupFeat() & (1 << feature.value()));
|
return (HciGetLeSupFeat() & (1 << feature.value()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue