Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ersa::hal::Esp32Bluetooth Class Reference

#include <esp32_bluetooth.h>

Inheritance diagram for ersa::hal::Esp32Bluetooth:
Inheritance graph
[legend]
Collaboration diagram for ersa::hal::Esp32Bluetooth:
Collaboration graph
[legend]

Public Member Functions

 Esp32Bluetooth ()
 
 ~Esp32Bluetooth () override
 
Result< void > init () override
 
void startAdvertising () override
 
void stopAdvertising () override
 
bool isConnected () const override
 
bool isAdvertising () const override
 
uint32_t nextWakeDelayMs (uint32_t nowMs) const override
 
void tick () override
 
const char * getDeviceName () const override
 Return the local BLE device name.
 
const char * getDeviceAddress () const override
 
const char * sourceId () const override
 
bool pauseForMaintenance () override
 
void resumeFromMaintenance () override
 
bool suspendForMaintenance () override
 Release radio resources before memory-intensive maintenance.
 
void resumeAfterMaintenance () override
 Resume advertising after maintenance completes.
 
bool isAvailable () const override
 
CompanionCapabilities capabilities () const override
 
void setCallCallback (CompanionCallCallback cb, void *userData) override
 
void setMediaCallback (CompanionMediaCallback cb, void *userData) override
 
void setConnectionCallback (BleConnectionCallback cb, void *userData) override
 
void setNotificationCallback (CompanionNotificationCallback cb, void *userData) override
 
void setTimeCallback (CompanionTimeCallback cb, void *userData) override
 
void setAvailabilityCallback (CompanionAvailabilityCallback cb, void *userData) override
 
bool acceptCall () override
 
bool rejectCall () override
 
bool hangupCall () override
 
bool dial (const char *number) override
 
bool mediaCommand (CompanionMediaAction action) override
 
bool dismissNotification (uint32_t uid) override
 
- Public Member Functions inherited from ersa::hal::IBluetooth
virtual ~IBluetooth ()=default
 
- Public Member Functions inherited from ersa::hal::ICompanionSource
virtual ~ICompanionSource ()=default
 
virtual Result< void > initSource ()
 
virtual void tickSource ()
 
virtual void shutdownSource ()
 

Private Member Functions

void beginAdvertising ()
 

Private Attributes

Impl * pImpl_ {nullptr}
 
CompanionCallCallback callCb_ {nullptr}
 
void * callUserData_ {nullptr}
 
CompanionMediaCallback mediaCb_ {nullptr}
 
void * mediaUserData_ {nullptr}
 
BleConnectionCallback connCb_ {nullptr}
 
void * connUserData_ {nullptr}
 
CompanionNotificationCallback notifCb_ {nullptr}
 
void * notifUserData_ {nullptr}
 
CompanionTimeCallback timeCb_ {nullptr}
 
void * timeUserData_ {nullptr}
 
CompanionAvailabilityCallback availabilityCb_ {nullptr}
 
void * availabilityUserData_ {nullptr}
 
bool lastSourceAvailability_ {false}
 
bool maintenanceSuspended_ {false}
 
std::atomic< uint32_t > tickUsers_ {0}
 

Detailed Description

ESP32 BLE transport and current Apple companion-source composition.

The implementation currently satisfies both independent contracts because this product uses one radio/client stack. BluetoothManager receives the IBluetooth and ICompanionSource base references separately, so a future Android, Linux, or test provider can replace companion semantics without changing the transport interface. The pImpl keeps the large vendor BLE implementation out of this header and reduces SDK coupling for consumers.

Constructor & Destructor Documentation

◆ Esp32Bluetooth()

ersa::hal::Esp32Bluetooth::Esp32Bluetooth ( )
default

Create the vendor stack lazily; init() performs hardware setup.

◆ ~Esp32Bluetooth()

ersa::hal::Esp32Bluetooth::~Esp32Bluetooth ( )
overridedefault

Stop callbacks/workers and release the opaque ESP32 implementation.

Member Function Documentation

◆ acceptCall()

bool ersa::hal::Esp32Bluetooth::acceptCall ( )
overridevirtual

Queue a request to answer the current incoming call.

Implements ersa::hal::ICompanionSource.

◆ beginAdvertising()

void ersa::hal::Esp32Bluetooth::beginAdvertising ( )
private

