Represents the LE Peripheral role, which advertises and is connected to. More...
#include <peripheral2.h>
Classes | |
struct | AdvertisingIntervalRange |
struct | AdvertisingParameters |
Represents the parameters for configuring advertisements. More... | |
struct | ExtendedAdvertising |
struct | LegacyAdvertising |
Public Types | |
enum class | AdvertiseError { kNotSupported = 1 , kAdvertisingDataTooLong = 2 , kScanResponseDataTooLong = 3 , kInvalidParameters = 4 , kNotEnoughAdvertisingSlots = 5 , kFailed = 6 } |
Errors returned by Advertise . More... | |
using | ScanResponse = AdvertisingData |
using | ConnectionOptions = Connection2::ConnectionOptions |
using | AdvertisingProcedure = std::variant< LegacyAdvertising, ExtendedAdvertising > |
using | AdvertiseResult = pw::expected< AdvertisedPeripheral2::Ptr, AdvertiseError > |
Public Member Functions | |
virtual async2::OnceReceiver< AdvertiseResult > | Advertise (const AdvertisingParameters ¶meters)=0 |
Represents the LE Peripheral role, which advertises and is connected to.
If present, the controller will broadcast connectable advertisements which allow peers to initiate connections to the Peripheral. The fields of ConnectionOptions
will configure any connections set up from advertising.
using pw::bluetooth::low_energy::Peripheral2::ScanResponse = AdvertisingData |
The fields that are to be sent in a scan response packet. Clients may use this to send additional data that does not fit inside an advertising packet on platforms that do not support the advertising data length extensions.
If present, advertisements will be configured to be scannable.
|
strong |
Errors returned by Advertise
.
|
pure virtual |
Start advertising continuously as a LE peripheral. If advertising cannot be initiated then result_callback
will be called with an error. Once started, advertising can be stopped by destroying the returned AdvertisedPeripheral::Ptr
.
If the system supports multiple advertising, this may be called as many times as there are advertising slots. To reconfigure an advertisement, first close the original advertisement and then initiate a new advertisement.
parameters | Parameters used while configuring the advertising instance. |
AdvertisedPeripheral2
that models the lifetime of the advertisement. Destroying it will stop advertising. Implemented in pw::bluetooth_sapphire::Peripheral.