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

Represents the LE Peripheral role, which advertises and is connected to. More...

#include <peripheral2.h>

Inheritance diagram for pw::bluetooth::low_energy::Peripheral2:
pw::bluetooth_sapphire::Peripheral

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 &parameters)=0
 

Detailed Description

Represents the LE Peripheral role, which advertises and is connected to.

Member Typedef Documentation

◆ ConnectionOptions

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.

◆ ScanResponse

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.

Member Enumeration Documentation

◆ AdvertiseError

Errors returned by Advertise.

Enumerator
kNotSupported 

The operation or parameters requested are not supported on the current hardware.

kAdvertisingDataTooLong 

The provided advertising data exceeds the maximum allowed length when encoded.

kScanResponseDataTooLong 

The provided scan response data exceeds the maximum allowed length when encoded.

kInvalidParameters 

The requested parameters are invalid.

kNotEnoughAdvertisingSlots 

The maximum number of simultaneous advertisements has already been reached.

kFailed 

Advertising could not be initiated due to a hardware or system error.

Member Function Documentation

◆ Advertise()

virtual async2::OnceReceiver< AdvertiseResult > pw::bluetooth::low_energy::Peripheral2::Advertise ( const AdvertisingParameters parameters)
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
parametersParameters used while configuring the advertising instance.
Returns
Asynchronously returns a result once advertising has started or failed. On success, returns an AdvertisedPeripheral2 that models the lifetime of the advertisement. Destroying it will stop advertising.

Implemented in pw::bluetooth_sapphire::Peripheral.


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