Information objects
Details
We need to store the information we are aware of to be able to e.g mark this information as handled or in order not to create new traffic alert messages, when such information is already known.
At the moment (I guess) we are using the metadata of a message to decide where an accident is located. This is however not the best approach. We must use the data property of a message to handle such things, the metadata is purely for transport.
Implementation details
-
Create an information store as a dictionary by topic (for quicker searches), e.g.
{'ACCIDENT': [message1, message2, ...], 'TRAFFIC_JAM': [], ...}
-
Create an Information interface, which should define the basic contract for such messages (e.g. location of accident, time when it was first observed, lane, last turn which the observer made in order to arrive there, etc.)
- Feel free to think about what kind of information can be shared, document what we decided to share for the current project and what could be implemented in the future (part of the task)
-
Bind the functionality to
AutoCar
(perhaps in the wayMessageScheduling
goes about this so the class is still readable)- Export some handy methods though. The user of this functionality should not understand how it works, just be able to:
- Handle new information events
- Dispatch an information event when observed (duplicate handling should be done internally)
- Export some handy methods though. The user of this functionality should not understand how it works, just be able to: