The objective of my application is to control and monitor sensor based equipment (temperature, humidity etc). Data from the equipments is transmitted using GSM, Ethernet or Serial port channels. When data is obtained the program needs to store it in the database and then to notify users in their UI. Users are able to send a command from a certain command list to an equipment.
My current design consists of 3 independent programs:
-
Equipment handling program. It works with the predefined communication channel (GSM, Ethernet, Serial). Actually I have three programs: one for GSM, one for Ethernet, one for Serial. Every program interacts with server program.
-
The single server program. It gets messages from Equipment handling programs, logs them and transmits data to UI programs. And vice versa: it gets commands from UI and sends them to the concrete Equipment handling program.
-
UI program. It visualizes current state of equipments, gets commands from a user and sends them to the server. It is possible to have one or more UI programs.
I use the publish/subscribe pattern to exchange data between these programs. I have no problem with data exchanging.
The question is where to store current state of equipments. Do I need to duplicate state in all programs or just to store data at the server? How to deal with data synchronization between the programs?
I believe that such an architecture is well known and there is a reliable pattern to deal with.