Skip to content

Commit

Permalink
Merge pull request #49 from pan-/fix-privacy-backward-compatibility
Browse files Browse the repository at this point in the history
Fix privacy backward compatibility
  • Loading branch information
paul-szczepanek-arm authored May 23, 2018
2 parents 80137be + cfe325c commit f4b7f32
Show file tree
Hide file tree
Showing 21 changed files with 1,314 additions and 628 deletions.
12 changes: 3 additions & 9 deletions features/FEATURE_BLE/ble/BLE.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,7 @@ class BLE
ble_error_t setAddress(
BLEProtocol::AddressType_t type,
const BLEProtocol::AddressBytes_t address
) {
return gap().setAddress(type, address);
}
);

/**
* Fetch the Bluetooth Low Energy MAC address and type.
Expand Down Expand Up @@ -1009,9 +1007,7 @@ class BLE
ble_error_t connect(const BLEProtocol::AddressBytes_t peerAddr,
BLEProtocol::AddressType_t peerAddrType = BLEProtocol::AddressType::RANDOM_STATIC,
const Gap::ConnectionParams_t *connectionParams = NULL,
const GapScanningParams *scanParams = NULL) {
return gap().connect(peerAddr, peerAddrType, connectionParams, scanParams);
}
const GapScanningParams *scanParams = NULL);

/**
* This call initiates the disconnection procedure, and its completion is
Expand Down Expand Up @@ -1045,9 +1041,7 @@ class BLE
* connection.
*/
MBED_DEPRECATED("Use ble.gap().disconnect(...)")
ble_error_t disconnect(Gap::DisconnectionReason_t reason) {
return gap().disconnect(reason);
}
ble_error_t disconnect(Gap::DisconnectionReason_t reason);

/**
* Returns the current Gap state of the device using a bitmask that
Expand Down
20 changes: 1 addition & 19 deletions features/FEATURE_BLE/ble/BLEProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,7 @@ namespace BLEProtocol {
* on RANDOM instead. Use Gap::getRandomAddressType to retrieve the
* type of the random address.
*/
RANDOM_PRIVATE_NON_RESOLVABLE,

/**
* Random address.
*
* Use Gap::getRandomAddressType to retrieve the type of the random
* address.
*/
RANDOM,

/**
* A Public address used as a device identity address.
*/
PUBLIC_IDENTITY,

/**
* A Random static address used as a device identity address.
*/
RANDOM_STATIC_IDENTITY
RANDOM_PRIVATE_NON_RESOLVABLE
};
};

Expand Down
43 changes: 43 additions & 0 deletions features/FEATURE_BLE/ble/BLETypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,49 @@ struct att_security_requirement_t : SafeEnum<att_security_requirement_t, uint8_t
SafeEnum<att_security_requirement_t, uint8_t>(value) { }
};

/**
* Type that describes a peer device address type.
*/
struct peer_address_type_t :SafeEnum<peer_address_type_t, uint8_t> {
/** struct scoped enum wrapped by the class */
enum type {
/**
* Public device address.
*/
PUBLIC = 0,

/**
* Random address.
*
* Use Gap::getRandomAddressType to retrieve the type of the random
* address.
*/
RANDOM,

/**
* A Public address used as a device identity address.
*/
PUBLIC_IDENTITY,

/**
* A Random static address used as a device identity address.
*/
RANDOM_STATIC_IDENTITY
};

/**
* Construct a new instance of peer_address_type_t.
*/
peer_address_type_t(type value) :
SafeEnum<peer_address_type_t, uint8_t>(value) { }

/**
* Default initialization of peer_address_type_t.
*/
peer_address_type_t() :
SafeEnum<peer_address_type_t, uint8_t>(PUBLIC) { }
};

} // namespace ble

/**
Expand Down
Loading

0 comments on commit f4b7f32

Please sign in to comment.