JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
342 stars 339 forks source link

Redundancy mode? #299

Open LiroyvH opened 2 years ago

LiroyvH commented 2 years ago

Not sure if this is possible at all, but figured it'd be nice to have a redundancy mode when "follow Dexcom-app" is enabled. If we see the transmitter trying to connect, but we haven't received any data from the Dexcom-app for 14 minutes (eg: it crashed): accept the connection directly and obtain values. Reset last transmission to 0 and wait for 14 minutes again to allow the Dexcom-app to come back up. Still nada? Rinse and repeat.

This way you would have a reading at least once every 15 minutes even if one of the apps crash.

Theoretically anyway, like I said: no idea if even possible. :)

JohanDegraeve commented 2 years ago

something like that should be possible yes In fact it's probably not necessary to wait 15 minutes.

but first explanation : xdrip4ios does accept connections in "follow" mode, it just doens't send anything and actually it's mainly the authChallengeRx that needs to be ignored. (ie in follower mode, xdrip4ios should not respond to authChallengeRx message, the dexcom app will do this), but it does sent for example calibration requests (if you would calibrate via xdrip4ios), or start sensor messages (if you want start the sensor through xdrip4ios), it also sends backfill requests. xdrip4ios will not request the latest reading, because it assumes the dexcom app will do this, so it just waits for the response back from the transmitter

As you know, every 5 minutes, the dexcom connects after a few seconds disconnects, reconnects again, disconnect... this goes on for (I think 2 minutes in case of G6, for G5 it was 10 seconds)

possibility would be: