File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -649,17 +649,13 @@ struct Gap {
649
649
disconnection_reason_t disconnection_reason
650
650
) = 0;
651
651
652
- /* * Enable or disable privacy feature
653
- * @param enable whether to enable privacy feature
652
+ /* * Check if privacy feature is supported by implementation
654
653
*
655
- * @return BLE_ERROR_NONE if the request has been successfully sent or the
656
- * appropriate error otherwise.
654
+ * @return true if privacy is supported, false otherwise.
657
655
*
658
656
* @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature.
659
657
*/
660
- virtual ble_error_t set_privacy (
661
- bool enable
662
- ) = 0;
658
+ virtual bool is_privacy_supported () = 0;
663
659
664
660
/* * Enable or disable private addresses resolution
665
661
*
Original file line number Diff line number Diff line change @@ -881,9 +881,18 @@ ble_error_t GenericGap::initRadioNotification(void)
881
881
882
882
ble_error_t GenericGap::enablePrivacy (bool enable)
883
883
{
884
- _privacy_enabled = enable;
884
+ if (enable == _privacy_enabled) {
885
+ // No change
886
+ return BLE_ERROR_NONE;
887
+ }
888
+
889
+ if (enable && !_pal_gap.is_privacy_supported ())
890
+ {
891
+ // Privacy is not supported by the implementation
892
+ return BLE_ERROR_NOT_IMPLEMENTED;
893
+ }
885
894
886
- _pal_gap. set_privacy ( enable) ;
895
+ _privacy_enabled = enable;
887
896
888
897
update_address_resolution_setting ();
889
898
Original file line number Diff line number Diff line change @@ -308,13 +308,9 @@ class Gap : public ::ble::pal::Gap {
308
308
return BLE_ERROR_NONE;
309
309
}
310
310
311
- virtual ble_error_t set_privacy (
312
- bool enable
313
- ) {
314
- //
315
-
316
-
317
- return BLE_ERROR_NONE;
311
+ virtual bool is_privacy_supported () {
312
+ // We only support controller-based privacy, so return whether the controller supports it
313
+ return HciLlPrivacySupported ();
318
314
}
319
315
320
316
virtual ble_error_t set_address_resolution (
@@ -481,7 +477,6 @@ class Gap : public ::ble::pal::Gap {
481
477
};
482
478
483
479
private:
484
- address_t device_random_static_identity_address;
485
480
address_t device_random_address;
486
481
bool use_active_scanning;
487
482
};
You can’t perform that action at this time.
0 commit comments