JohanDegraeve / xdripswift

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

Add support for Dexcom G7 #407

Closed becksen closed 6 months ago

becksen commented 1 year ago

Like G6 it would be appreciated to add Dexcom G7 support to Xdrip4ios.

LiroyvH commented 1 year ago

We will when we can

JohanDegraeve commented 6 months ago

is in develop branch now, will be released soon. Offical Dexcom App must run in parallel

yurique commented 5 months ago

I just built and installed the develop version into my phone. When I started adding the G7 sensor, xdrip got "stuck" in status=Scanning for a few minutes – I thought it wouldn't work. But..

It works! :)

JohanDegraeve commented 5 months ago

yes, you need to have the official Dexcom G7 app open while scanning (that's different than other device like Libre2 where you need to do the opposite). And it can take a while. xDrip4iOS runs in 'companion' mode, it just listens to what the sensor is sending to the official Dexcom app.

yurique commented 5 months ago

After the sensor expired and I inserted a new one (G7 app is already getting the readings) - xdrip is unable to connect to it. I tried waiting for about 20 minutes, then I removed the sensor in the bluetooth tab and added it anew - no success, stuck in "scanning" (30+ minutes). Restarted all the apps and tried again - no luck.

yurique commented 5 months ago

iAPS was able to keep reading, without me doing anything (it's also listening to the readings via the native app)

JohanDegraeve commented 5 months ago

could you send the issue report to xdrip@proximus.be ?

iAPS and loop autodetect the new sensor. xdrip4iOS you need to explicitly stop or delete and recreate. Probably it's a matter of waiting a bit longer

yurique commented 5 months ago

@JohanDegraeve I did explicitly delete and then recreated the G7 connection, and waited for quite a bit (20, maybe 30 minutes)

Here's an extract from the logs:

2024-03-17 05:16:54.9390 5.0.2 4193 RootView                       glucoseData size = 0
2024-03-17 05:16:54.9410 5.0.2 4193 RootView                       in processNewGlucoseData, calibrationsAccessor or coreDataManager or cgmTransmitter is nil
2024-03-17 05:21:43.8520 5.0.2 4193 CGMG7                          connected to peripheral with name DXCM9N
2024-03-17 05:21:44.1120 5.0.2 4193 BlueToothTransmitter           didDiscoverServices for peripheral with name DXCM9N
2024-03-17 05:21:44.1140 5.0.2 4193 BlueToothTransmitter               Call discovercharacteristics for service with uuid F8083532-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:44.1170 5.0.2 4193 CGMG7                          didDiscoverCharacteristicsFor for peripheral with name DXCM9N, for service with uuid F8083532-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:44.1180 5.0.2 4193 CGMG7                              characteristic: F8083534-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:44.1200 5.0.2 4193 CGMG7                              characteristic: F8083535-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:44.1220 5.0.2 4193 CGMG7                              characteristic: F8083536-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:44.1240 5.0.2 4193 CGMG7                              characteristic: F8083538-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:21:54.6900 5.0.2 4193 BlueToothTransmitter               didDisconnect peripheral with name DXCM9N
2024-03-17 05:21:54.6920 5.0.2 4193 BluetoothPeripheralManager     in didDisconnectFrom
2024-03-17 05:21:54.7020 5.0.2 4193 BlueToothTransmitter               error: The specified device has disconnected from us.
2024-03-17 05:21:54.7040 5.0.2 4193 BlueToothTransmitter               Will try to reconnect
2024-03-17 05:21:54.7090 5.0.2 4193 RootView                       glucoseData size = 0
2024-03-17 05:21:54.7110 5.0.2 4193 RootView                       in processNewGlucoseData, calibrationsAccessor or coreDataManager or cgmTransmitter is nil
2024-03-17 05:26:43.7690 5.0.2 4193 CGMG7                          connected to peripheral with name DXCM9N
2024-03-17 05:26:43.9450 5.0.2 4193 BlueToothTransmitter           didDiscoverServices for peripheral with name DXCM9N
2024-03-17 05:26:43.9470 5.0.2 4193 BlueToothTransmitter               Call discovercharacteristics for service with uuid F8083532-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:43.9490 5.0.2 4193 CGMG7                          didDiscoverCharacteristicsFor for peripheral with name DXCM9N, for service with uuid F8083532-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:43.9510 5.0.2 4193 CGMG7                              characteristic: F8083534-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:43.9530 5.0.2 4193 CGMG7                              characteristic: F8083535-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:43.9550 5.0.2 4193 CGMG7                              characteristic: F8083536-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:43.9570 5.0.2 4193 CGMG7                              characteristic: F8083538-849E-531C-C594-30F1F86A4EA5
2024-03-17 05:26:54.4890 5.0.2 4193 BlueToothTransmitter               didDisconnect peripheral with name DXCM9N
2024-03-17 05:26:54.4900 5.0.2 4193 BluetoothPeripheralManager     in didDisconnectFrom
2024-03-17 05:26:54.5030 5.0.2 4193 BlueToothTransmitter               error: The specified device has disconnected from us.
2024-03-17 05:26:54.5040 5.0.2 4193 BlueToothTransmitter               Will try to reconnect

and this keeps repeating every ~5 minutes (the longest period - from ~19:15 until 10:46 the next day, every 5-10 minutes)

(I'm sending the full logs to the email as well)

JohanDegraeve commented 5 months ago

is DXCM9N the device name of your current G7 transmitter? you should be able to see this in iAPS (I'm not using iAPS but I know it's visible in Loop, so I guess also in iAPS).

could you try once to force close iAPS and see if it receives the readings after 'characteristic: F8083538-849E-531C-C594-30F1F86A4EA5' you should see 'in peripheralDidUpdateValueFor, characteristic uuid = Receive_Authentication'

yurique commented 5 months ago

is DXCM9N the device name of your current G7 transmitter?

that must be the previous one, the one that worked

currently, iAPS shows this device name: DXCML5

could you try once to force close iAPS and see if it receives the readings

I tried this as well - force close iAPS (swipe up) and then try to connect in xdrip (that attempt should be in the logs as well, since I was trying it on March 16th)

JohanDegraeve commented 5 months ago

it's trying to reconnect to DXCM9N there's definitely something wrong but it will take me some time to fix it. And I still don't understand why DXCML5 is not visible in the logs.

I also think you still have the DXCM9N in your iOS settings? if so can you remove it and retry? (ie delete, recreate, keep official Dexcom G7 app at all times running in the background)

yurique commented 5 months ago

DXCM9N is indeed present in the iOS bluetooth devices list, as well as a bunch of other ones (it's always the case, and usually there is even more of them there :) ) image

I went to DXCM9N and did the "Forget This Device" thing - after that, xdrip was able to connect almost immediately.

JohanDegraeve commented 5 months ago

Yes, actually all bluetooth devices that 'pair' will stay in that list until you manually delete them. 'pair' means you get an explicit request from iOS to confirm the pairing. Libre, OmniPod and others don't do pairing. They disappear from that list as soon as they are disconnected.

I've been able to reproduce the case where the old device is still in the list of paired devices. I'll try to fix that.