Is there any "nice" way of detecting that the device (a edge 830 in my case) just woke up from sleep so i can reinitialize the BLE connection in my datafield?
Is there any "nice" way of detecting that the device (a edge 830 in my case) just woke up from sleep so i can reinitialize the BLE connection in my datafield?
thx.
same here - it kind of works fine when i reregister my BLE profile after getting an error from the getService call but this is not really intuitive ...
@Garmin: please fix this by adding onSleep() / onWakeup hooks to AppBase as there is obviously some stuff the needs to be reinitialzed after sleep...
That would have been how i imagined that to work as well but it looks like it just continues where it was when the device went to sleep.
(no output of my initialize function in the logs and on the screen i can see the last state for a second before it gets updated again ...)
Cant seem to figure out how to handle this ...
My datafield reconnects fine after connection loss but after the device has been asleep BluetoothLowEnerge.Device.getService() fails (connecting to an "old" device or a freshly scanned one works find up to this point) unless i call BluetoothLowenergy.registerProfile() before which only works for 3 times (looks like max 3 profiles / app limit)
Any ideas?
storage? guess thats what i meant with "old" device.
My datafield only scans on startup, connects the first device (matching my service) and then always tries to reconnect to this device. Even after waking up BluetoothLowEnergy.pairDevice() works fine (including the onConnectedStateChanged() in the delegate) but it fails when i try to get the service - after that i unpair, amd start fresh with a new scan result but it fails the same way :-(
I have a problem with this and Toybox.Ant.GenericChannel becoming useless on my edge 1030 in a data field if the unit goes to sleep from lack of use. If it's waiting to pair to a sensor and then goes to sleep when it wakes up it will stop trying to pair. Trying to reopen also fails
When the garmin wakes up from sleep the an t search does timeout:
Sensor:1 open called-succesful:true:time: 16068 --GenericChannel.open
1:MSG_CODE_EVENT_RX_SEARCH_TIMEOUT:time: 154523 --event from GenericChannel
1:MSG_CODE_EVENT_CHANNEL_CLOSED:time: 154552 --event from GenericChannel
Sensor:1 close called:time: 154588 --GenericChannel.close
I detect that is closed so then release the GenericChannel
Sensor:1 release called:time: 154773
and then recreate the GenericChannel which also times out:
Sensor:2 initialize called:time: 154801
Sensor:2 open called-succesful:true:time: 154831
2:MSG_CODE_EVENT_RX_SEARCH_TIMEOUT:time: 273515
2:MSG_CODE_EVENT_CHANNEL_CLOSED:time: 273544
Sensor:2 close called:time: 273580
Sensor:2 release called:time: 273773
so do it again:
Sensor:3 initialize called:time: 273801
Sensor:3 open called-succesful:true:time: 273831
3:MSG_ID_CLOSE_CHANNEL:time: 273874
Sensor:3 release called:time: 274501
And now as you see it closes as soon as it opens even though open returned true. I try again:
Sensor:4 initialize called:time: 274529
Sensor:4 open called-succesful:true:time: 274559
4:MSG_ID_CLOSE_CHANNEL:time: 274680
4:MSG_CODE_EVENT_CHANNEL_CLOSED:time: 274722
Sensor:4 close called:time: 274750
Sensor:4 release called:time: 274873
All more attempts are like this last one where it closes as soon as it opens. Times are "System.getTimer()" I don't actually know when the 1030 went to sleep as no method gets called when that happens to log it