diff --git a/features/FEATURE_BLE/ble/pal/PalGap.h b/features/FEATURE_BLE/ble/pal/PalGap.h index 8168f9404d..5f7865d8f2 100644 --- a/features/FEATURE_BLE/ble/pal/PalGap.h +++ b/features/FEATURE_BLE/ble/pal/PalGap.h @@ -649,6 +649,18 @@ struct Gap { disconnection_reason_t disconnection_reason ) = 0; + /** Enable or disable privacy feature + * @param enable whether to enable privacy feature + * + * @return BLE_ERROR_NONE if the request has been successfully sent or the + * appropriate error otherwise. + * + * @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature. + */ + virtual ble_error_t set_privacy( + bool enable + ) = 0; + /** Enable or disable private addresses resolution * * @param enable whether to enable private addresses resolution diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalGap.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalGap.h index 7a586add9f..cc6cdce54b 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalGap.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/CordioPalGap.h @@ -308,6 +308,17 @@ public: return BLE_ERROR_NONE; } + virtual ble_error_t set_privacy( + bool enable + ) { + if(enable) { + DmDevPrivStart(15 * 60); // Use 15 minutes renewal timer as mandated by the BLE Spec + } else { + DmDevPrivStop(); + } + return BLE_ERROR_NONE; + } + virtual ble_error_t set_address_resolution( bool enable ) {