19 #ifndef BLE_GAP_TYPES_H 20 #define BLE_GAP_TYPES_H 22 #include "ble/common/Duration.h" 23 #include "ble/common/Bounded.h" 24 #include "ble/common/SafeEnum.h" 44 typedef Duration<uint32_t, 625, Range<0x20, 0xFFFFFF> > adv_interval_t;
53 typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF>, Value<uint16_t, 0x0000> > adv_duration_t;
62 typedef Duration<uint16_t, 10000, Range<0x00, 0xFFFF>, Value<uint16_t, 0x0000> > scan_duration_t;
70 typedef Duration<uint16_t, 1280000, Range<0x00, 0xFFFF> > scan_period_t;
77 typedef Duration<uint16_t, 625, Range<0x04, 0xFFFF> > scan_interval_t;
84 typedef Duration<uint16_t, 625, Range<0x04, 0xFFFF> > scan_window_t;
91 typedef Duration<uint16_t, 1250, Range<0x06, 0x0C80> > conn_interval_t;
100 typedef Duration<uint16_t, 10000, Range<0x0A, 0x0C80> > supervision_timeout_t;
107 typedef Duration<uint16_t, 625, Range<0, 0xFFFF> > conn_event_length_t;
115 typedef Duration<uint16_t, 10000, Range<0x0A, 0x4000> > sync_timeout_t;
122 typedef Duration<uint16_t, 1250, Range<0x06, 0xFFFF> > periodic_interval_t;
130 using resolvable_address_timeout_t = Duration<
139 typedef Bounded<uint16_t, 0, 0x01F3> slave_latency_t;
146 typedef uint8_t advertising_handle_t;
153 typedef uint16_t periodic_sync_handle_t;
161 struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
172 CONNECTABLE_UNDIRECTED = 0x00,
179 CONNECTABLE_DIRECTED = 0x01,
186 SCANNABLE_UNDIRECTED = 0x02,
193 NON_CONNECTABLE_UNDIRECTED = 0x03,
198 CONNECTABLE_DIRECTED_LOW_DUTY = 0x04,
205 CONNECTABLE_NON_SCANNABLE_UNDIRECTED = 0x05,
207 #if !defined(DOXYGEN_ONLY) 210 ADV_DIRECT_IND = 0x01,
212 ADV_NONCONN_IND = 0x03,
213 ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04,
214 ADV_NONSCAN_IND = 0x05
223 advertising_type_t(type value) : SafeEnum(value)
231 struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t> {
235 INCOMPLETE_MORE_DATA = 0x01,
236 INCOMPLETE_DATA_TRUNCATED = 0x02
244 advertising_data_status_t(type value) : SafeEnum(value)
248 #if !defined(DOXYGEN_ONLY) 253 explicit advertising_data_status_t(uint8_t raw_value) :
264 struct advertising_event_t {
274 SCANNABLE_ADVERTISING_BIT = 1,
275 DIRECTED_ADVERTISING_BIT = 2,
276 SCAN_RESPONSE_BIT = 3,
278 DATA_STATUS_INDEX = 5,
279 DATA_STATUS_MASK = 0x03
284 #if !defined(DOXYGEN_ONLY) 290 explicit advertising_event_t(uint8_t value) : value(value)
300 bool connectable()
const 302 return static_cast<bool>(value & (1 << CONNECTABLE_BIT));
309 bool scannable_advertising()
const 311 return static_cast<bool>(value & (1 << SCANNABLE_ADVERTISING_BIT));
318 bool directed_advertising()
const 320 return static_cast<bool>(value & (1 << DIRECTED_ADVERTISING_BIT));
327 bool scan_response()
const 329 return static_cast<bool>(value & (1 << SCAN_RESPONSE_BIT));
336 bool legacy_advertising()
const 338 return static_cast<bool>(value & (1 << LEGACY_PDU_BIT));
345 advertising_data_status_t data_status()
const 347 return static_cast<advertising_data_status_t::type
>(
348 (value >> DATA_STATUS_INDEX) & DATA_STATUS_MASK
356 bool complete()
const 358 return data_status() == advertising_data_status_t::COMPLETE;
365 bool more_data_to_come()
const 367 return data_status() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
374 bool truncated()
const 376 return data_status() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
386 typedef uint8_t advertising_sid_t;
390 typedef int8_t rssi_t;
399 typedef int8_t advertising_power_t;
406 struct advertising_filter_policy_t : SafeEnum<advertising_filter_policy_t, uint8_t> {
419 FILTER_SCAN_REQUESTS = 0x01,
425 FILTER_CONNECTION_REQUEST = 0x02,
431 FILTER_SCAN_AND_CONNECTION_REQUESTS = 0x03
438 advertising_filter_policy_t(type value) : SafeEnum(value)
448 struct scanning_filter_policy_t : SafeEnum<scanning_filter_policy_t, uint8_t> {
461 FILTER_ADVERTISING = 0x01,
470 NO_FILTER_INCLUDE_UNRESOLVABLE_DIRECTED = 2,
482 FILTER_ADVERTISING_INCLUDE_UNRESOLVABLE_DIRECTED = 3
490 scanning_filter_policy_t(type value) : SafeEnum(value)
498 struct initiator_filter_policy_t : SafeEnum<initiator_filter_policy_t, uint8_t> {
516 initiator_filter_policy_t(type value) : SafeEnum(value)
526 struct duplicates_filter_t : SafeEnum<duplicates_filter_t, uint8_t> {
549 duplicates_filter_t(type value) : SafeEnum(value)
558 struct own_address_type_t : SafeEnum<own_address_type_t, uint8_t> {
576 RESOLVABLE_PRIVATE_ADDRESS_PUBLIC_FALLBACK = 0x02,
583 RESOLVABLE_PRIVATE_ADDRESS_RANDOM_FALLBACK = 0x03,
590 own_address_type_t(type value) : SafeEnum(value)
597 own_address_type_t() :
598 SafeEnum<own_address_type_t, uint8_t>(PUBLIC) { }
606 struct target_peer_address_type_t : SafeEnum<target_peer_address_type_t, uint8_t> {
617 target_peer_address_type_t(type value) : SafeEnum(value)
625 struct clock_accuracy_t : SafeEnum<clock_accuracy_t, uint8_t> {
701 clock_accuracy_t(type value) : SafeEnum(value)
705 #if !defined(DOXYGEN_ONLY) 711 explicit clock_accuracy_t(uint8_t raw_value) : SafeEnum(raw_value)
725 struct connection_role_t : SafeEnum<connection_role_t, uint8_t> {
754 connection_role_t(type value) : SafeEnum(value)
758 #if !defined(DOXYGEN_ONLY) 764 explicit connection_role_t(uint8_t raw_value) : SafeEnum(raw_value)
774 struct local_disconnection_reason_t : SafeEnum<local_disconnection_reason_t, uint8_t> {
780 AUTHENTICATION_FAILURE = 0x05,
785 USER_TERMINATION = 0x13,
790 LOW_RESOURCES = 0x14,
800 UNSUPPORTED_REMOTE_FEATURE = 0x1A,
805 PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED = 0x29,
810 UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B
818 local_disconnection_reason_t(type value) : SafeEnum(value)
827 struct disconnection_reason_t : SafeEnum<disconnection_reason_t, uint8_t> {
833 AUTHENTICATION_FAILURE = 0x05,
838 CONNECTION_TIMEOUT = 0x08,
843 REMOTE_USER_TERMINATED_CONNECTION = 0x13,
848 REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14,
853 REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15,
859 LOCAL_HOST_TERMINATED_CONNECTION = 0x16,
864 UNACCEPTABLE_CONNECTION_PARAMETERS = 0x3B
872 disconnection_reason_t(type value) : SafeEnum(value)
876 #if !defined(DOXYGEN_ONLY) 884 explicit disconnection_reason_t(uint8_t value) : SafeEnum(value)
888 #endif // !defined(DOXYGEN_ONLY) 895 struct peripheral_privacy_configuration_t {
902 bool use_non_resolvable_random_address;
908 enum resolution_strategy_t {
920 REJECT_NON_RESOLVED_ADDRESS,
926 PERFORM_PAIRING_PROCEDURE,
932 PERFORM_AUTHENTICATION_PROCEDURE
939 resolution_strategy_t resolution_strategy;
948 struct central_privacy_configuration_t {
955 bool use_non_resolvable_random_address;
962 enum resolution_strategy_t {
989 resolution_strategy_t resolution_strategy;
1000 #endif //BLE_GAP_TYPES_H static const uint32_t TIME_BASE
The time base.
Entry namespace for all BLE API definitions.