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

Abstract interface for notifications and telemetry display. More...

#include <SimWheelTypes.hpp>

Public Member Functions

 AbstractUserInterface (const AbstractUserInterface &)=delete
 
AbstractUserInterfaceoperator= (const AbstractUserInterface &)=delete
 
virtual uint8_t getMaxFPS ()
 Get the maximum FPS supported by the underlying hardware.
 
virtual uint16_t getStackSize ()
 Get the stack size required by this user interface.
 
virtual void onStart ()
 Called just once after initialization.
 
virtual void onTelemetryData (const TelemetryData *pTelemetryData)
 Notify new telemetry data.
 
virtual void serveSingleFrame (uint32_t elapsedMs)
 Draw a single frame.
 
virtual void onBitePoint (uint8_t bitePoint)
 Notify a change in the current bite point.
 
virtual void onConnected ()
 Notify device is connected.
 
virtual void onBLEdiscovering ()
 Notify device is in discovery mode.
 
virtual void onLowBattery ()
 Notify low battery.
 
virtual void onSaveSettings ()
 Notify that user settings have been saved to flash memory.
 
virtual void onUserInput (uint8_t inputNumber)
 Notify user input.
 
virtual void shutdown ()
 Cut power to the UI hardware.
 

Public Attributes

bool requiresPowertrainTelemetry = false
 Set to true to receive and use powertrain telemetry data.
 
bool requiresECUTelemetry = false
 Set to true to receive and use ECU telemetry data.
 
bool requiresRaceControlTelemetry = false
 Set to true to receive and use race control telemetry data.
 
bool requiresGaugeTelemetry = false
 Set to true to receive and use telemetry data for gauges.
 
bool requiresWheelTelemetry = false
 Set to true to receive and use wheel telemetry data.
 

Protected Member Functions

uint32_t frameTimer (uint32_t &timerVariable, uint32_t elapsedTimeMs, uint32_t timeLimitMs)
 Simple timer.
 

Detailed Description

Abstract interface for notifications and telemetry display.

Note
All methods are called in a separate low-priority thread

Definition at line 1581 of file SimWheelTypes.hpp.

Constructor & Destructor Documentation

◆ ~AbstractUserInterface()

virtual AbstractUserInterface::~AbstractUserInterface ( )
inlinevirtual

Definition at line 1624 of file SimWheelTypes.hpp.

Member Function Documentation

◆ frameTimer()

uint32_t AbstractUserInterface::frameTimer ( uint32_t & timerVariable,
uint32_t elapsedTimeMs,
uint32_t timeLimitMs )
inlineprotected

Simple timer.

Note
To be used in AbstractUserInterface::serveSingleFrame(). Initialize the timer variable to zero.
Parameters
timerVariableTimer variable.
elapsedTimeMsTime elapsed since last call in miliseconds.
timeLimitMsExpiration time in miliseconds.
Returns
uint32_t The count of times the timer has expired in the elapsed time.

Definition at line 1595 of file SimWheelTypes.hpp.

◆ getMaxFPS()

virtual uint8_t AbstractUserInterface::getMaxFPS ( )
inlinevirtual

Get the maximum FPS supported by the underlying hardware.

Note
You must override this method to receive telemetry data
Returns
uint8_t Frames per second.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1634 of file SimWheelTypes.hpp.

◆ getStackSize()

virtual uint16_t AbstractUserInterface::getStackSize ( )
inlinevirtual

Get the stack size required by this user interface.

Warning
You should override this method if you get "stack canary" or "dual exception" errors.
Returns
uin16_t Stack size in bytes for the notification/frameserver daemon. Return zero to use a default value. Increase the stack size if you get "stack canary" or "dual exception" errors and reboots.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1647 of file SimWheelTypes.hpp.

◆ onBitePoint()

virtual void AbstractUserInterface::onBitePoint ( uint8_t bitePoint)
inlinevirtual

Notify a change in the current bite point.

Parameters
bitePointLast known bite point.

Reimplemented in OledTelemetry128x64, and PCF8574RevLights.

Definition at line 1698 of file SimWheelTypes.hpp.

◆ onBLEdiscovering()

