AdvertisedPeripheral
instances are valid for the duration of advertising.
More...
#include <peripheral2.h>
Public Types | |
using | Ptr = internal::RaiiPtr< AdvertisedPeripheral2, &AdvertisedPeripheral2::Release > |
Public Member Functions | |
virtual async2::Poll< Connection2::Ptr > | PendConnection (async2::Context &cx)=0 |
virtual void | StopAdvertising ()=0 |
virtual async2::Poll< pw::Status > | PendStop (async2::Context &cx)=0 |
Private Member Functions | |
virtual void | Release ()=0 |
AdvertisedPeripheral
instances are valid for the duration of advertising.
using pw::bluetooth::low_energy::AdvertisedPeripheral2::Ptr = internal::RaiiPtr<AdvertisedPeripheral2, &AdvertisedPeripheral2::Release> |
Movable AdvertisedPeripheral2
smart pointer. The peripheral will continue advertising until the returned AdvertisedPeripheral::Ptr
is destroyed.
|
pure virtual |
For connectable advertisements, this method returns Ready when an LE central connects to the advertisement.
The returned Connection2 can be used to interact with the peer. It also represents a peripheral's ownership over the connection: the client can drop the object to request a disconnection. Similarly, the Connection2 error handler is called by the system to indicate that the connection to the peer has been lost. While connections are exclusive among peripherals, they may be shared with centrals, preventing disconnections.
After a connection is returned, advertising will be paused until PendConnection()
is called again. This method may return multiple connections over the lifetime of an advertisement.
cx | Awoken when a connection is established. |
|
pure virtual |
Returns Ready when advertising has stopped due to a call to StopAdvertising()
or due to error. Awakens cx
on stopping.
embed:rst:leading-asterisk * * .. pw-status-codes:: * * OK: Advertising was stopped successfully after a call to * ``StopAdvertising()``. * * CANCELLED: An internal error occurred and the advertisement was * cancelled. * *
|
privatepure virtual |
Stop advertising and release memory. This method is called by the ~AdvertisedPeripheralPtr() when it goes out of scope, the API client should never call this method.
|
pure virtual |
Requests that advertising be stopped. PendStop()
can be used to wait for advertising to stop (e.g. before starting another advertisement). Destroying this object will also stop advertising, but there will be no way to determine when advertising has stopped. This method is idempotent.