I am having a problem developing an object-orientated architecture to manage a network of sensors and controls. Currently, I am writing in Python, but this is more of a conceptual question.
I have an Arduino that is wired to a number of sensors. Several times a second, the Arduino sends data to a Raspberry Pi with information about the sensors using a ASCII-based serial communication scheme. An example of a response is below:
#POSITION 47 59203.008;
This response says that position sensor 47 is at position 59203.008 m.
I have a class in my Python program called Arduino that is constantly watching for serial data (on its own thread) and pushes that data to a thread-safe queue.
Each sensor type has a class (i.e. PositionSensor, TemperatureSensor, FlowRateSensor), an address property, and a value property--along with a number of useful methods to perform computations on the data.
My problem is getting the data from the Arduino object to the proper sensor objects. What would be a good pattern for this type of programming problem?
I have considered having my sensors subscribe to the queue, and listen for their sensor-type and address (ignoring anything else), but how do I then tell the sensors that they should check the queue? What class would contain the queue? I feel like there is a model that fits my exact situation.