![]() |
RumPi Linux Client 1.0
A wxWidgets desktop dashboard that visualizes a RumPi robot's live sensor data as a condition-reactive scene
|
The client's main window: a tabbed frame (Home scene, Summary tiles, Devices, Logger, Settings) that starts the background poll thread and the alert forwarder, and refreshes its tabs from the events they post. More...
#include <MainWindow.h>
Public Member Functions | |
| MainWindow (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL) | |
| Builds the main window: sets up the menu/status bar and notebook, creates the alert forwarder, and starts the background poll thread (surfacing a failure to start through the alert channel rather than a modal popup). More... | |
| ~MainWindow () | |
| Destroys the window, tearing down the background work as a safety net for paths that bypass OnClose (null-safe and idempotent). More... | |
Protected Member Functions | |
| void | ConstructMenuAndStatusBar () |
| Builds the menu bar and status bar and binds the window's menu, update, logger, and close events. More... | |
| void | ConstructNotebook () |
| Builds the notebook and its five tabs (Home, Summary, Devices, Logger, Settings) and adds it to the window layout. More... | |
| void | ConstructHomePanel () |
| Builds the Home tab's condition-reactive scene panel and adds it to the notebook. More... | |
| void | ConstructSummaryPanel () |
| Builds the Summary tab: a three-per-row grid of at-a-glance sensor tiles, stashing each tile's value label for live updates. More... | |
| void | ConstructDevicesPanel () |
| Builds the Devices tab: a scrollable, three-column grid that will hold one tile per component instance. More... | |
| void | ConstructLoggerPanel () |
| Builds the Logger tab: a data-view control with icon/time/level/description columns, backed by the log model. More... | |
| void | ConstructSettingsPanel () |
| Builds the (currently empty) Settings tab and adds it to the notebook. More... | |
| void | TeardownBackgroundWork () |
| Stops the background poll thread and then tears down the alert forwarder, in that order (stop the producer before the consumer). More... | |
| wxStaticText * | CreateSummaryTile (wxWindow *parent, wxSizer *tileGridSizer, const wxString &title) |
| Builds one titled summary tile with a large centered value label and adds it to the grid. More... | |
| void | UpdateSummaryPanel (const RumPi::SelectedSensorReadings &readings) |
| Refreshes every summary tile's value label from a sensor snapshot (temperature, humidity, gases, particulates, air quality, motion, wind, and light) and re-flows the tiles. More... | |
| virtual void | OnClose (wxCloseEvent &event) |
| Close handler: tears down the background work before the window is destroyed (the worker and forwarder both post events to us), then lets the default handler proceed. More... | |
| virtual void | OnExit (wxCommandEvent &event) |
| Exit handler: closes the window. More... | |
| virtual void | OnAbout (wxCommandEvent &event) |
| About handler: shows the application's about dialog. More... | |
| virtual void | OnShowLogs (wxCommandEvent &event) |
| "Show Log Files" handler: opens the log folder in the platform's file manager, falling back to a message box with the path if that isn't possible (e.g. More... | |
| virtual void | OnRumPiUpdate (wxThreadEvent &event) |
| RumPi-update handler (main thread): refreshes the Summary tiles and Home scene from the event's snapshot, then defensively parses the component JSON payload and creates/refreshes one device tile per named component instance. More... | |
| void | RefreshDeviceTiles (const std::string &componentJson) |
| Parses the component JSON payload and creates/refreshes one device tile per named component instance. More... | |
| virtual void | OnLoggerUpdate (wxThreadEvent &event) |
| Logger-update handler (main thread): appends the event's log line to the logger model. More... | |
Protected Attributes | |
| wxNotebook * | myNotebook |
| The tab container. More... | |
| HomeScenePanel * | myHomeScenePanel |
| The Home tab's condition-reactive backdrop. More... | |
| wxPanel * | mySummaryPanel |
| The Summary tab (at-a-glance tiles). More... | |
| wxPanel * | myDevicesPanel |
| The Devices tab. More... | |
| wxPanel * | myLoggerPanel |
| The Logger tab. More... | |
| wxPanel * | mySettingsPanel |
| The Settings tab. More... | |
| wxGridSizer * | myDataViewGridSizer |
| The grid sizer holding the device tiles. More... | |
| wxScrolledWindow * | myDevicesScrollWindow |
| The scrollable container for the device tiles. More... | |
| wxDataViewCtrl * | myLoggerDataViewCtrl |
| The data-view control showing the log. More... | |
| LoggerListData * | myLoggerListDataModel |
| The model backing the log control. More... | |
| LoggerEventForwarder * | myLoggerEventForwarder |
| Forwards AlertManager alerts to the Logger tab. More... | |
| wxStaticText * | myTemperatureValue |
| The Temperature tile's value label. More... | |
| wxStaticText * | myHumidityValue |
| The Humidity tile's value label. More... | |
| wxStaticText * | myAirQualityValue |
| The Air Quality tile's value label. More... | |
| wxStaticText * | myPmTwoPointFiveValue |
| The PM2.5 tile's value label. More... | |
| wxStaticText * | myTVOCValue |
| The TVOC tile's value label. More... | |
| wxStaticText * | myFormaldehydeValue |
| The Formaldehyde tile's value label. More... | |
| wxStaticText * | myCO2Value |
| The CO2 tile's value label. More... | |
| wxStaticText * | myMotionValue |
| The Motion tile's value label. More... | |
| wxStaticText * | myWindSpeedValue |
| The Wind Speed tile's value label. More... | |
| wxStaticText * | myLightValue |
| The Light tile's value label. More... | |
| std::unordered_map< std::string, ComponentPanel * > | myComponentDataCollection |
| RumPiManagerThread * | myRumPiManagerThread |
The client's main window: a tabbed frame (Home scene, Summary tiles, Devices, Logger, Settings) that starts the background poll thread and the alert forwarder, and refreshes its tabs from the events they post.
| MainWindow::MainWindow | ( | wxWindow * | parent, |
| wxWindowID | id = wxID_ANY, |
||
| const wxString & | title = wxEmptyString, |
||
| const wxPoint & | pos = wxDefaultPosition, |
||
| const wxSize & | size = wxSize(500, 300), |
||
| long | style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL |
||
| ) |
Builds the main window: sets up the menu/status bar and notebook, creates the alert forwarder, and starts the background poll thread (surfacing a failure to start through the alert channel rather than a modal popup).
| [in] | parent | The parent window (nullptr for a top-level frame). |
| [in] | id | The window identifier. |
| [in] | title | The window title. |
| [in] | pos | The initial position. |
| [in] | size | The initial size. |
| [in] | style | The frame style flags. |
| MainWindow::~MainWindow | ( | ) |
Destroys the window, tearing down the background work as a safety net for paths that bypass OnClose (null-safe and idempotent).
|
protected |
Builds the Devices tab: a scrollable, three-column grid that will hold one tile per component instance.
|
protected |
Builds the Home tab's condition-reactive scene panel and adds it to the notebook.
|
protected |
Builds the Logger tab: a data-view control with icon/time/level/description columns, backed by the log model.
|
protected |
Builds the menu bar and status bar and binds the window's menu, update, logger, and close events.
|
protected |
Builds the notebook and its five tabs (Home, Summary, Devices, Logger, Settings) and adds it to the window layout.
|
protected |
Builds the (currently empty) Settings tab and adds it to the notebook.
|
protected |
Builds the Summary tab: a three-per-row grid of at-a-glance sensor tiles, stashing each tile's value label for live updates.
|
protected |
Builds one titled summary tile with a large centered value label and adds it to the grid.
| [in] | parent | The parent window for the tile. |
| [in] | tileGridSizer | The grid sizer to add the tile to. |
| [in] | title | The tile's title. |
|
protectedvirtual |
About handler: shows the application's about dialog.
| [in] | event | The command event. |
|
protectedvirtual |
Close handler: tears down the background work before the window is destroyed (the worker and forwarder both post events to us), then lets the default handler proceed.
| [in] | event | The close event. |
|
protectedvirtual |
Exit handler: closes the window.
| [in] | event | The command event. |
|
protectedvirtual |
Logger-update handler (main thread): appends the event's log line to the logger model.
| [in] | event | The thread event carrying the log line. |
|
protectedvirtual |
RumPi-update handler (main thread): refreshes the Summary tiles and Home scene from the event's snapshot, then defensively parses the component JSON payload and creates/refreshes one device tile per named component instance.
| [in] | event | The thread event carrying the snapshot and component JSON. |
|
protectedvirtual |
"Show Log Files" handler: opens the log folder in the platform's file manager, falling back to a message box with the path if that isn't possible (e.g.
a headless kiosk) or if no log path is available yet.
| [in] | event | The command event. |
|
protected |
Parses the component JSON payload and creates/refreshes one device tile per named component instance.
Split out of OnRumPiUpdate and called inside a try/catch there so a bad_alloc (newing panels) or a malformed payload can't escape the wx event handler and terminate the app.
| [in] | componentJson | The raw component JSON string from the update event. |
|
protected |
Stops the background poll thread and then tears down the alert forwarder, in that order (stop the producer before the consumer).
Null-safe and idempotent, so both OnClose and the destructor can call it.
|
protected |
Refreshes every summary tile's value label from a sensor snapshot (temperature, humidity, gases, particulates, air quality, motion, wind, and light) and re-flows the tiles.
| [in] | readings | The sensor snapshot to display. |
|
protected |
The Air Quality tile's value label.
|
protected |
The CO2 tile's value label.
|
protected |
|
protected |
The grid sizer holding the device tiles.
|
protected |
The Devices tab.
|
protected |
The scrollable container for the device tiles.
|
protected |
The Formaldehyde tile's value label.
|
protected |
The Home tab's condition-reactive backdrop.
|
protected |
The Humidity tile's value label.
|
protected |
The Light tile's value label.
|
protected |
The data-view control showing the log.
|
protected |
Forwards AlertManager alerts to the Logger tab.
|
protected |
The model backing the log control.
|
protected |
The Logger tab.
|
protected |
The Motion tile's value label.
|
protected |
The tab container.
|
protected |
The PM2.5 tile's value label.
|
protected |
|
protected |
The Settings tab.
|
protected |
The Summary tab (at-a-glance tiles).
|
protected |
The Temperature tile's value label.
|
protected |
The TVOC tile's value label.
|
protected |
The Wind Speed tile's value label.