mirror of https://github.com/ARMmbed/mbed-os.git
GenericGap: Revert changes introduced to accomodate privacy.
parent
7f05fc0e00
commit
0eb680a08b
|
@ -316,7 +316,7 @@ static bool is_whitelist_valid(const Gap::Whitelist_t& whitelist)
|
|||
for (size_t i = 0; i < whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& address = whitelist.addresses[i];
|
||||
if (address.type != BLEProtocol::AddressType::PUBLIC &&
|
||||
address.type != BLEProtocol::AddressType::RANDOM
|
||||
address.type != BLEProtocol::AddressType::RANDOM_STATIC
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
@ -423,7 +423,6 @@ ble_error_t GenericGap::setAddress(
|
|||
_address_type = type;
|
||||
return BLE_ERROR_NONE;
|
||||
|
||||
case BLEProtocol::AddressType::RANDOM:
|
||||
case BLEProtocol::AddressType::RANDOM_STATIC: {
|
||||
if (is_random_static_address(address) == false) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
@ -436,12 +435,18 @@ ble_error_t GenericGap::setAddress(
|
|||
return err;
|
||||
}
|
||||
|
||||
_address_type = BLEProtocol::AddressType::RANDOM;
|
||||
_address_type = type;
|
||||
_address = ble::address_t(address);
|
||||
_random_static_identity_address = ble::address_t(address);
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
case BLEProtocol::AddressType::RANDOM_PRIVATE_RESOLVABLE:
|
||||
case BLEProtocol::AddressType::RANDOM_PRIVATE_NON_RESOLVABLE:
|
||||
// Note: it is not allowed to set directly these addresses
|
||||
// privacy management handled it for users.
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
||||
default:
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -454,17 +459,10 @@ ble_error_t GenericGap::getAddress(
|
|||
*type = _address_type;
|
||||
ble::address_t address_value;
|
||||
|
||||
switch (_address_type) {
|
||||
case BLEProtocol::AddressType::PUBLIC:
|
||||
address_value = _pal_gap.get_device_address();
|
||||
break;
|
||||
|
||||
case BLEProtocol::AddressType::RANDOM:
|
||||
address_value = _pal_gap.get_random_address();
|
||||
break;
|
||||
|
||||
default:
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
if (_address_type == BLEProtocol::AddressType::PUBLIC) {
|
||||
address_value = _pal_gap.get_device_address();
|
||||
} else {
|
||||
address_value = _pal_gap.get_random_address();
|
||||
}
|
||||
|
||||
memcpy(address, address_value.data(), address_value.size());
|
||||
|
|
Loading…
Reference in New Issue