I'm look for advice or references to help me code a multi-layer event driven system.
The software is broken up into several layers:
The bottom layer is in an infinite loop. It takes input from a device and calculates two doubles. When the doubles cross a certain threshold (which will happen repeatedly), I'd like this layer to pass messages up to the layer above it (such as an events).
The intermediate layer will act as a state machine, taking the input events from the bottom layer. Based on the current state and the input, it will generate an event to update the top layer.
The top layer will be a GUI. It should take events from the middle layer in order to update the display and functionality.
This is the basic structure (there are actually more layers in between, but if I can figure out the 3 layers I should be able to add more). If it's important, I'm planning to use Qt for the GUI.
So basically I'm just trying to figure out how I should organize this. Do I use callback functions, or messages, or something else? Are there any similar examples floating around?