Reputation: 3334
I am designing custom BLE device protocol. My Device will be one of - Scales, Blood Pressure Monitor, Fitness Band.
The Protocol defines the collection procedure that my Android/iOS app (Collector) will use to collect sensor data from one of these devices.
We can assume that Collector is present 50% of the time and is scanning the air for a broadcasted Device to connect and collect data from it
My question is: What is an effective way of making device connectable, with battery power in mind?
My current approach:
Device is connectable, if
In case (B) Device broadcasts itself e.g. each 1 seconds and is available to be connected to Collector
In case (A) Device broadcasts itself e.g. each 5 seconds and is available to be connected to Collector
As soon as conditions (A)/(B) do not apply, device goes into sleeping mode - not broadcasting anything.
Is this effective approach by means of energy consumption? Or are there any better practices to accomplish "device visibility" ?
P.S. Could not find a better resource for asking that, but this question can be considered a programming question, as it is related to firmware programming
Upvotes: 3
Views: 139
Reputation: 64
See my decision tree for this.
If you link the sleep/off and Start boxes together, the code runs an extremely efficient infinite loop which will turn the device on if you turn it on, or if there is data to share.
Start -----
B) Did the user turn me on?
A) Do I have data to send?
Yes: the device was not turned on by the user, but has data to send; then:
The connecting loop ends when either the timer=2-5min or connection=true. When the timer runs out, proceed to the off/sleep state.
Note: you may or may not want to add an error handler to make the code break to A) just in case.
Upvotes: 3