◆ capabilities()

CompanionCapabilities ersa::hal::Esp32Bluetooth::capabilities ( ) const
overridevirtual

Return a by-value snapshot so callers cannot retain mutable provider state.

Implements ersa::hal::ICompanionSource.

◆ dial()

bool ersa::hal::Esp32Bluetooth::dial ( const char *  number)
overridevirtual

Request dialing; the number format is provider-defined international text.

Implements ersa::hal::ICompanionSource.

◆ dismissNotification()

bool ersa::hal::Esp32Bluetooth::dismissNotification ( uint32_t  uid)
overridevirtual

Request remote removal of one notification when the peer supports it.

Implements ersa::hal::ICompanionSource.

◆ getDeviceAddress()

const char * ersa::hal::Esp32Bluetooth::getDeviceAddress ( ) const
overridevirtual

Return a stable formatted address string owned by the backend.

Implements ersa::hal::IBluetooth.

◆ getDeviceName()

const char * ersa::hal::Esp32Bluetooth::getDeviceName ( ) const
overridevirtual

Return the local BLE device name.

Implements ersa::hal::IBluetooth.

◆ hangupCall()

bool ersa::hal::Esp32Bluetooth::hangupCall ( )
overridevirtual

Queue a request to end the current active call.

Implements ersa::hal::ICompanionSource.

◆ init()

Result< void > ersa::hal::Esp32Bluetooth::init ( )
overridevirtual

Initialize the controller and service transport required by the product.

Implements ersa::hal::IBluetooth.

◆ isAdvertising()

bool ersa::hal::Esp32Bluetooth::isAdvertising ( ) const
overridevirtual

Return advertising state when the backend can report it, else false.

Reimplemented from ersa::hal::IBluetooth.

◆ isAvailable()

bool ersa::hal::Esp32Bluetooth::isAvailable ( ) const
overridevirtual

Report whether commands/data are currently usable from the peer.

Implements ersa::hal::ICompanionSource.

◆ isConnected()

bool ersa::hal::Esp32Bluetooth::isConnected ( ) const
overridevirtual

Return current link state; this does not imply companion services are ready.

Implements ersa::hal::IBluetooth.

◆ mediaCommand()

bool ersa::hal::Esp32Bluetooth::mediaCommand ( CompanionMediaAction  action)
overridevirtual

Send a transport-neutral playback action after capability checks.

Implements ersa::hal::ICompanionSource.

◆ nextWakeDelayMs()

uint32_t ersa::hal::Esp32Bluetooth::nextWakeDelayMs ( uint32_t  nowMs) const
overridevirtual

Return delay until the next required BLE maintenance deadline. UINT32_MAX means there is no scheduled deadline; sleep policy uses this value to choose a safe wait duration without polling continuously.

Reimplemented from ersa::hal::IBluetooth.

◆ pauseForMaintenance()

bool ersa::hal::Esp32Bluetooth::pauseForMaintenance ( )
overridevirtual

Release provider-owned resources before OTA or other memory-heavy work.

Reimplemented from ersa::hal::ICompanionSource.

◆ rejectCall()

bool ersa::hal::Esp32Bluetooth::rejectCall ( )
overridevirtual

Queue a request to reject the current incoming call.

Implements ersa::hal::ICompanionSource.

◆ resumeAfterMaintenance()

void ersa::hal::Esp32Bluetooth::resumeAfterMaintenance ( )
overridevirtual

Resume advertising after maintenance completes.

Reimplemented from ersa::hal::IBluetooth.

◆ resumeFromMaintenance()

void ersa::hal::Esp32Bluetooth::resumeFromMaintenance ( )
overridevirtual

Restore provider activity after maintenance; safe after partial pause.

Reimplemented from ersa::hal::ICompanionSource.

◆ setAvailabilityCallback()

void ersa::hal::Esp32Bluetooth::setAvailabilityCallback ( CompanionAvailabilityCallback  ,
void *   
)
overridevirtual

Install or clear a sink for provider availability transitions.

Implements ersa::hal::ICompanionSource.

◆ setCallCallback()

void ersa::hal::Esp32Bluetooth::setCallCallback ( CompanionCallCallback  ,
void *   
)
overridevirtual

Install or clear a sink for call-state transitions.

Implements ersa::hal::ICompanionSource.

◆ setConnectionCallback()

void ersa::hal::Esp32Bluetooth::setConnectionCallback ( BleConnectionCallback  cb,
void *  userData 
)
overridevirtual

Register the single BLE link-state callback; null clears it. This reports transport only. Use ICompanionSource for provider/session readiness because encrypted link-up can precede service discovery.

Implements ersa::hal::IBluetooth.

◆ setMediaCallback()

void ersa::hal::Esp32Bluetooth::setMediaCallback ( CompanionMediaCallback  ,
void *   
)
overridevirtual

Install or clear a sink for media metadata/playback updates.

Implements ersa::hal::ICompanionSource.

◆ setNotificationCallback()

void ersa::hal::Esp32Bluetooth::setNotificationCallback ( CompanionNotificationCallback  ,
void *   
)
overridevirtual

Install or clear a sink for notification add/update/remove events.

Implements ersa::hal::ICompanionSource.

◆ setTimeCallback()

void ersa::hal::Esp32Bluetooth::setTimeCallback ( CompanionTimeCallback  ,
void *   
)
overridevirtual

Install or clear a sink for a peer-provided current time.

Implements ersa::hal::ICompanionSource.

◆ sourceId()

const char * ersa::hal::Esp32Bluetooth::sourceId ( ) const
overridevirtual

◆ startAdvertising()

void ersa::hal::Esp32Bluetooth::startAdvertising ( )
overridevirtual

Begin or resume advertising; repeated calls should be safe.

Implements ersa::hal::IBluetooth.

◆ stopAdvertising()

void ersa::hal::Esp32Bluetooth::stopAdvertising ( )
overridevirtual

Stop advertising without necessarily tearing down an established link.

Implements ersa::hal::IBluetooth.

◆ suspendForMaintenance()

bool ersa::hal::Esp32Bluetooth::suspendForMaintenance ( )
overridevirtual

Release radio resources before memory-intensive maintenance.

Reimplemented from ersa::hal::IBluetooth.

◆ tick()

void ersa::hal::Esp32Bluetooth::tick ( )
overridevirtual

Run bounded maintenance deferred from radio callbacks.

Reimplemented from ersa::hal::IBluetooth.

Member Data Documentation

◆ availabilityCb_

CompanionAvailabilityCallback ersa::hal::Esp32Bluetooth::availabilityCb_ {nullptr}
private

◆ availabilityUserData_

void* ersa::hal::Esp32Bluetooth::availabilityUserData_ {nullptr}
private

◆ callCb_

CompanionCallCallback ersa::hal::Esp32Bluetooth::callCb_ {nullptr}
private

◆ callUserData_

void* ersa::hal::Esp32Bluetooth::callUserData_ {nullptr}
private

◆ connCb_

BleConnectionCallback ersa::hal::Esp32Bluetooth::connCb_ {nullptr}
private

◆ connUserData_

void* ersa::hal::Esp32Bluetooth::connUserData_ {nullptr}
private

◆ lastSourceAvailability_

bool ersa::hal::Esp32Bluetooth::lastSourceAvailability_ {false}
private

◆ maintenanceSuspended_

bool ersa::hal::Esp32Bluetooth::maintenanceSuspended_ {false}
private

◆ mediaCb_

CompanionMediaCallback ersa::hal::Esp32Bluetooth::mediaCb_ {nullptr}
private

◆ mediaUserData_

void* ersa::hal::Esp32Bluetooth::mediaUserData_ {nullptr}
private

◆ notifCb_

CompanionNotificationCallback ersa::hal::Esp32Bluetooth::notifCb_ {nullptr}
private

◆ notifUserData_

void* ersa::hal::Esp32Bluetooth::notifUserData_ {nullptr}
private

◆ pImpl_

Impl* ersa::hal::Esp32Bluetooth::pImpl_ {nullptr}
private

◆ tickUsers_

std::atomic<uint32_t> ersa::hal::Esp32Bluetooth::tickUsers_ {0}
private

◆ timeCb_

CompanionTimeCallback ersa::hal::Esp32Bluetooth::timeCb_ {nullptr}
private

◆ timeUserData_

void* ersa::hal::Esp32Bluetooth::timeUserData_ {nullptr}
private

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