android - Energy economy: BLE device - when to make connectable? -
i designing custom ble device protocol. device 1 of - scales, blood pressure monitor, fitness band.
the protocol defines collection procedure android/ios app (collector) use collect sensor data 1 of these devices.
we can assume collector present 50% of time , scanning air broadcasted device connect , collect data it
my question is: effective way of making device connectable, battery power in mind?
my current approach:
device connectable, if
- (a) has unsent measurements user,
- (b) user turned on (by stepping on scales, pushing button or whatever)
in case (b) device broadcasts e.g. each 1 seconds , available connected collector
in case (a) device broadcasts e.g. each 5 seconds , available connected collector
as conditions (a)/(b) not apply, device goes sleeping mode - not broadcasting anything.
is effective approach means of energy consumption? or there better practices accomplish "device visibility" ?
p.s. not find better resource asking that, question can considered programming question, related firmware programming
see decision tree this.
if link sleep/off , start boxes together, code runs extremely efficient infinite loop turn device on if turn on, or if there data share.
start -----
b) did user turn me on?
- no: proceed a)
- yes: proceed questions 1.and 2.
a) have data send?
- no: if there no 'user on' command and no data needs sent, then: proceed sleep/off state (which presumably leads start box , begins loop on again)
yes: device not turned on user, has data send; then:
- if connection=true --> send data.
- if connection =/= true --> start timer , begin connecting loop next 2-5 mins @ regular intervals of either 1 or 5 seconds.
the connecting loop ends when either timer=2-5min or connection=true. when timer runs out, proceed off/sleep state.
note: may or may not want add error handler make code break a) in case.
Comments
Post a Comment