Pigweed
 
Loading...
Searching...
No Matches
pw::bluetooth::low_energy::AdvertisedPeripheral2 Class Referenceabstract

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::PtrPendConnection (async2::Context &cx)=0
 
virtual void StopAdvertising ()=0
 
virtual async2::Poll< pw::StatusPendStop (async2::Context &cx)=0
 

Private Member Functions

virtual void Release ()=0
 

Detailed Description

AdvertisedPeripheral instances are valid for the duration of advertising.

Member Typedef Documentation

◆ Ptr

Movable AdvertisedPeripheral2 smart pointer. The peripheral will continue advertising until the returned AdvertisedPeripheral::Ptr is destroyed.

Member Function Documentation

◆ PendConnection()

virtual async2::Poll< Connection2::Ptr > pw::bluetooth::low_energy::AdvertisedPeripheral2::PendConnection ( async2::Context cx)
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.

Parameters
cxAwoken when a connection is established.

◆ PendStop()

virtual async2::Poll< pw::Status > pw::bluetooth::low_energy::AdvertisedPeripheral2::PendStop ( async2::Context cx)
pure virtual

Returns Ready when advertising has stopped due to a call to StopAdvertising() or due to error. Awakens cx on stopping.

Returns
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.
* 
*  

◆ Release()

virtual void pw::bluetooth::low_energy::AdvertisedPeripheral2::Release ( )
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.

◆ StopAdvertising()

virtual void pw::bluetooth::low_energy::AdvertisedPeripheral2::StopAdvertising ( )
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.


The documentation for this class was generated from the following file: