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

#include <mock_bluetooth.h>

Inheritance diagram for ersa::test::MockBluetooth:
Inheritance graph
[legend]
Collaboration diagram for ersa::test::MockBluetooth:
Collaboration graph
[legend]

Public Member Functions

 MockBluetooth ()=default
 
Result< void > init () override
 
const char * sourceId () const override
 
bool isAvailable () const override
 
hal::CompanionCapabilities capabilities () const override
 
void setCallCallback (hal::CompanionCallCallback cb, void *userData) override
 
void setMediaCallback (hal::CompanionMediaCallback cb, void *userData) override
 
void setNotificationCallback (hal::CompanionNotificationCallback cb, void *userData) override
 
void setTimeCallback (hal::CompanionTimeCallback cb, void *userData) override
 
void setAvailabilityCallback (hal::CompanionAvailabilityCallback cb, void *userData) override
 
bool acceptCall () override
 
bool rejectCall () override
 
bool hangupCall () override
 
bool dial (const char *number) override
 
bool mediaCommand (hal::CompanionMediaAction action) override
 
bool dismissNotification (uint32_t uid) override
 
void startAdvertising () override
 
void stopAdvertising () override
 
bool isConnected () const override
 
const char * getDeviceName () const override
 Return the local BLE device name.
 
const char * getDeviceAddress () const override
 
void setConnectionCallback (hal::BleConnectionCallback cb, void *userData) override
 
void simulateConnection (bool conn)
 
void simulateIncomingCall (const char *caller, const char *number)
 
void simulateCallAnswered ()
 
void simulateCallEnded ()
 
void simulateMedia (bool playing, const char *title, const char *artist)
 
void simulateTime (uint32_t epoch)
 
void simulateNotification (const char *title, const char *message, const char *app="Messages", uint32_t uid=1, bool canDismissRemotely=false)
 
bool isAdvertising () const
 
int acceptCount () const
 
int rejectCount () const
 
int hangupCount () const
 
int dialCount () const
 
const char * lastDialed () const
 
int mediaCmdCount () const
 
hal::CompanionMediaAction lastMediaAction () const
 
int notificationDismissCount () const
 
uint32_t lastDismissedUid () const
 
void setDismissSucceeds (bool succeeds)
 
- Public Member Functions inherited from ersa::hal::IBluetooth
virtual ~IBluetooth ()=default
 
virtual bool suspendForMaintenance ()
 Release radio resources before memory-intensive maintenance.
 
virtual void resumeAfterMaintenance ()
 Resume advertising after maintenance completes.
 
virtual uint32_t nextWakeDelayMs (uint32_t nowMs) const
 
virtual void tick ()
 
- Public Member Functions inherited from ersa::hal::ICompanionSource
virtual ~ICompanionSource ()=default
 
virtual Result< void > initSource ()
 
virtual bool pauseForMaintenance ()
 
virtual void resumeFromMaintenance ()
 
virtual void tickSource ()
 
virtual void shutdownSource ()
 

Private Attributes

bool advertising_ {false}
 
bool connected_ {false}
 
bool dismissSucceeds_ {true}
 
hal::CompanionCallCallback callCb_ {nullptr}
 
void * callUserData_ {nullptr}
 
hal::CompanionMediaCallback mediaCb_ {nullptr}
 
void * mediaUserData_ {nullptr}
 
hal::BleConnectionCallback connCb_ {nullptr}
 
void * connUserData_ {nullptr}
 
hal::CompanionNotificationCallback notifCb_ {nullptr}
 
void * notifUserData_ {nullptr}
 
hal::CompanionTimeCallback timeCb_ {nullptr}
 
void * timeUserData_ {nullptr}
 
hal::CompanionAvailabilityCallback availabilityCb_ {nullptr}
 
void * availabilityUserData_ {nullptr}
 
int acceptCount_ {0}
 
int rejectCount_ {0}
 
int hangupCount_ {0}
 
int dialCount_ {0}
 
char lastDialed_ [32] {""}
 
int mediaCmdCount_ {0}
 
hal::CompanionMediaAction lastMediaAction_ {hal::CompanionMediaAction::Play}
 
int notificationDismissCount_ {0}
 
uint32_t lastDismissedUid_ {0}
 

Constructor & Destructor Documentation

◆ MockBluetooth()

ersa::test::MockBluetooth::MockBluetooth ( )
default

Member Function Documentation

◆ acceptCall()

bool ersa::test::MockBluetooth::acceptCall ( )
inlineoverridevirtual

Queue a request to answer the current incoming call.

Implements ersa::hal::ICompanionSource.

◆ acceptCount()

int ersa::test::MockBluetooth::acceptCount ( ) const
inline

◆ capabilities()

hal::CompanionCapabilities ersa::test::MockBluetooth::capabilities ( ) const
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ dial()

bool ersa::test::MockBluetooth::dial ( const char *  number)
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ dialCount()

int ersa::test::MockBluetooth::dialCount ( ) const
inline

◆ dismissNotification()

bool ersa::test::MockBluetooth::dismissNotification ( uint32_t  uid)
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ getDeviceAddress()

const char * ersa::test::MockBluetooth::getDeviceAddress ( ) const
inlineoverridevirtual

Return a stable formatted address string owned by the backend.

Implements ersa::hal::IBluetooth.

◆ getDeviceName()

const char * ersa::test::MockBluetooth::getDeviceName ( ) const
inlineoverridevirtual

Return the local BLE device name.

Implements ersa::hal::IBluetooth.

◆ hangupCall()

bool ersa::test::MockBluetooth::hangupCall ( )
inlineoverridevirtual

Queue a request to end the current active call.

Implements ersa::hal::ICompanionSource.

◆ hangupCount()

int ersa::test::MockBluetooth::hangupCount ( ) const
inline

◆ init()

Result< void > ersa::test::MockBluetooth::init ( )
inlineoverridevirtual

Initialize the controller and service transport required by the product.

Implements ersa::hal::IBluetooth.

◆ isAdvertising()

bool ersa::test::MockBluetooth::isAdvertising ( ) const
inlinevirtual

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

Reimplemented from ersa::hal::IBluetooth.

◆ isAvailable()

bool ersa::test::MockBluetooth::isAvailable ( ) const
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ isConnected()

bool ersa::test::MockBluetooth::isConnected ( ) const
inlineoverridevirtual

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

Implements ersa::hal::IBluetooth.

◆ lastDialed()

const char * ersa::test::MockBluetooth::lastDialed ( ) const
inline

◆ lastDismissedUid()

uint32_t ersa::test::MockBluetooth::lastDismissedUid ( ) const
inline

◆ lastMediaAction()

hal::CompanionMediaAction ersa::test::MockBluetooth::lastMediaAction ( ) const
inline

◆ mediaCmdCount()

int ersa::test::MockBluetooth::mediaCmdCount ( ) const
inline

◆ mediaCommand()

bool ersa::test::MockBluetooth::mediaCommand ( hal::CompanionMediaAction  action)
inlineoverridevirtual

Send a transport-neutral playback action after capability checks.

Implements ersa::hal::ICompanionSource.

◆ notificationDismissCount()

int ersa::test::MockBluetooth::notificationDismissCount ( ) const
inline

◆ rejectCall()

bool ersa::test::MockBluetooth::rejectCall ( )
inlineoverridevirtual

Queue a request to reject the current incoming call.

Implements ersa::hal::ICompanionSource.

◆ rejectCount()

int ersa::test::MockBluetooth::rejectCount ( ) const
inline

◆ setAvailabilityCallback()

void ersa::test::MockBluetooth::setAvailabilityCallback ( hal::CompanionAvailabilityCallback  ,
void *   
)
inlineoverridevirtual

Install or clear a sink for provider availability transitions.

Implements ersa::hal::ICompanionSource.

◆ setCallCallback()

void ersa::test::MockBluetooth::setCallCallback ( hal::CompanionCallCallback  ,
void *   
)
inlineoverridevirtual

Install or clear a sink for call-state transitions.

Implements ersa::hal::ICompanionSource.

◆ setConnectionCallback()

void ersa::test::MockBluetooth::setConnectionCallback ( hal::BleConnectionCallback  cb,
void *  userData 
)
inlineoverridevirtual

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.

◆ setDismissSucceeds()

void ersa::test::MockBluetooth::setDismissSucceeds ( bool  succeeds)
inline

◆ setMediaCallback()

void ersa::test::MockBluetooth::setMediaCallback ( hal::CompanionMediaCallback  ,
void *   
)
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ setNotificationCallback()

void ersa::test::MockBluetooth::setNotificationCallback ( hal::CompanionNotificationCallback  ,
void *   
)
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ setTimeCallback()

