To model the sensor abstraction, we create a project of type Qt Unit Test and add it as a subproject of entities.pro. The test class could be named entity_sensor. We won't be adding specific unit tests for the entity, but just check that it is working as intended within the use case. Feel free to add unit tests for the API that we'll be adding as an exercise.
By looking at use case broadcaster connects to sensor and broadcaster publishes sensor reading, we notice we need the following API:
- An emitReading(QVariantMap) signal
- A QVariantMap lastReading method to retrieve the last reading emitted for comparison purposes
- A QString identifier method to retrieve the sensor's identifier
Also, we'll probably want ...