What has to be done
The controller talks the following communication protocol, using nanopb.
Essentially: GUI sends GuiStatus
containing desired mode parameters, Controller sends ControllerStatus
containing sensor readings and other controller-side info.
As of writing, the GUI is stubbed out and not connected to the controller in any way.
Success criterion for this issue is that:
- We have a C++ abstraction somewhere in GUI code encapsulating talking over the protocol, for example:
ControllerStatus exchangeStatus(GuiStatus status)
(symmetric with the respective controller-side code) - this is a reasonable independent sub-task of this bug. @Miceuz was planning to do this.
- The GUI has a periodic thread that frequently calls that function, giving it parameters somehow obtained from UI element state and storing the resulting ControllerStatus'es in a form from which the UI can be rendered. @jkff is planning to do this.
How do you know it has to be done
That the GUI needs to talk to the controller is self-evident.
The communication protocol is settled, code linked above.
As for whether the exchange should happen periodically or via some other mechanism - I don't know, periodically seems reasonable.
A point of ambiguity is, exactly how is the GUI connected to the controller - I (@jkff) was assuming it will be over serial port but it should be clarified, as I know nothing about serial ports.
Code pointers
I (@jkff) think the whole thing should look roughly like this:
interface ConnectedDevice {
ControllerState exchangeState(GuiState state) // nanopb protos
}
main() {
ConnectedDevice device = ConnectedDeviceOverSerialPort(...serial port parameters...); // but initially a fake
History<ControllerState> state_history(30 seconds); // just a vector that pushes out too old stuff
GuiState desired_state;
on timer separate from QT {
history.Add(device.ExchangeState(desired_state))
}
...bind desired_state to parameters set in the UI...
...bind state_history to graphs and alarms displayed in the UI...
}
The current bug is about doing the ConnectedDevice stuff.