mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Cleanup enum duplicates in gap/Types.h
parent
884d870b68
commit
78d4a9b6c8
|
@ -127,7 +127,7 @@ public:
|
|||
* @note If value in input are out of range, they will be normalized.
|
||||
*/
|
||||
AdvertisingParameters(
|
||||
advertising_type_t advType = advertising_type_t::ADV_CONNECTABLE_UNDIRECTED,
|
||||
advertising_type_t advType = advertising_type_t::CONNECTABLE_UNDIRECTED,
|
||||
adv_interval_t minInterval = adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MIN),
|
||||
adv_interval_t maxInterval = adv_interval_t(DEFAULT_ADVERTISING_INTERVAL_MAX)
|
||||
) :
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
_includeHeaderTxPower(false)
|
||||
{
|
||||
/* Min interval is slightly larger than in other modes. */
|
||||
if (_advType == advertising_type_t::ADV_NON_CONNECTABLE_UNDIRECTED) {
|
||||
if (_advType == advertising_type_t::NON_CONNECTABLE_UNDIRECTED) {
|
||||
_minInterval = adv_interval_t(std::max(_minInterval.value(), GAP_ADV_PARAMS_INTERVAL_MIN_NONCON));
|
||||
_maxInterval = adv_interval_t(std::max(_maxInterval.value(), GAP_ADV_PARAMS_INTERVAL_MIN_NONCON));
|
||||
}
|
||||
|
|
|
@ -155,38 +155,42 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
|
|||
*
|
||||
* @see Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1.
|
||||
*/
|
||||
ADV_CONNECTABLE_UNDIRECTED = 0x00,
|
||||
ADV_IND = 0x00,
|
||||
CONNECTABLE_UNDIRECTED = 0x00,
|
||||
|
||||
/**
|
||||
* Device is connectable and expects connection from a specific peer.
|
||||
* (3.75 ms or smaller Advertising Interval)
|
||||
* @see Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2.
|
||||
*/
|
||||
ADV_CONNECTABLE_DIRECTED = 0x01,
|
||||
ADV_DIRECT_IND = 0x01,
|
||||
CONNECTABLE_DIRECTED = 0x01,
|
||||
|
||||
/**
|
||||
* Device is scannable but not connectable.
|
||||
*
|
||||
* @see Vol 6, Part B, Section 2.3.1.4.
|
||||
*/
|
||||
ADV_SCANNABLE_UNDIRECTED = 0x02,
|
||||
ADV_SCAN_IND = 0x02,
|
||||
SCANNABLE_UNDIRECTED = 0x02,
|
||||
|
||||
/**
|
||||
* Device is not connectable and not scannable.
|
||||
*
|
||||
* @see Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3.
|
||||
*/
|
||||
ADV_NON_CONNECTABLE_UNDIRECTED = 0x03,
|
||||
ADV_NONCONN_IND = 0x03,
|
||||
NON_CONNECTABLE_UNDIRECTED = 0x03,
|
||||
|
||||
/**
|
||||
* Device is connectable and expects connection from a specific peer (sent at long user set intervals).
|
||||
*/
|
||||
ADV_CONNECTABLE_DIRECTED_LOW_DUTY = 0x04,
|
||||
CONNECTABLE_DIRECTED_LOW_DUTY = 0x04,
|
||||
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
// used by the PAL; naming in line with the the spec.
|
||||
ADV_IND = 0x00,
|
||||
ADV_DIRECT_IND = 0x01,
|
||||
ADV_SCAN_IND = 0x02,
|
||||
ADV_NONCONN_IND = 0x03,
|
||||
ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -329,7 +333,7 @@ public:
|
|||
*/
|
||||
bool complete() const
|
||||
{
|
||||
return data_status().value() == advertising_data_status_t::COMPLETE;
|
||||
return data_status() == advertising_data_status_t::COMPLETE;
|
||||
}
|
||||
|
||||
/** Is there more data coming.
|
||||
|
@ -338,7 +342,7 @@ public:
|
|||
*/
|
||||
bool more_data_to_come() const
|
||||
{
|
||||
return data_status().value() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
|
||||
return data_status() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
|
||||
}
|
||||
|
||||
/** Is the payload truncated.
|
||||
|
@ -347,7 +351,7 @@ public:
|
|||
*/
|
||||
bool truncated() const
|
||||
{
|
||||
return data_status().value() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
|
||||
return data_status() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -535,13 +539,11 @@ struct own_address_type_t : SafeEnum<own_address_type_t, uint8_t> {
|
|||
/**
|
||||
* Use the public device address.
|
||||
*/
|
||||
PUBLIC_ADDRESS = 0x00,
|
||||
PUBLIC = 0x00,
|
||||
|
||||
/**
|
||||
* Use the random device address.
|
||||
*/
|
||||
RANDOM_ADDRESS = 0x01,
|
||||
RANDOM = 0x01,
|
||||
|
||||
/**
|
||||
|
@ -577,10 +579,7 @@ struct target_peer_address_type_t : SafeEnum<target_peer_address_type_t, uint8_t
|
|||
/// enumeration of target_peer_address_type_t values.
|
||||
enum type {
|
||||
PUBLIC = 0x00, /**< Public Device Address or Public Identity Address. */
|
||||
PUBLIC_ADDRESS = 0x00,
|
||||
|
||||
RANDOM = 0x01, /**< Random Device Address or Random (static) Identity Address. */
|
||||
RANDOM_ADDRESS = 0x01
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -708,11 +707,6 @@ struct connection_role_t : SafeEnum<connection_role_t, uint8_t> {
|
|||
*/
|
||||
CENTRAL = 0x00,
|
||||
|
||||
/**
|
||||
* @see CENTRAL
|
||||
*/
|
||||
MASTER = 0x00,
|
||||
|
||||
/**
|
||||
* Peripheral Role.
|
||||
*
|
||||
|
@ -721,12 +715,7 @@ struct connection_role_t : SafeEnum<connection_role_t, uint8_t> {
|
|||
*
|
||||
* @note A peripheral is a broadcaster.
|
||||
*/
|
||||
PERIPHERAL = 0x01,
|
||||
|
||||
/**
|
||||
* @see PERIPHERAL
|
||||
*/
|
||||
SLAVE = 0x01
|
||||
PERIPHERAL = 0x01
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -761,25 +750,21 @@ struct local_disconnection_reason_t : SafeEnum<local_disconnection_reason_t, uin
|
|||
* GAP or GATT failed to authenticate the peer.
|
||||
*/
|
||||
AUTHENTICATION_FAILURE = 0x05,
|
||||
AUTHENTICATION_FAILLURE = 0x05,
|
||||
|
||||
/**
|
||||
* Connection terminated by the user.
|
||||
*/
|
||||
USER_TERMINATION = 0x13,
|
||||
REMOTE_USER_TERMINATED_CONNECTION = 0x13,
|
||||
|
||||
/**
|
||||
* Connection termination due to low resources.
|
||||
*/
|
||||
LOW_RESOURCES = 0x14,
|
||||
REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES = 0x14,
|
||||
|
||||
/**
|
||||
* Connection termination due to power off.
|
||||
*/
|
||||
POWER_OFF = 0x15,
|
||||
REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF = 0x15,
|
||||
|
||||
/**
|
||||
* Remote feature not supported
|
||||
|
@ -794,7 +779,6 @@ struct local_disconnection_reason_t : SafeEnum<local_disconnection_reason_t, uin
|
|||
/**
|
||||
* Connection parameters were unacceptable.
|
||||
*/
|
||||
CONN_INTERVAL_UNACCEPTABLE = 0x3B,
|
||||
UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B
|
||||
};
|
||||
|
||||
|
@ -849,7 +833,7 @@ struct disconnection_reason_t : SafeEnum<disconnection_reason_t, uint8_t> {
|
|||
/**
|
||||
* Connection parameters were unacceptable.
|
||||
*/
|
||||
CONN_INTERVAL_UNACCEPTABLE = 0x3B
|
||||
UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -158,7 +158,7 @@ struct GapConnectionCompleteEvent : public GapEvent {
|
|||
connection_handle(connection_handle),
|
||||
role(role),
|
||||
peer_address_type(
|
||||
peer_address_type == advertising_peer_address_type_t::PUBLIC_ADDRESS ?
|
||||
peer_address_type == advertising_peer_address_type_t::PUBLIC ?
|
||||
peer_address_type_t::PUBLIC :
|
||||
peer_address_type_t::RANDOM
|
||||
),
|
||||
|
|
|
@ -1097,7 +1097,7 @@ ble_error_t GenericGap::startRadioScan(const GapScanningParams &scanningParams)
|
|||
|
||||
pal::own_address_type_t own_address_type = get_own_address_type(CENTRAL_SCAN /* central, can use non resolvable address for scan requests */);
|
||||
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS)) {
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM)) {
|
||||
// Use non-resolvable static random address
|
||||
set_random_address_rotation(true);
|
||||
}
|
||||
|
@ -1227,7 +1227,7 @@ ble_error_t GenericGap::startAdvertising(const GapAdvertisingParams ¶ms)
|
|||
|
||||
pal::own_address_type_t own_address_type = get_own_address_type(address_use_type);
|
||||
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS)) {
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM)) {
|
||||
// Use non-resolvable static random address
|
||||
set_random_address_rotation(true);
|
||||
}
|
||||
|
@ -1243,7 +1243,7 @@ ble_error_t GenericGap::startAdvertising(const GapAdvertisingParams ¶ms)
|
|||
/* advertising_interval_max */ params.getIntervalInADVUnits(),
|
||||
(pal::advertising_type_t::type) params.getAdvertisingType(),
|
||||
own_address_type,
|
||||
pal::advertising_peer_address_type_t::PUBLIC_ADDRESS,
|
||||
pal::advertising_peer_address_type_t::PUBLIC,
|
||||
ble::address_t(),
|
||||
pal::advertising_channel_map_t::ALL_ADVERTISING_CHANNELS,
|
||||
_advertising_filter_policy
|
||||
|
@ -1473,7 +1473,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
bool needs_authentication = false;
|
||||
|
||||
if (_privacy_enabled &&
|
||||
e.role.value() == e.role.SLAVE &&
|
||||
e.role.value() == e.role.PERIPHERAL &&
|
||||
e.peer_address_type == peer_address_type_t::RANDOM
|
||||
) {
|
||||
// Apply privacy policy if in peripheral mode for non-resolved addresses
|
||||
|
@ -1490,7 +1490,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
// Reject connection request - the user will get notified through a callback
|
||||
_pal_gap.disconnect(
|
||||
e.connection_handle,
|
||||
pal::disconnection_reason_t::AUTHENTICATION_FAILLURE
|
||||
pal::disconnection_reason_t::AUTHENTICATION_FAILURE
|
||||
);
|
||||
return;
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
}
|
||||
}
|
||||
|
||||
if (e.role.value() == e.role.SLAVE) {
|
||||
if (e.role.value() == e.role.PERIPHERAL) {
|
||||
_advertising_timeout.detach();
|
||||
_pal_gap.advertising_enable(false);
|
||||
|
||||
|
@ -1534,7 +1534,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
|
||||
processConnectionEvent(
|
||||
e.connection_handle,
|
||||
e.role.value() == e.role.MASTER ? ::Gap::CENTRAL : ::Gap::PERIPHERAL,
|
||||
e.role.value() == e.role.CENTRAL ? ::Gap::CENTRAL : ::Gap::PERIPHERAL,
|
||||
e.peer_address_type,
|
||||
e.peer_address.data(),
|
||||
_address_type,
|
||||
|
@ -1606,7 +1606,7 @@ pal::own_address_type_t GenericGap::get_own_address_type(AddressUseType_t addres
|
|||
|
||||
// An non resolvable private address should be generated
|
||||
if (use_non_resolvable_address) {
|
||||
return pal::own_address_type_t::RANDOM_ADDRESS;
|
||||
return pal::own_address_type_t::RANDOM;
|
||||
}
|
||||
|
||||
switch (_address_type) {
|
||||
|
@ -1619,9 +1619,9 @@ pal::own_address_type_t GenericGap::get_own_address_type(AddressUseType_t addres
|
|||
|
||||
switch (_address_type) {
|
||||
case BLEProtocol::AddressType::PUBLIC:
|
||||
return pal::own_address_type_t::PUBLIC_ADDRESS;
|
||||
return pal::own_address_type_t::PUBLIC;
|
||||
default:
|
||||
return pal::own_address_type_t::RANDOM_ADDRESS;
|
||||
return pal::own_address_type_t::RANDOM;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1100,8 +1100,8 @@ void GenericSecurityManager::on_security_entry_retrieved(
|
|||
|
||||
_pal.add_device_to_resolving_list(
|
||||
identity->identity_address_is_public ?
|
||||
address_type_t::PUBLIC_ADDRESS :
|
||||
address_type_t::RANDOM_ADDRESS,
|
||||
address_type_t::PUBLIC :
|
||||
address_type_t::RANDOM,
|
||||
identity->identity_address,
|
||||
identity->irk
|
||||
);
|
||||
|
@ -1117,8 +1117,8 @@ void GenericSecurityManager::on_identity_list_retrieved(
|
|||
for (size_t i = 0; i < count; ++i) {
|
||||
_pal.add_device_to_resolving_list(
|
||||
identity_list[i].identity_address_is_public ?
|
||||
address_type_t::PUBLIC_ADDRESS :
|
||||
address_type_t::RANDOM_ADDRESS,
|
||||
address_type_t::PUBLIC :
|
||||
address_type_t::RANDOM,
|
||||
identity_list[i].identity_address,
|
||||
identity_list[i].irk
|
||||
);
|
||||
|
@ -1564,7 +1564,7 @@ void GenericSecurityManager::on_keys_distributed_bdaddr(
|
|||
|
||||
_db->set_entry_peer_bdaddr(
|
||||
cb->db_entry,
|
||||
(peer_address_type == advertising_peer_address_type_t::PUBLIC_ADDRESS),
|
||||
(peer_address_type == advertising_peer_address_type_t::PUBLIC),
|
||||
peer_identity_address
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue