mirror of https://github.com/ARMmbed/mbed-os.git
Removed set_privacy() API and added is_privacy_supported() check to PAL + Generic GAP
parent
288c3952d8
commit
1fdb57e82c
|
|
@ -649,17 +649,13 @@ struct Gap {
|
|||
disconnection_reason_t disconnection_reason
|
||||
) = 0;
|
||||
|
||||
/** Enable or disable privacy feature
|
||||
* @param enable whether to enable privacy feature
|
||||
/** Check if privacy feature is supported by implementation
|
||||
*
|
||||
* @return BLE_ERROR_NONE if the request has been successfully sent or the
|
||||
* appropriate error otherwise.
|
||||
* @return true if privacy is supported, false otherwise.
|
||||
*
|
||||
* @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature.
|
||||
*/
|
||||
virtual ble_error_t set_privacy(
|
||||
bool enable
|
||||
) = 0;
|
||||
virtual bool is_privacy_supported() = 0;
|
||||
|
||||
/** Enable or disable private addresses resolution
|
||||
*
|
||||
|
|
|
|||
|
|
@ -881,9 +881,18 @@ ble_error_t GenericGap::initRadioNotification(void)
|
|||
|
||||
ble_error_t GenericGap::enablePrivacy(bool enable)
|
||||
{
|
||||
_privacy_enabled = enable;
|
||||
if(enable == _privacy_enabled) {
|
||||
// No change
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
_pal_gap.set_privacy(enable);
|
||||
if(enable && !_pal_gap.is_privacy_supported())
|
||||
{
|
||||
// Privacy is not supported by the implementation
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
_privacy_enabled = enable;
|
||||
|
||||
update_address_resolution_setting();
|
||||
|
||||
|
|
|
|||
|
|
@ -308,13 +308,9 @@ public:
|
|||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
virtual ble_error_t set_privacy(
|
||||
bool enable
|
||||
) {
|
||||
//
|
||||
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
virtual bool is_privacy_supported() {
|
||||
// We only support controller-based privacy, so return whether the controller supports it
|
||||
return HciLlPrivacySupported();
|
||||
}
|
||||
|
||||
virtual ble_error_t set_address_resolution(
|
||||
|
|
@ -481,7 +477,6 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
address_t device_random_static_identity_address;
|
||||
address_t device_random_address;
|
||||
bool use_active_scanning;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue