JohanDegraeve / xdripswift

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

App doesn’t truly unlink the sensor? #221

Open LiroyvH opened 3 years ago

LiroyvH commented 3 years ago

Not sure if intended behaviour, but when removing Libre 2 Direct (disconnect/unlink, then remove the CGM): it reconnects to the previous sensor immediately when it pings the phone again.

This messes up the linking with a new sensor and will trigger the "old sensor, will try connecting to new sensor now"-thingy. I had expected that when you tell the app to unlink the sensor and you remove the whole CGM and re-add it, that it actually would forget about the previous still pinging sensor/refuse connection unless you scan it with NFC again.

Suspecting this is already known, but couldn't properly find it so figured I'd create a report about it anyway (even if just for record/searchability haha)

JohanDegraeve commented 3 years ago

The old sensor continues sending Bluetooth signal, even if it is expired. So if you delete the sensor, and then scan again for a Libre 2, there's a chance that the app reconnects to the old one.

If you just disconnect, without deleting, then it will not re-use the old one.

I don't know what you mean with "unlink" ?

LiroyvH commented 3 years ago

@JohanDegraeve Ah but it did, that's why I had deleted the CGM as per the onscreen instructions haha :)

In Dutch it says "Ontkoppelen" I think, that's what I meant :)

JohanDegraeve commented 3 years ago

it says "Loskoppelen", it's indeed maybe not very good, actually it should be "Verbinding verbreken"

paulplant commented 3 years ago

@liroyvh , I was discussing this with Johan the other day (I've only just noticed this issue here though).

To keep more information in the same place, here's a modified copy of our conversation (modified to add more explanations):

This is the way it's implemented in the project:

When you click "Start scanning for Libre 2" the app starts scanning and will connect to any device that has a name "ABBOTT" in it like ABBOTT300D6CH7 or even KZKZKABotT133 <- both would be valid names

It must ALSO be a sensor which has a yet unknown MAC address (all MAC addresses are unique). This is what causes the problem if the user deletes the old sensor instead of simply disconnecting it.

The old sensor, although expired and unable to transmit glucose data still transmits bluetooth signal until the battery eventually runs out.

If you don't delete the old sensor, but Disconnect it, then the app will not try to connect as it still has stored the Mac address of the previous sensor. When you scan for a libre2, it will not connect to that one because it has a known Mac address.

But if you delete the old sensor (which is precisely what we usually tell the user to do 😅) then the Mac address is removed from the app and as the sensor is still broadcasting, xDrip4iOS can connect to it again.

So the best workaround is to just disconnect from the old sensor and then add a new sensor, then later go back and delete the old sensor. <- this is a pain and not very intuitive.

We discussed adding an array to store known expired sensor MAC addresses in coredata. The app will then always remember sensors that have expired.

Whilst we work on this, we should get some sort of procedure written to explain it better. I can try and to do this over the weekend, and then incorporate this into Read The Docs . This should be added into the main Libre 2 connection page and also into the FAQs.

Ayat1Salam commented 2 years ago

Until now i don’t know how to download on iphon 💔 is there a dirct link please

LiroyvH commented 2 years ago

@Ayat1Salam No, join the FB group, read the announcement very carefully and do what it says. Enjoy!