OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
BatteryService Class Reference

Battery service. More...

#include <InternalServices.hpp>

Public Member Functions

virtual int getLastBatteryLevel ()
 Get the last known battery level (SoC)
 
virtual bool hasBattery ()
 Check if the device can be powered by a battery.
 
virtual bool isBatteryPresent ()
 Check if the battery is detected.
 
virtual void getStatus (BatteryStatus &status)
 Get the full battery status.
 

Additional Inherited Members

- Static Public Member Functions inherited from DependencyManager< BatteryService >
static BatteryServicecall ()
 Get the service provider implementing the service.
 
static void inject (_Args &&...__args)
 Inject a service provider.
 
static void inject (BatteryService *provider)
 Inject a service provider.
 
static void reset ()
 Remove the injected service provider (for testing)
 

Detailed Description

Battery service.

Definition at line 412 of file InternalServices.hpp.

Member Function Documentation

◆ getLastBatteryLevel()

virtual int BatteryService::getLastBatteryLevel ( )
inlinevirtual

Get the last known battery level (SoC)

Returns
int Battery level in the range [0,100]

Definition at line 420 of file InternalServices.hpp.

◆ getStatus()

virtual void BatteryService::getStatus ( BatteryStatus & status)
inlinevirtual

Get the full battery status.

Parameters
statusCurrent battery status

Definition at line 453 of file InternalServices.hpp.

◆ hasBattery()

virtual bool BatteryService::hasBattery ( )
inlinevirtual

Check if the device can be powered by a battery.

Note
This method should always return the same value on each call
Returns
true if this device can be powered by a battery
false if this device is always powered by a external power supply

Definition at line 430 of file InternalServices.hpp.

◆ isBatteryPresent()

virtual bool BatteryService::isBatteryPresent ( )
inlinevirtual

Check if the battery is detected.

Note
If this method returns false, the battery level is unknown
Returns
true if this device has a battery and was detected
false if this device has no battery or the battery is not detected (and the device is powered by a external power supply right now)

Definition at line 443 of file InternalServices.hpp.


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