EX-Display
EX-Display
Loading...
Searching...
No Matches
/home/runner/work/EX-Display/EX-Display/Controller.h
Go to the documentation of this file.
1/*
2 * © 2024 Peter Cole
3 *
4 * This is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * It is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this code. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef CONTROLLER_H
19#define CONTROLLER_H
20
21#include "CallbackInterface.h"
22#include "DisplayManager.h"
23#include "InputManager.h"
24#include "Logger.h"
25#include "ScreenManager.h"
26#include <Arduino.h>
27
32public:
41 Controller(Stream *consoleStream, Stream *commandStationStream, DisplayManager *displayManager,
42 InputManager *inputManager, ScreenManager *screenManager, Logger *logger,
43 unsigned long pauseDisplayUpdatesUntil = 0);
44
46 void begin();
47
50 void update();
51
56 void updateScreen(uint8_t screenId, uint8_t row, const char *text) override;
57
60 void onInputAction(InputAction action) override;
61
63 ~Controller() override;
64
65private:
73
77
81};
82
83#endif // CONTROLLER_H
InputAction
Input action to be returned from the user interface to control screens and displays.
Definition InputActions.h:22
Interface class to use for callbacks.
Definition CallbackInterface.h:26
Class for the central controller for EX-Display. All application activities are controlled through th...
Definition Controller.h:31
InputManager * _inputManager
Definition Controller.h:69
void begin()
Call once to start displays and input.
Definition Controller.cpp:35
void _selectPreviousScreen(DisplayInterface *display)
Selects the previous screen for the selected display.
Definition Controller.cpp:144
bool _pauseDisplayUpdates
Definition Controller.h:72
void update()
Processes all ongoing activities, monitoring streams, receiving user input, updates displays,...
Definition Controller.cpp:42
~Controller() override
Destructor for the Controller.
Definition Controller.cpp:136
void updateScreen(uint8_t screenId, uint8_t row, const char *text) override
Method to implement updating a screen.
Definition Controller.cpp:81
void _selectNextScreen(DisplayInterface *display)
Selects the next screen for the selected display.
Definition Controller.cpp:160
Stream * _commandStationStream
Definition Controller.h:67
unsigned long _pauseDisplayUpdatesUntil
Definition Controller.h:71
ScreenManager * _screenManager
Definition Controller.h:70
Stream * _consoleStream
Definition Controller.h:66
DisplayManager * _displayManager
Definition Controller.h:68
void onInputAction(InputAction action) override
Method to implement to respond to an input action.
Definition Controller.cpp:93
Class to abstract away all physical display implementation to enable multiple display types.
Definition DisplayInterface.h:36
Manages all physical displays.
Definition DisplayManager.h:26
Definition InputManager.h:27
Class to enable simple logging to a Stream object with different log levels This enables embedding pe...
Definition Logger.h:35
Class to manage all EX-Display screens.
Definition ScreenManager.h:24
Class to mock the basic Stream function equivalent of the Arduino framework.
Definition Stream.h:25