void ersa::test::MockBluetooth::setTimeCallback ( hal::CompanionTimeCallback  ,
void *   
)
inlineoverridevirtual

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

Implements ersa::hal::ICompanionSource.

◆ simulateCallAnswered()

void ersa::test::MockBluetooth::simulateCallAnswered ( )
inline

◆ simulateCallEnded()

void ersa::test::MockBluetooth::simulateCallEnded ( )
inline

◆ simulateConnection()

void ersa::test::MockBluetooth::simulateConnection ( bool  conn)
inline

◆ simulateIncomingCall()

void ersa::test::MockBluetooth::simulateIncomingCall ( const char *  caller,
const char *  number 
)
inline

◆ simulateMedia()

void ersa::test::MockBluetooth::simulateMedia ( bool  playing,
const char *  title,
const char *  artist 
)
inline

◆ simulateNotification()

void ersa::test::MockBluetooth::simulateNotification ( const char *  title,
const char *  message,
const char *  app = "Messages",
uint32_t  uid = 1,
bool  canDismissRemotely = false 
)
inline

◆ simulateTime()

void ersa::test::MockBluetooth::simulateTime ( uint32_t  epoch)
inline

◆ sourceId()

const char * ersa::test::MockBluetooth::sourceId ( ) const
inlineoverridevirtual

◆ startAdvertising()

void ersa::test::MockBluetooth::startAdvertising ( )
inlineoverridevirtual

Begin or resume advertising; repeated calls should be safe.

Implements ersa::hal::IBluetooth.

◆ stopAdvertising()

void ersa::test::MockBluetooth::stopAdvertising ( )
inlineoverridevirtual

Stop advertising without necessarily tearing down an established link.

Implements ersa::hal::IBluetooth.

Member Data Documentation

◆ acceptCount_

int ersa::test::MockBluetooth::acceptCount_ {0}
private

◆ advertising_

bool ersa::test::MockBluetooth::advertising_ {false}
private

◆ availabilityCb_

hal::CompanionAvailabilityCallback ersa::test::MockBluetooth::availabilityCb_ {nullptr}
private

◆ availabilityUserData_

void* ersa::test::MockBluetooth::availabilityUserData_ {nullptr}
private

◆ callCb_

hal::CompanionCallCallback ersa::test::MockBluetooth::callCb_ {nullptr}
private

◆ callUserData_

void* ersa::test::MockBluetooth::callUserData_ {nullptr}
private

◆ connCb_

hal::BleConnectionCallback ersa::test::MockBluetooth::connCb_ {nullptr}
private

◆ connected_

bool ersa::test::MockBluetooth::connected_ {false}
private

◆ connUserData_

void* ersa::test::MockBluetooth::connUserData_ {nullptr}
private

◆ dialCount_

int ersa::test::MockBluetooth::dialCount_ {0}
private

◆ dismissSucceeds_

bool ersa::test::MockBluetooth::dismissSucceeds_ {true}
private

◆ hangupCount_

int ersa::test::MockBluetooth::hangupCount_ {0}
private

◆ lastDialed_

char ersa::test::MockBluetooth::lastDialed_[32] {""}
private

◆ lastDismissedUid_

uint32_t ersa::test::MockBluetooth::lastDismissedUid_ {0}
private

◆ lastMediaAction_

hal::CompanionMediaAction ersa::test::MockBluetooth::lastMediaAction_ {hal::CompanionMediaAction::Play}
private

◆ mediaCb_

hal::CompanionMediaCallback ersa::test::MockBluetooth::mediaCb_ {nullptr}
private

◆ mediaCmdCount_

int ersa::test::MockBluetooth::mediaCmdCount_ {0}
private

◆ mediaUserData_

void* ersa::test::MockBluetooth::mediaUserData_ {nullptr}
private

◆ notifCb_

hal::CompanionNotificationCallback ersa::test::MockBluetooth::notifCb_ {nullptr}
private

◆ notificationDismissCount_

int ersa::test::MockBluetooth::notificationDismissCount_ {0}
private

◆ notifUserData_

void* ersa::test::MockBluetooth::notifUserData_ {nullptr}
private

◆ rejectCount_

int ersa::test::MockBluetooth::rejectCount_ {0}
private

◆ timeCb_

hal::CompanionTimeCallback ersa::test::MockBluetooth::timeCb_ {nullptr}
private

◆ timeUserData_

void* ersa::test::MockBluetooth::timeUserData_ {nullptr}
private

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