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 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.
 

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 1089 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 1103 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 PCF8574RevLights, and SimpleShiftLight.

Definition at line 1138 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 PCF8574RevLights, and SimpleShiftLight.

Definition at line 1151 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 PCF8574RevLights.

Definition at line 1202 of file SimWheelTypes.hpp.

◆ onBLEdiscovering()

virtual void AbstractUserInterface::onBLEdiscovering ( )
inlinevirtual

Notify device is in discovery mode.

Definition at line 1214 of file SimWheelTypes.hpp.

◆ onConnected()

virtual void AbstractUserInterface::onConnected ( )
inlinevirtual

Notify device is connected.

Reimplemented in PCF8574RevLights, and SimpleShiftLight.

Definition at line 1208 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 PCF8574RevLights.

Definition at line 1222 of file SimWheelTypes.hpp.

◆ onSaveSettings()

virtual void AbstractUserInterface::onSaveSettings ( )
inlinevirtual

Notify that user settings have been saved to flash memory.

Reimplemented in PCF8574RevLights.

Definition at line 1228 of file SimWheelTypes.hpp.

◆ onStart()

virtual void AbstractUserInterface::onStart ( )
inlinevirtual

Called just once after initialization.

Reimplemented in PCF8574RevLights, and SimpleShiftLight.

Definition at line 1157 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 PCF8574RevLights, and SimpleShiftLight.

Definition at line 1181 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 PCF8574RevLights, and SimpleShiftLight.

Definition at line 1194 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 PCF8574RevLights, and SimpleShiftLight.

Definition at line 1237 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 1118 of file SimWheelTypes.hpp.

◆ requiresGaugeTelemetry

bool AbstractUserInterface::requiresGaugeTelemetry = false

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

Definition at line 1122 of file SimWheelTypes.hpp.

◆ requiresPowertrainTelemetry

bool AbstractUserInterface::requiresPowertrainTelemetry = false

Set to true to receive and use powertrain telemetry data.

Definition at line 1116 of file SimWheelTypes.hpp.

◆ requiresRaceControlTelemetry

bool AbstractUserInterface::requiresRaceControlTelemetry = false

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

Definition at line 1120 of file SimWheelTypes.hpp.


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