I've been thinking recently about how to structure the custom profile for some hardware I'm developing, which has a a few sensor components and a button onboard.
What I'd like to have in terms of functionality is this:
- Read data from 4 different sensors
- Set up the ability for each sensor to create a smartphone alert
- Configure the sensor thresholds (or range) which trigger the alerts
- Configure the sensor sample rates
- activate/deactivate sensors if not used to save power
I'm not totally sure what way to go about structuring this, despite having read through the tutorials on custom characteristics and services.
I think there may be two options, but please let me know if there is a better way to go about it:
- Separate into services based on action: A data service, a configuration service, and an alert service
- Data service: holds characteristics containing data from each sensor
- Config service: Holds configuration characteristics that can be set for each sensor
- Alert service: Holds alert notification characteristics to generate alerts preset by config service
- Services based on sensor
- A service for each sensor, containing a data characteristic, a config characteristic, and an alert notification characteristic
- This would assume I could store multiple pieces of data under one charactersistic.
Which, if either, of these is the best approach? are there other ways? and are there things I'm not considering?