virtual void AbstractUserInterface::onBLEdiscovering ( )
inlinevirtual

Notify device is in discovery mode.

Reimplemented in OledTelemetry128x64.

Definition at line 1710 of file SimWheelTypes.hpp.

◆ onConnected()

virtual void AbstractUserInterface::onConnected ( )
inlinevirtual

Notify device is connected.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1704 of file SimWheelTypes.hpp.

◆ onLowBattery()

virtual void AbstractUserInterface::onLowBattery ( )
inlinevirtual

Notify low battery.

Note
Called at timed intervals while the low battery condition persists.

Reimplemented in OledTelemetry128x64, and PCF8574RevLights.

Definition at line 1718 of file SimWheelTypes.hpp.

◆ onSaveSettings()

virtual void AbstractUserInterface::onSaveSettings ( )
inlinevirtual

Notify that user settings have been saved to flash memory.

Reimplemented in OledTelemetry128x64, and PCF8574RevLights.

Definition at line 1724 of file SimWheelTypes.hpp.

◆ onStart()

virtual void AbstractUserInterface::onStart ( )
inlinevirtual

Called just once after initialization.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1653 of file SimWheelTypes.hpp.

◆ onTelemetryData()

virtual void AbstractUserInterface::onTelemetryData ( const TelemetryData * pTelemetryData)
inlinevirtual

Notify new telemetry data.

Parameters
pTelemetryDataPointer to telemetry data. Can be null. Safe to store for later use.
Note
For this method to get called, user code must meet the following requirements:
  • getMaxFPS must return non-zero.
  • At instance creation, one of the requiresXXXTelemetry attributes must be set to true.
Always called just before serveSingleFrame(). This method may draw a display frame into a buffer, while serveSingleFrame() just displays that frame buffer.
pTelemetryData is null when no telemetry data has been received in the previous two seconds. May be used to turn the display off.
Must not enter an infinite loop. Must return as soon as possible.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1677 of file SimWheelTypes.hpp.

◆ onUserInput()

virtual void AbstractUserInterface::onUserInput ( uint8_t inputNumber)
inlinevirtual

Notify user input.

Parameters
inputNumberInput number that was pressed

Reimplemented in OledTelemetry128x64.

Definition at line 1731 of file SimWheelTypes.hpp.

◆ serveSingleFrame()

virtual void AbstractUserInterface::serveSingleFrame ( uint32_t elapsedMs)
inlinevirtual

Draw a single frame.

Parameters
elapsedMsElapsed milliseconds since last call.
Note
Called at timed intervals when no notifications are pending. Do not assume perfect timing.
Must not enter an infinite loop. Must return as soon as possible.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1690 of file SimWheelTypes.hpp.

◆ shutdown()

virtual void AbstractUserInterface::shutdown ( )
inlinevirtual

Cut power to the UI hardware.

Note
This is a command, not a notification. Not reversible.

Reimplemented in OledTelemetry128x64, PCF8574RevLights, and SimpleShiftLight.

Definition at line 1740 of file SimWheelTypes.hpp.

Member Data Documentation

◆ requiresECUTelemetry

bool AbstractUserInterface::requiresECUTelemetry = false

Set to true to receive and use ECU telemetry data.

Definition at line 1610 of file SimWheelTypes.hpp.

◆ requiresGaugeTelemetry

bool AbstractUserInterface::requiresGaugeTelemetry = false

Set to true to receive and use telemetry data for gauges.

Definition at line 1614 of file SimWheelTypes.hpp.

◆ requiresPowertrainTelemetry

bool AbstractUserInterface::requiresPowertrainTelemetry = false

Set to true to receive and use powertrain telemetry data.

Definition at line 1608 of file SimWheelTypes.hpp.

◆ requiresRaceControlTelemetry

bool AbstractUserInterface::requiresRaceControlTelemetry = false

Set to true to receive and use race control telemetry data.

Definition at line 1612 of file SimWheelTypes.hpp.

◆ requiresWheelTelemetry

bool AbstractUserInterface::requiresWheelTelemetry = false

Set to true to receive and use wheel telemetry data.

Definition at line 1616 of file SimWheelTypes.hpp.


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