EX-Display
EX-Display
Loading...
Searching...
No Matches
Controller Class Reference

Class for the central controller for EX-Display. All application activities are controlled through this class to manage screens, displays, and user input. All devices have their begin or init type methods called from Controller::begin(). More...

#include <Controller.h>

Inheritance diagram for Controller:
[legend]
Collaboration diagram for Controller:
[legend]

Public Member Functions

 Controller (Stream *consoleStream, Stream *commandStationStream, DisplayManager *displayManager, InputManager *inputManager, ScreenManager *screenManager, Logger *logger, unsigned long pauseDisplayUpdatesUntil=0)
 Constructor for this Controller.
 
void begin ()
 Call once to start displays and input.
 
void update ()
 Processes all ongoing activities, monitoring streams, receiving user input, updates displays, etc. Call at least once per main loop iteration.
 
void updateScreen (uint8_t screenId, uint8_t row, const char *text) override
 Method to implement updating a screen.
 
void onInputAction (InputAction action) override
 Method to implement to respond to an input action.
 
 ~Controller () override
 Destructor for the Controller.
 
- Public Member Functions inherited from CallbackInterface
void setLogger (Logger *logger)
 Set the logger instance to use for diagnostic logging.
 
virtual ~CallbackInterface ()=default
 Virtual destructor for the CallBackInterface.
 

Private Member Functions

void _selectPreviousScreen (DisplayInterface *display)
 Selects the previous screen for the selected display.
 
void _selectNextScreen (DisplayInterface *display)
 Selects the next screen for the selected display.
 

Private Attributes

Stream_consoleStream
 
Stream_commandStationStream
 
DisplayManager_displayManager
 
InputManager_inputManager
 
ScreenManager_screenManager
 
unsigned long _pauseDisplayUpdatesUntil
 
bool _pauseDisplayUpdates
 

Additional Inherited Members

- Protected Attributes inherited from CallbackInterface
Logger_logger = nullptr
 Pointer to the logger interface.
 

Detailed Description

Class for the central controller for EX-Display. All application activities are controlled through this class to manage screens, displays, and user input. All devices have their begin or init type methods called from Controller::begin().

Constructor & Destructor Documentation

◆ Controller()

Controller::Controller ( Stream consoleStream,
Stream commandStationStream,
DisplayManager displayManager,
InputManager inputManager,
ScreenManager screenManager,
Logger logger,
unsigned long  pauseDisplayUpdatesUntil = 0 
)

Constructor for this Controller.

Parameters
consoleStreamPointer to the Stream for console interactions and log output
commandStationStreamPointer to the incoming Stream connected to EX-CommandStation
displayManagerPointer to the DisplayManager instance
inputManagerPointer to the InputManager instance
screenManagerPointer to the ScreenManager instance
loggerPointer to the Logger instance
pauseDisplayUpdatesUntilTime in milliseconds the EX-Display version will be displayed until

◆ ~Controller()

Controller::~Controller ( )
override

Destructor for the Controller.

Member Function Documentation

◆ _selectNextScreen()

void Controller::_selectNextScreen ( DisplayInterface display)
private

Selects the next screen for the selected display.

Parameters
displayPointer to the DisplayInterface to set
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _selectPreviousScreen()

void Controller::_selectPreviousScreen ( DisplayInterface display)
private

Selects the previous screen for the selected display.

Parameters
displayPointer to the DisplayInterface to set
Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin()

void Controller::begin ( )

Call once to start displays and input.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onInputAction()

void Controller::onInputAction ( InputAction  action)
overridevirtual

Method to implement to respond to an input action.

Parameters
actionPRESS_UP, PRESS_DOWN, PRESS_LEFT, PRESS_RIGHT, PRESS_CENTRE

Implements CallbackInterface.

Here is the call graph for this function:

◆ update()

void Controller::update ( )

Processes all ongoing activities, monitoring streams, receiving user input, updates displays, etc. Call at least once per main loop iteration.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateScreen()

void Controller::updateScreen ( uint8_t  screenId,
uint8_t  row,
const char *  text 
)
overridevirtual

Method to implement updating a screen.

Parameters
screenIdID of the screen to update
rowRow number to update
textText to update

Implements CallbackInterface.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _commandStationStream

Stream* Controller::_commandStationStream
private

◆ _consoleStream

Stream* Controller::_consoleStream
private

◆ _displayManager

DisplayManager* Controller::_displayManager
private

◆ _inputManager

InputManager* Controller::_inputManager
private

◆ _pauseDisplayUpdates

bool Controller::_pauseDisplayUpdates
private

◆ _pauseDisplayUpdatesUntil

unsigned long Controller::_pauseDisplayUpdatesUntil
private

◆ _screenManager

ScreenManager* Controller::_screenManager
private

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