Alarm Message Service: Introduction
Table of Contents
Brief description
We don't know exactly who we have to inform about an alarm, definitely the HMI, probably the mode handler, maybe we have to give a MES report for errors. And it may also be that we have to inform the signal tower, etc.… So now the idea is that we build an alarm message distributor. Every object that wants to be informed about alarms can subscribe to the distributor and gets the message data transfer object, that means every object that wants to subscribe to the service should implement the already existing interface IAlarmMessageService
. In our distribution list, the IAlarmMessageDto
s will be queued in two queues, one for handle and one for clear. In the handle queue, messages starting from the stop category stop immediately are placed at the beginning of the queue. The messages only line up in the queues, another task fetches the messages from the queue and then distributes them to the subscribers of our distribution list. The distribution list is thus a resource that is used by two tasks in the project. Since the DTO interface is really just an address with a signature (methods/properties), we don't need an extra way for the status changes from the HMI. As a reminder, in the abstract message class the mutable properties are already prepared for multitasking use. To be able to implement all this, we first need a bit of infrastructure, which we will now build. We need a list \ (-◡-) /, since we do not need index-based operations but only tinker with head and tail, we build a linked list, since it is easier than an array list, where we have to allocate memory, copy and free the old content of the list. Our list will only store objects for now, and will not be thread safe. All other lists and queues will then be built on top of this list, and this is where the abstract factories will finally come into play to reduce the complexity of usage. Since all lists, except the single thread object list, are only wrapper classes, only the single thread object list is fully implemented here. For the others we show the interface, FB_init, FB_exit and one or two methods, so that the principle becomes clear.
For methods that take longer than one cycle, we need a return value to see if everything is done. As always, we unify this so we can use it for everything. This will be our enumeration ExecutionState
.