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
|
disconnection_reason_t disconnection_reason
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
/** Enable or disable privacy feature
|
/** Check if privacy feature is supported by implementation
|
||||||
* @param enable whether to enable privacy feature
|
|
||||||
*
|
*
|
||||||
* @return BLE_ERROR_NONE if the request has been successfully sent or the
|
* @return true if privacy is supported, false otherwise.
|
||||||
* appropriate error otherwise.
|
|
||||||
*
|
*
|
||||||
* @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature.
|
* @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature.
|
||||||
*/
|
*/
|
||||||
virtual ble_error_t set_privacy(
|
virtual bool is_privacy_supported() = 0;
|
||||||
bool enable
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
/** Enable or disable private addresses resolution
|
/** Enable or disable private addresses resolution
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -881,9 +881,18 @@ ble_error_t GenericGap::initRadioNotification(void)
|
||||||
|
|
||||||
ble_error_t GenericGap::enablePrivacy(bool enable)
|
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();
|
update_address_resolution_setting();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -308,13 +308,9 @@ public:
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ble_error_t set_privacy(
|
virtual bool is_privacy_supported() {
|
||||||
bool enable
|
// We only support controller-based privacy, so return whether the controller supports it
|
||||||
) {
|
return HciLlPrivacySupported();
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
return BLE_ERROR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ble_error_t set_address_resolution(
|
virtual ble_error_t set_address_resolution(
|
||||||
|
|
@ -481,7 +477,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
address_t device_random_static_identity_address;
|
|
||||||
address_t device_random_address;
|
address_t device_random_address;
|
||||||
bool use_active_scanning;
|
bool use_active_scanning;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue