mirror of https://github.com/ARMmbed/mbed-os.git
docs
parent
6eee528b79
commit
0f4ac44bc5
|
@ -407,17 +407,13 @@ enum advertising_type_t {
|
||||||
ADV_CONNECTABLE_DIRECTED_LOW_DUTY
|
ADV_CONNECTABLE_DIRECTED_LOW_DUTY
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** Used to indicate if the packet is complete and if it's truncated.
|
||||||
* FIXME
|
|
||||||
*/
|
*/
|
||||||
struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t >{
|
struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t >{
|
||||||
/**
|
|
||||||
* FIXME
|
|
||||||
*/
|
|
||||||
enum type {
|
enum type {
|
||||||
COMPLETE = 0x00,
|
COMPLETE = 0x00, /**< Advertising payload complete. */
|
||||||
INCOMPLETE_MORE_DATA = 0x01,
|
INCOMPLETE_MORE_DATA = 0x01, /**< Partial advertising payload, more to come. */
|
||||||
INCOMPLETE_DATA_TRUNCATED = 0x02
|
INCOMPLETE_DATA_TRUNCATED = 0x02 /**< Advertising payload incomplete and no more is comoing. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -436,123 +432,94 @@ struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/** Properties of an advertising event.
|
||||||
* FIXME
|
|
||||||
*/
|
*/
|
||||||
struct advertising_event_t {
|
struct advertising_event_t {
|
||||||
/**
|
/** Create based on a raw value.
|
||||||
* FIXME
|
*
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
explicit advertising_event_t(uint8_t value) : value(value) { }
|
explicit advertising_event_t(uint8_t value) : value(value) { }
|
||||||
|
|
||||||
/**
|
/** Is advertising connectable.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if connectable.
|
||||||
*/
|
*/
|
||||||
bool connectable() const
|
bool connectable() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value & (1 << 0));
|
return static_cast<bool>(value & (1 << 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is advertising scannable.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if scannable
|
||||||
*/
|
*/
|
||||||
bool scannable_advertising() const
|
bool scannable_advertising() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value & (1 << 1));
|
return static_cast<bool>(value & (1 << 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is advertising directed.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if directed.
|
||||||
*/
|
*/
|
||||||
bool directed_advertising() const
|
bool directed_advertising() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value & (1 << 2));
|
return static_cast<bool>(value & (1 << 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is this a scan response.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if scan response.
|
||||||
*/
|
*/
|
||||||
bool scan_response() const
|
bool scan_response() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value & (1 << 3));
|
return static_cast<bool>(value & (1 << 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is this legacy advertising.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if legacy.
|
||||||
*/
|
*/
|
||||||
bool legacy_advertising() const
|
bool legacy_advertising() const
|
||||||
{
|
{
|
||||||
return static_cast<bool>(value & (1 << 4));
|
return static_cast<bool>(value & (1 << 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Payload completeness status.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return @see advertising_data_status_t for details.
|
||||||
*/
|
*/
|
||||||
advertising_data_status_t data_status() const
|
advertising_data_status_t data_status() const
|
||||||
{
|
{
|
||||||
return static_cast<advertising_data_status_t::type>((value >> 5) & 0x03);
|
return static_cast<advertising_data_status_t::type>((value >> 5) & 0x03);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is payload complete.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if payload is coplete.
|
||||||
*/
|
*/
|
||||||
bool complete() const
|
bool complete() const
|
||||||
{
|
{
|
||||||
return data_status() == advertising_data_status_t::COMPLETE;
|
return data_status().value() == advertising_data_status_t::COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is there more data coming.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if more data coming.
|
||||||
*/
|
*/
|
||||||
bool more_data_to_come() const
|
bool more_data_to_come() const
|
||||||
{
|
{
|
||||||
return data_status() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
|
return data_status().value() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Is the payload truncated.
|
||||||
* FIXME
|
*
|
||||||
* @return
|
* @return True if no more data coming.
|
||||||
*/
|
*/
|
||||||
bool truncated() const
|
bool truncated() const
|
||||||
{
|
{
|
||||||
return data_status() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
|
return data_status().value() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME
|
|
||||||
* @param lhs
|
|
||||||
* @param rhs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
friend bool operator==(
|
|
||||||
const advertising_event_t &lhs,
|
|
||||||
const advertising_event_t &rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return lhs.value == rhs.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME
|
|
||||||
* @param lhs
|
|
||||||
* @param rhs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
friend bool operator!=(
|
|
||||||
const advertising_event_t &lhs,
|
|
||||||
const advertising_event_t &rhs
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return !(rhs == lhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1203,63 +1203,63 @@ public:
|
||||||
directAddress(directAddress),
|
directAddress(directAddress),
|
||||||
advertisingData(advertisingData) { }
|
advertisingData(advertisingData) { }
|
||||||
|
|
||||||
const AdvertisingEventType_t &getType() const
|
/** Get event type. */
|
||||||
{
|
const AdvertisingEventType_t &getType() const {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PeerAddressType_t &getPeerAddressType() const
|
/** Get peer address type. */
|
||||||
{
|
const PeerAddressType_t &getPeerAddressType() const {
|
||||||
return peerAddressType;
|
return peerAddressType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getPeerAddress() const
|
/** Get peer address. */
|
||||||
{
|
const ble::address_t &getPeerAddress() const {
|
||||||
return peerAddress;
|
return peerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Phy_t &getPrimaryPhy() const
|
/** Get primary PHY. */
|
||||||
{
|
const Phy_t &getPrimaryPhy() const {
|
||||||
return primaryPhy;
|
return primaryPhy;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Phy_t &getSecondaryPhy() const
|
/** Get secondary PHY. */
|
||||||
{
|
const Phy_t &getSecondaryPhy() const {
|
||||||
return secondaryPhy;
|
return secondaryPhy;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::advertising_sid_t getSID() const
|
/** Get advertising set identifier. */
|
||||||
{
|
ble::advertising_sid_t getSID() const {
|
||||||
return SID;
|
return SID;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::advertising_power_t getTxPower() const
|
/** Get TX power. */
|
||||||
{
|
ble::advertising_power_t getTxPower() const {
|
||||||
return txPower;
|
return txPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::rssi_t getRssi() const
|
/** Get received signal strength. */
|
||||||
{
|
ble::rssi_t getRssi() const {
|
||||||
return rssi;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitPeriodicInterval_t getPeriodicInterval() const
|
/** Get interval. */
|
||||||
{
|
UnitPeriodicInterval_t getPeriodicInterval() const {
|
||||||
return periodicInterval;
|
return periodicInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PeerAddressType_t &getDirectAddressType() const
|
/** Get target address type in directed advertising. */
|
||||||
{
|
const PeerAddressType_t &getDirectAddressType() const {
|
||||||
return directAddressType;
|
return directAddressType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getDirectAddress() const
|
/** Get target address in directed advertising. */
|
||||||
{
|
const ble::address_t &getDirectAddress() const {
|
||||||
return directAddress;
|
return directAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mbed::Span<const uint8_t> &getAdvertisingData() const
|
/** Get payload. */
|
||||||
{
|
const mbed::Span<const uint8_t> &getAdvertisingData() const {
|
||||||
return advertisingData;
|
return advertisingData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1331,58 +1331,58 @@ public:
|
||||||
supervisionTimeout(supervisionTimeout),
|
supervisionTimeout(supervisionTimeout),
|
||||||
masterClockAccuracy(masterClockAccuracy) { }
|
masterClockAccuracy(masterClockAccuracy) { }
|
||||||
|
|
||||||
ble_error_t getStatus() const
|
/** Get connection complete event status. */
|
||||||
{
|
ble_error_t getStatus() const {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle_t getConnectionHandle() const
|
/** Get connection handle (valid only when successful). */
|
||||||
{
|
Handle_t getConnectionHandle() const {
|
||||||
return connectionHandle;
|
return connectionHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
Role_t getOwnRole() const
|
/** Get own role. */
|
||||||
{
|
Role_t getOwnRole() const {
|
||||||
return ownRole;
|
return ownRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PeerAddressType_t &getPeerAddressType() const
|
/** Get peer address type. */
|
||||||
{
|
const PeerAddressType_t &getPeerAddressType() const {
|
||||||
return peerAddressType;
|
return peerAddressType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getPeerAddress() const
|
/** Get peer address. */
|
||||||
{
|
const ble::address_t &getPeerAddress() const {
|
||||||
return peerAddress;
|
return peerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getLocalResolvablePrivateAddress() const
|
/** Get get local resolvable random address if privacy is used. */
|
||||||
{
|
const ble::address_t &getLocalResolvablePrivateAddress() const {
|
||||||
return localResolvablePrivateAddress;
|
return localResolvablePrivateAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getPeerResolvablePrivateAddress() const
|
/** Get peer resolvable private address if privacy is used. */
|
||||||
{
|
const ble::address_t &getPeerResolvablePrivateAddress() const {
|
||||||
return peerResolvablePrivateAddress;
|
return peerResolvablePrivateAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitConnInterval_t getConnectionInterval() const
|
/** Get connection interval. */
|
||||||
{
|
UnitConnInterval_t getConnectionInterval() const {
|
||||||
return connectionInterval;
|
return connectionInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitSlaveLatency_t getConnectionLatency() const
|
/** Get connection latency. */
|
||||||
{
|
UnitSlaveLatency_t getConnectionLatency() const {
|
||||||
return connectionLatency;
|
return connectionLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitSupervisionTimeout_t getSupervisionTimeout() const
|
/** Get supervision timeout. */
|
||||||
{
|
UnitSupervisionTimeout_t getSupervisionTimeout() const {
|
||||||
return supervisionTimeout;
|
return supervisionTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getMasterClockAccuracy() const
|
/** Get clock accuracy in parts per million. */
|
||||||
{
|
uint16_t getMasterClockAccuracy() const {
|
||||||
return masterClockAccuracy;
|
return masterClockAccuracy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1415,12 +1415,12 @@ public:
|
||||||
struct PeriodicAdvertisingSyncEstablishedEvent {
|
struct PeriodicAdvertisingSyncEstablishedEvent {
|
||||||
/** Create advertising sync event.
|
/** Create advertising sync event.
|
||||||
*
|
*
|
||||||
* @param success BLE_ERROR_NONE if connection succeeded.
|
* @param success BLE_ERROR_NONE if synchronisation was achieved.
|
||||||
* @param syncHandle Advertising sync handle.
|
* @param syncHandle Advertising sync handle.
|
||||||
* @param sid Advertising set identifier.
|
* @param sid Advertising set identifier.
|
||||||
* @param peerAddressType Peer address type.
|
* @param peerAddressType Peer address type.
|
||||||
* @param peerAddress Peer address.
|
* @param peerAddress Peer address.
|
||||||
* @param peerPhy Phy used for advertisements.
|
* @param peerPhy PHY used for advertisements.
|
||||||
* @param advertisingInterval Periodic advertising interval.
|
* @param advertisingInterval Periodic advertising interval.
|
||||||
* @param masterClockAccuracy Peer clock accuracy in parts per million.
|
* @param masterClockAccuracy Peer clock accuracy in parts per million.
|
||||||
*/
|
*/
|
||||||
|
@ -1443,43 +1443,43 @@ public:
|
||||||
advertisingInterval(advertisingInterval),
|
advertisingInterval(advertisingInterval),
|
||||||
peerClockAccuracy(peerClockAccuracy) { }
|
peerClockAccuracy(peerClockAccuracy) { }
|
||||||
|
|
||||||
ble_error_t getStatus() const
|
/** Get sync establishment status. */
|
||||||
{
|
ble_error_t getStatus() const {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::periodic_sync_handle_t getSyncHandle() const
|
/** Get periodic advertising sync handle. */
|
||||||
{
|
ble::periodic_sync_handle_t getSyncHandle() const {
|
||||||
return syncHandle;
|
return syncHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::advertising_sid_t getSid() const
|
/** Get advertising set identifier. */
|
||||||
{
|
ble::advertising_sid_t getSid() const {
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PeerAddressType_t &getPeerAddressType() const
|
/** Get peer address type. */
|
||||||
{
|
const PeerAddressType_t &getPeerAddressType() const {
|
||||||
return peerAddressType;
|
return peerAddressType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::address_t &getPeerAddress() const
|
/** Get peer address. */
|
||||||
{
|
const ble::address_t &getPeerAddress() const {
|
||||||
return peerAddress;
|
return peerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Phy_t &getPeerPhy() const
|
/** Get PHY used. */
|
||||||
{
|
const Phy_t &getPeerPhy() const {
|
||||||
return peerPhy;
|
return peerPhy;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getAdvertisingInterval() const
|
/** Get interval. */
|
||||||
{
|
uint16_t getAdvertisingInterval() const {
|
||||||
return advertisingInterval;
|
return advertisingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::clock_accuracy_t &getPeerClockAccuracy() const
|
/** Get clock accuracy in parts per million. */
|
||||||
{
|
const ble::clock_accuracy_t &getPeerClockAccuracy() const {
|
||||||
return peerClockAccuracy;
|
return peerClockAccuracy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1528,28 +1528,28 @@ public:
|
||||||
dataStatus(dataStatus),
|
dataStatus(dataStatus),
|
||||||
payload(payload) { }
|
payload(payload) { }
|
||||||
|
|
||||||
ble::periodic_sync_handle_t getSyncHandle() const
|
/** Get periodic advertising sync handle. */
|
||||||
{
|
ble::periodic_sync_handle_t getSyncHandle() const {
|
||||||
return syncHandle;
|
return syncHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::advertising_power_t getTxPower() const
|
/** Get TX power as reported by the advertising packet. */
|
||||||
{
|
ble::advertising_power_t getTxPower() const {
|
||||||
return txPower;
|
return txPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
ble::rssi_t getRssi() const
|
/** Get received signal strength. */
|
||||||
{
|
ble::rssi_t getRssi() const {
|
||||||
return rssi;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble::advertising_data_status_t &getDataStatus() const
|
/** Get data completeness status. */
|
||||||
{
|
const ble::advertising_data_status_t &getDataStatus() const {
|
||||||
return dataStatus;
|
return dataStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mbed::Span<const uint8_t> &getPayload() const
|
/** Get payload. */
|
||||||
{
|
const mbed::Span<const uint8_t> &getPayload() const {
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue