19#ifndef BLE_GAP_EVENTS_H
20#define BLE_GAP_EVENTS_H
22#include "ble/common/blecommon.h"
23#include "ble/common/BLETypes.h"
41#if !defined(DOXYGEN_ONLY)
59 const advertising_event_t &type,
62 const phy_t &primaryPhy,
63 const phy_t &secondaryPhy,
64 advertising_sid_t SID,
65 advertising_power_t txPower,
67 uint16_t periodicInterval,
72 peerAddress(peerAddress),
74 peerAddressType(peerAddressType),
75 primaryPhy(primaryPhy),
76 secondaryPhy(secondaryPhy),
79 periodicInterval(periodicInterval),
81 directAddressType(directAddressType),
82 directAddress(directAddress),
83 advertisingData(advertisingData)
89 const advertising_event_t &
getType()
const
97 return peerAddressType;
138 return periodicInterval != 0;
144 return periodic_interval_t(periodicInterval);
150 return directAddressType;
156 return directAddress;
162 return advertisingData;
170 peerAddress = newPeerAddress;
179 peerAddressType = newPeerAddressType;
187 advertisingData = newAdvertisingData;
192 advertising_event_t type;
196 advertising_sid_t SID;
197 advertising_power_t txPower;
198 uint16_t periodicInterval;
212#if !defined(DOXYGEN_ONLY)
231 connection_role_t ownRole,
234 const address_t &localResolvablePrivateAddress,
235 const address_t &peerResolvablePrivateAddress,
236 conn_interval_t connectionInterval,
237 slave_latency_t connectionLatency,
238 supervision_timeout_t supervisionTimeout,
239 uint16_t masterClockAccuracy
242 connectionHandle(connectionHandle),
243 peerAddress(peerAddress),
245 peerAddressType(peerAddressType),
246 localResolvablePrivateAddress(localResolvablePrivateAddress),
247 connectionInterval(connectionInterval),
248 peerResolvablePrivateAddress(peerResolvablePrivateAddress),
249 connectionLatency(connectionLatency),
250 supervisionTimeout(supervisionTimeout),
251 masterClockAccuracy(masterClockAccuracy)
266 return connectionHandle;
278 return peerAddressType;
290 return localResolvablePrivateAddress;
296 return peerResolvablePrivateAddress;
302 return connectionInterval;
308 return connectionLatency;
314 return supervisionTimeout;
320 return masterClockAccuracy;
333 peerAddressType = address_type;
339 peerAddress = address;
345 localResolvablePrivateAddress = address;
351 peerResolvablePrivateAddress = address;
358 connection_role_t ownRole;
361 conn_interval_t connectionInterval;
363 slave_latency_t connectionLatency;
364 supervision_timeout_t supervisionTimeout;
365 uint16_t masterClockAccuracy;
374#if !defined(DOXYGEN_ONLY)
389 periodic_sync_handle_t syncHandle,
390 advertising_sid_t sid,
393 const phy_t &peerPhy,
394 uint16_t advertisingInterval,
395 const clock_accuracy_t &peerClockAccuracy
398 syncHandle(syncHandle),
400 peerAddressType(peerAddressType),
401 peerAddress(peerAddress),
403 advertisingInterval(advertisingInterval),
404 peerClockAccuracy(peerClockAccuracy)
431 return peerAddressType;
449 return advertisingInterval;
455 return peerClockAccuracy;
460 periodic_sync_handle_t syncHandle;
461 advertising_sid_t sid;
465 uint16_t advertisingInterval;
466 clock_accuracy_t peerClockAccuracy;
475#if !defined(DOXYGEN_ONLY)
486 periodic_sync_handle_t syncHandle,
487 advertising_power_t txPower,
489 advertising_data_status_t dataStatus,
492 syncHandle(syncHandle),
495 dataStatus(dataStatus),
533 periodic_sync_handle_t syncHandle;
534 advertising_power_t txPower;
536 advertising_data_status_t dataStatus;
546#if !defined(DOXYGEN_ONLY)
553 periodic_sync_handle_t syncHandle
555 syncHandle(syncHandle)
568 periodic_sync_handle_t syncHandle;
584#if !defined(DOXYGEN_ONLY)
592 advHandle(advHandle), status(status)
611 advertising_handle_t advHandle;
625#if !defined(DOXYGEN_ONLY)
641 advertising_handle_t advHandle,
643 uint8_t completed_events,
647 advHandle(advHandle),
648 connection(connection),
649 completed_events(completed_events),
650 connected(connected),
659 advHandle(LEGACY_ADVERTISING_HANDLE),
685 return completed_events;
712 advertising_handle_t advHandle;
714 uint8_t completed_events;
726#if !defined(DOXYGEN_ONLY)
735 advertising_handle_t advHandle,
739 advHandle(advHandle),
740 peerAddressType(peerAddressType),
741 peerAddress(peerAddress)
756 return peerAddressType;
766 advertising_handle_t advHandle;
777#if !defined(DOXYGEN_ONLY)
781 const disconnection_reason_t &reason
783 connectionHandle(connectionHandle), reason(reason)
794 return connectionHandle;
807 ble::disconnection_reason_t reason;
816#if !defined(DOXYGEN_ONLY)
820 const conn_interval_t &minConnectionInterval,
821 const conn_interval_t &maxConnectionInterval,
822 const slave_latency_t &slaveLatency,
823 const supervision_timeout_t &supervision_timeout
825 connectionHandle(connectionHandle),
826 minConnectionInterval(minConnectionInterval),
827 maxConnectionInterval(maxConnectionInterval),
828 slaveLatency(slaveLatency),
829 supervisionTimeout(supervision_timeout)
840 return connectionHandle;
848 return minConnectionInterval;
856 return maxConnectionInterval;
872 return supervisionTimeout;
877 ble::conn_interval_t minConnectionInterval;
878 ble::conn_interval_t maxConnectionInterval;
879 ble::slave_latency_t slaveLatency;
880 ble::supervision_timeout_t supervisionTimeout;
889#if !defined(DOXYGEN_ONLY)
894 const conn_interval_t &connectionInterval,
895 const slave_latency_t &slaveLatency,
896 const supervision_timeout_t &supervisionTimeout
899 connectionHandle(connectionHandle),
900 connectionInterval(connectionInterval),
901 slaveLatency(slaveLatency),
902 supervisionTimeout(supervisionTimeout)
922 return connectionHandle;
930 return connectionInterval;
946 return supervisionTimeout;
952 ble::conn_interval_t connectionInterval;
953 ble::slave_latency_t slaveLatency;
954 ble::supervision_timeout_t supervisionTimeout;
ble_error_t
Error codes for the BLE API.
@ BLE_ERROR_NONE
No error.
Entry namespace for all BLE API definitions.
uintptr_t connection_handle_t
Opaque reference to a connection.
Event produced when advertising ends.
connection_handle_t getConnection() const
Get connection handle (valid only if connected successfully).
ble_error_t getStatus() const
Get the result of the stop advertising event.
bool isConnected() const
Has the advertising ended with a connection.
advertising_handle_t getAdvHandle() const
Get advertising handle.
bool isLegacy() const
Is the end of legacy advertising.
uint8_t getCompleted_events() const
Get how many events advertising created.
Event generated when an advertising packet is seen during passive scanning or a scan response is rece...
const advertising_event_t & getType() const
Get event type.
const peer_address_type_t & getPeerAddressType() const
Get peer address type.
advertising_power_t getTxPower() const
Get TX power.
void setPeerAddressType(const peer_address_type_t &newPeerAddressType)
Set peer address type.
const phy_t & getSecondaryPhy() const
Get secondary PHY.
advertising_sid_t getSID() const
Get advertising set identifier.
void setAdvertisingData(const mbed::Span< const uint8_t > &newAdvertisingData)
Set new advertising payload.
const address_t & getDirectAddress() const
Get target address in directed advertising.
const mbed::Span< const uint8_t > & getPayload() const
Get payload.
bool isPeriodicIntervalPresent() const
Indicate if periodic interval is valid.
const address_t & getPeerAddress() const
Get peer address.
rssi_t getRssi() const
Get received signal strength.
const phy_t & getPrimaryPhy() const
Get primary PHY.
void setPeerAddress(const address_t &newPeerAddress)
Set peer address.
const peer_address_type_t & getDirectAddressType() const
Get target address type in directed advertising.
periodic_interval_t getPeriodicInterval() const
Get interval.
Event produced when advertising start.
ble_error_t getStatus() const
Get status of operation.
advertising_handle_t getAdvHandle() const
Get advertising handle.
Event generated when a connection initiation ends (successfully or not).
void setLocalResolvablePrivateAddress(const address_t &address)
Set get local resolvable random address if privacy is used.
const peer_address_type_t & getPeerAddressType() const
Get peer address type.
uint16_t getMasterClockAccuracy() const
Get clock accuracy in parts per million.
connection_role_t getOwnRole() const
Get own role.
conn_interval_t getConnectionInterval() const
Get connection interval.
const address_t & getLocalResolvablePrivateAddress() const
Get get local resolvable random address if privacy is used.
connection_handle_t getConnectionHandle() const
Get connection handle (valid only when successful).
ble_error_t getStatus() const
Get connection complete event status.
void setPeerResolvablePrivateAddress(const address_t &address)
Set peer resolvable private address if privacy is used.
const address_t & getPeerAddress() const
Get peer address.
const address_t & getPeerResolvablePrivateAddress() const
Get peer resolvable private address if privacy is used.
void setStatus(ble_error_t new_status)
Set connection complete event status.
void setPeerAddress(const address_t &address)
Set peer address.
void setPeerAddressType(const peer_address_type_t &address_type)
Set peer address type.
slave_latency_t getConnectionLatency() const
Get connection latency.
supervision_timeout_t getSupervisionTimeout() const
Get supervision timeout.
Event received when connection parameters have been updated.
const slave_latency_t & getSlaveLatency() const
Get the new slave latency.
const supervision_timeout_t & getSupervisionTimeout() const
Get the new supervision timeout.
connection_handle_t getConnectionHandle() const
Get the handle of the connection that has been updated.
ble_error_t getStatus() const
Get the status of the operation.
const conn_interval_t & getConnectionInterval() const
Get the new connection interval.
Event produced when a disconnection is complete.
const disconnection_reason_t & getReason() const
Get the reason of the disconnection.
connection_handle_t getConnectionHandle() const
Get the handle of the connection that has expired.
Event generated when periodic advertising packet is received.
advertising_power_t getTxPower() const
Get TX power as reported by the advertising packet.
periodic_sync_handle_t getSyncHandle() const
Get periodic advertising sync handle.
const mbed::Span< const uint8_t > & getPayload() const
Get payload.
rssi_t getRssi() const
Get received signal strength.
const advertising_data_status_t & getDataStatus() const
Get data completeness status.
Event generated when you first receive a periodic advertisement.
const peer_address_type_t & getPeerAddressType() const
Get peer address type.
uint16_t getAdvertisingInterval() const
Get interval.
const phy_t & getPeerPhy() const
Get PHY used.
const clock_accuracy_t & getPeerClockAccuracy() const
Get clock accuracy in parts per million.
ble_error_t getStatus() const
Get sync establishment status.
periodic_sync_handle_t getSyncHandle() const
Get periodic advertising sync handle.
const address_t & getPeerAddress() const
Get peer address.
advertising_sid_t getSid() const
Get advertising set identifier.
Event generated when periodic advertising sync is lost.
periodic_sync_handle_t getSyncHandle() const
Get periodic sync handle.
Event produced when a peer requests a scan response from the advertiser.
const peer_address_type_t & getPeerAddressType() const
Get peer address type.
advertising_handle_t getAdvHandle() const
Get advertising handle.
const address_t & getPeerAddress() const
Get peer address.
Event generated when scan times out.
Event received when a peer wants to change the connection parameters.
const slave_latency_t & getSlaveLatency() const
Get the slave latency requested.
const supervision_timeout_t & getSupervisionTimeout() const
Get the supervision timeout requested.
connection_handle_t getConnectionHandle() const
Get the connection handle.
const conn_interval_t & getMaxConnectionInterval() const
Get the maximum connection interval requested.
const conn_interval_t & getMinConnectionInterval() const
Get the minimum connection interval requested.
Type that describes a peer device address type.
Type that describes a bluetooth PHY(sical) transport.
Nonowning view to a sequence of contiguous elements.