Reference#
pw_bluetooth_sapphire: Battle-tested Bluetooth with rock-solid reliability
C++ API reference#
-
class Peripheral : public pw::bluetooth::low_energy::Peripheral2#
Must only be constructed and destroyed on the Bluetooth thread.
Public Functions
-
Peripheral(bt::gap::Adapter::WeakPtr adapter, pw::async::Dispatcher &dispatcher)#
Must only be constructed on the Bluetooth thread.
-
~Peripheral() override#
Must only be destroyed on the Bluetooth thread.
-
virtual async2::OnceReceiver<AdvertiseResult> Advertise(const AdvertisingParameters ¶meters) override#
Thread safe. The AdvertisedPeripheral2 returned on success is thread safe.
-
Peripheral(bt::gap::Adapter::WeakPtr adapter, pw::async::Dispatcher &dispatcher)#
-
class Central : public pw::bluetooth::low_energy::Central2#
Must only be constructed and destroyed on the Bluetooth thread.
Public Functions
-
Central(bt::gap::Adapter::WeakPtr adapter, pw::async::Dispatcher &dispatcher, pw::multibuf::MultiBufAllocator &allocator)#
Must only be constructed on the Bluetooth thread.
- Parameters:
allocator – The allocator to use for advertising data buffers.
-
virtual async2::OnceReceiver<ScanStartResult> Scan(ScanOptions options) override#
Scans for nearby LE peripherals and broadcasters. The lifetime of the scan session is tied to the returned
ScanHandle
object inScanStartResult
. Once a scan is started,ScanHandle::PendResult
can be called to get scan results. Only 1 scan may be active at a time.- Parameters:
options – Options used to configure the scan session. These options are suggestions only, and the implementation may use different parameters to meet power or radio requirements.
- Returns:
Returns a
ScanHandle
object if the scan successfully starts, or aScanError
otherwise.ScanHandle::PendResult
can be called to getScanResult
s for LE peers that satisfy the filters indicated inoptions
. The initial results may report recently discovered peers. Subsequent results will be reported only when peers have been scanned or updated since the last call.
-
Central(bt::gap::Adapter::WeakPtr adapter, pw::async::Dispatcher &dispatcher, pw::multibuf::MultiBufAllocator &allocator)#