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

#include <mock_battery.h>

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

Public Member Functions

 MockBattery (uint16_t mv=3900, uint8_t pct=80, bool conn=true, bool chg=false)
 
Result< void > init () override
 
void sample () override
 
uint16_t millivolts () const override
 Return the latest measured voltage in millivolts.
 
uint8_t percentage () const override
 
bool isConnected () const override
 Report whether a usable battery is connected.
 
bool isCharging () const override
 Report whether external charging power is present.
 
void setMv (uint16_t mv)
 
void setPct (uint8_t pct)
 
void setConn (bool conn)
 
void setChg (bool chg)
 
- Public Member Functions inherited from ersa::hal::IBattery
virtual ~IBattery ()=default
 

Private Attributes

uint16_t mv_
 
uint8_t pct_
 
bool conn_
 
bool chg_
 

Constructor & Destructor Documentation

◆ MockBattery()

ersa::test::MockBattery::MockBattery ( uint16_t  mv = 3900,
uint8_t  pct = 80,
bool  conn = true,
bool  chg = false 
)
inlineexplicit

Member Function Documentation

◆ init()

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

Configure ADC/gauge resources and report whether the backend is usable.

Implements ersa::hal::IBattery.

◆ isCharging()

bool ersa::test::MockBattery::isCharging ( ) const
inlineoverridevirtual

Report whether external charging power is present.

Implements ersa::hal::IBattery.

◆ isConnected()

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

Report whether a usable battery is connected.

Implements ersa::hal::IBattery.

◆ millivolts()

uint16_t ersa::test::MockBattery::millivolts ( ) const
inlineoverridevirtual

Return the latest measured voltage in millivolts.

Implements ersa::hal::IBattery.

◆ percentage()

uint8_t ersa::test::MockBattery::percentage ( ) const
inlineoverridevirtual

Return a bounded estimate; voltage-only boards must not imply precision.

Implements ersa::hal::IBattery.

◆ sample()

void ersa::test::MockBattery::sample ( )
inlineoverridevirtual

Refresh cached telemetry; implementations should keep this bounded.

Implements ersa::hal::IBattery.

◆ setChg()

void ersa::test::MockBattery::setChg ( bool  chg)
inline

◆ setConn()

void ersa::test::MockBattery::setConn ( bool  conn)
inline

◆ setMv()

void ersa::test::MockBattery::setMv ( uint16_t  mv)
inline

◆ setPct()

void ersa::test::MockBattery::setPct ( uint8_t  pct)
inline

Member Data Documentation

◆ chg_

bool ersa::test::MockBattery::chg_
private

◆ conn_

bool ersa::test::MockBattery::conn_
private

◆ mv_

uint16_t ersa::test::MockBattery::mv_
private

◆ pct_

uint8_t ersa::test::MockBattery::pct_
private

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