Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
base_hmi.h
Go to the documentation of this file.
1//
2// Copyright (c) 2023, DefenceX PTY LTD
3//
4// This file is part of the VivoeX project developed by DefenceX.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
12
13#ifndef HMICORE_STATES_BASE_HMI_H_
14#define HMICORE_STATES_BASE_HMI_H_
15
16#include <glog/logging.h>
17
18#include <memory>
19#include <string>
20
21#include "hmicore/gva.h"
23#include "hmicore/screen_gva.h"
25#include "hmicore/tinyfsm.h"
26#include "hmicore/view_gva.h"
27
28namespace gva {
29
30//
31// Event Declarations
32//
57
59struct Hmi : tinyfsm::Fsm<Hmi> {
61 virtual ~Hmi() = default;
63 virtual void react(EventKeyPowerOn const &) { return; }
65 virtual void react(EventKeySA const &) { return; }
67 virtual void react(EventKeyWPN const &) { return; }
69 virtual void react(EventKeyDEF const &) { return; }
71 virtual void react(EventKeySYS const &) { return; }
73 virtual void react(EventKeyDRV const &) { return; }
75 virtual void react(EventKeySTR const &) { return; }
77 virtual void react(EventKeyCOM const &) { return; }
79 virtual void react(EventKeyBMS const &) { return; }
81 virtual void react(EventKeyAlarms const &) { return; }
83 virtual void react(EventKeyFunction const &) { return; }
85 virtual void entry(void) { return; }
87 virtual void exit(void) { return; }
88
89 protected:
91 static std::shared_ptr<ViewGvaManager> manager_;
103 static std::shared_ptr<Updater> updater_;
105 static std::shared_ptr<ScreenGva> screen_render_;
107 static std::shared_ptr<rendererMap> map_;
111 static bool alarmson_;
112
113 public:
115 static void KeySide(GvaKeyEnum key);
117 static GvaKeyEnum Key(GvaKeyEnum key);
119 static GvaKeyEnum KeySA(GvaKeyEnum key, GvaKeyEnum *current);
121 static GvaKeyEnum KeyWPN(GvaKeyEnum key);
123 static GvaKeyEnum KeyDEF(GvaKeyEnum key);
125 static GvaKeyEnum KeySYS(GvaKeyEnum key);
127 static GvaKeyEnum KeyDRV(GvaKeyEnum key);
129 static GvaKeyEnum KeySTR(GvaKeyEnum key);
131 static GvaKeyEnum KeyCOM(GvaKeyEnum key);
133 static GvaKeyEnum KeyBMS(GvaKeyEnum key);
135 static GvaKeyEnum KeyAlarms(GvaKeyEnum key); // Nothing to do in base class
137 static void Reset();
139 static void SetCanvasPng(const std::string &file);
141 static ScreenGva *GetRendrer() { return screen_render_.get(); }
143 static Screen *GetScreen() { return &screen_; }
145 static void Labels(LabelModeEnum labels);
147 static void ClearAlarms(std::shared_ptr<ScreenGva> screen_render);
148};
149
150} // namespace gva
151
152#endif // HMICORE_STATES_BASE_HMI_H_
Class definition of the CommonTaskKeys.
Definition gva.h:465
These are the labels on the left and right of the screen.
Definition gva.h:324
Class definition of the ScreenGva.
Definition screen_gva.h:142
Definition tinyfsm.h:89
GvaFunctionEnum
This is where you define all your screens, these are just the defaults.
Definition gva.h:218
LabelModeEnum
Enum for the label mode.
Definition gva.h:39
GvaKeyEnum
These are physical GVA keys around the display.
Definition gva.h:67
Struct definition of the Canvas.
Definition screen_gva.h:35
Event for Alarms key press.
Definition base_hmi.h:51
Event for BMS key press.
Definition base_hmi.h:49
Event for COM key press.
Definition base_hmi.h:47
Event for DEF key press.
Definition base_hmi.h:39
Event for DRV key press.
Definition base_hmi.h:43
Event for Function key press.
Definition base_hmi.h:53
GvaKeyEnum key
The key pressed.
Definition base_hmi.h:55
Definition base_hmi.h:33
Event for SA key press.
Definition base_hmi.h:35
Event for STR key press.
Definition base_hmi.h:45
Event for SYS key press.
Definition base_hmi.h:41
Event for WPN key press.
Definition base_hmi.h:37
State Machine Base Class Declaration.
Definition base_hmi.h:59
virtual void react(EventKeyFunction const &)
Nothing to do in base class.
Definition base_hmi.h:83
static GvaKeyEnum KeyBMS(GvaKeyEnum key)
Process BMS key press.
Definition bms.cc:60
virtual void exit(void)
no exit actions
Definition base_hmi.h:87
static Canvas canvas_
The screen canvas.
Definition base_hmi.h:99
virtual void react(EventKeySTR const &)
Nothing to do in base class.
Definition base_hmi.h:75
virtual void react(EventKeyCOM const &)
Nothing to do in base class.
Definition base_hmi.h:77
static GvaKeyEnum KeyDEF(GvaKeyEnum key)
Process DEF key press.
Definition def.cc:19
static ScreenGva * GetRendrer()
Get the screen render object.
Definition base_hmi.h:141
virtual void react(EventKeyDRV const &)
Nothing to do in base class.
Definition base_hmi.h:73
static GvaKeyEnum KeySYS(GvaKeyEnum key)
Process SYS key press.
Definition sys.cc:18
virtual void react(EventKeyWPN const &)
Nothing to do in base class.
Definition base_hmi.h:67
static ResolutionType view_
The resolution type.
Definition base_hmi.h:93
static std::shared_ptr< ScreenGva > screen_render_
The screen render object.
Definition base_hmi.h:105
static Screen * GetScreen()
Get the screen object.
Definition base_hmi.h:143
static GvaFunctionEnum lastState_
The last state.
Definition base_hmi.h:109
virtual void react(EventKeyAlarms const &)
Nothing to do in base class.
Definition base_hmi.h:81
static GvaKeyEnum KeySTR(GvaKeyEnum key)
Process STR key press.
Definition str.cc:17
virtual ~Hmi()=default
The default constructor.
virtual void react(EventKeySA const &)
Nothing to do in base class.
Definition base_hmi.h:65
virtual void react(EventKeyBMS const &)
Nothing to do in base class.
Definition base_hmi.h:79
static GvaKeyEnum Key(GvaKeyEnum key)
Process key presses.
Definition hmi_gva.cc:272
static GvaKeyEnum KeySA(GvaKeyEnum key, GvaKeyEnum *current)
Process SA key press.
Definition sa.cc:18
static FunctionSelect top_
The function select widget.
Definition base_hmi.h:95
static bool alarmson_
True is alarms being displayed.
Definition base_hmi.h:111
virtual void react(EventKeyDEF const &)
Nothing to do in base class.
Definition base_hmi.h:69
static void ClearAlarms(std::shared_ptr< ScreenGva > screen_render)
Clear the alarms.
Definition hmi_gva.cc:331
static void KeySide(GvaKeyEnum key)
Process side label key presses.
Definition hmi_gva.cc:213
static void Reset()
Reset the HMI widgets.
Definition hmi_gva.cc:136
static std::shared_ptr< ViewGvaManager > manager_
The HMI manager.
Definition base_hmi.h:91
static GvaKeyEnum KeyDRV(GvaKeyEnum key)
Process DRV key press.
Definition drv.cc:23
static CommonTaskKeys bottom_
The common task keys at the bottom of the screen.
Definition base_hmi.h:97
static GvaKeyEnum KeyAlarms(GvaKeyEnum key)
Process Alarms key press.
Definition alarms.cc:17
virtual void entry(void)
entry actions in some States
Definition base_hmi.h:85
static void Labels(LabelModeEnum labels)
Toggle onscreen label states.
Definition hmi_gva.cc:157
virtual void react(EventKeySYS const &)
Nothing to do in base class.
Definition base_hmi.h:71
static void SetCanvasPng(const std::string &file)
Set a screen PNG file as background.
Definition hmi_gva.cc:130
static std::shared_ptr< Updater > updater_
The updater to use.
Definition base_hmi.h:103
static GvaKeyEnum KeyCOM(GvaKeyEnum key)
Process COM key press.
Definition com.cc:17
static Screen screen_
The screen.
Definition base_hmi.h:101
static std::shared_ptr< rendererMap > map_
A map object.
Definition base_hmi.h:107
virtual void react(EventKeyPowerOn const &)
Nothing to do in base class.
Definition base_hmi.h:63
static GvaKeyEnum KeyWPN(GvaKeyEnum key)
Process WPN key press.
Definition wpn.cc:19
Struct for the resolution.
Definition gva.h:571
Struct definition of the Screen.
Definition screen_gva.h:85
Definition tinyfsm.h:53