From 549647a7cd5137e6a6fc9319887473736a1912ca Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Sun, 19 May 2024 00:40:01 +0200 Subject: [PATCH] Libre 2+ EU implementation - maxSensorDays set at 15.0 days for now until we get confirmation if we can still read an extra 12 hours as per other Libre sensors. --- .../CGM/Libre/Bubble/CGMBubbleTransmitter.swift | 2 +- .../CGM/Libre/Utilities/LibreDataParser.swift | 2 +- .../Libre/Utilities/LibreSensorSerialNumber.swift | 2 +- .../CGM/Libre/Utilities/LibreSensorType.swift | 13 ++++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/xdrip/BluetoothTransmitter/CGM/Libre/Bubble/CGMBubbleTransmitter.swift b/xdrip/BluetoothTransmitter/CGM/Libre/Bubble/CGMBubbleTransmitter.swift index 26634b4d9..fa62108a3 100644 --- a/xdrip/BluetoothTransmitter/CGM/Libre/Bubble/CGMBubbleTransmitter.swift +++ b/xdrip/BluetoothTransmitter/CGM/Libre/Bubble/CGMBubbleTransmitter.swift @@ -212,7 +212,7 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter { // if firmware < 2.6, libre2 and libreUS will decrypt fram local // after decryptFRAM, the libre2 and libreUS 344 will be libre1 344 data format // firmware >= 2.6, then bubble already decrypted the data, no need for decryption we already have the 344 bytes - if libreSensorType == .libre2 || libreSensorType == .libre2C5 || libreSensorType == .libreUS || libreSensorType == .libreUSE6 { + if libreSensorType == .libre2 || libreSensorType == .libre2C5 || libreSensorType == .libre2C6 || libreSensorType == .libreUS || libreSensorType == .libreUSE6 { if let firmware = firmware?.toDouble(), firmware < 2.6 { diff --git a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreDataParser.swift b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreDataParser.swift index 58b6ce612..c2bd29b22 100644 --- a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreDataParser.swift +++ b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreDataParser.swift @@ -231,7 +231,7 @@ class LibreDataParser { // should never come here ? trace("in libreDataProcessor, is libreUS but data is not decrypted - no further processing", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info) - case .libre2, .libre2C5: + case .libre2, .libre2C5, .libre2C6: // should never come here ? trace("in libreDataProcessor, is libre2 but data is not decrypted - no further processing", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info) diff --git a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorSerialNumber.swift b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorSerialNumber.swift index 70d380049..340ca71a9 100644 --- a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorSerialNumber.swift +++ b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorSerialNumber.swift @@ -104,7 +104,7 @@ public struct LibreSensorSerialNumber: CustomStringConvertible { first = "1" - case .libre2, .libre2C5: + case .libre2, .libre2C5, .libre2C6: first = "3" diff --git a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorType.swift b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorType.swift index c94616268..c32973725 100644 --- a/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorType.swift +++ b/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/LibreSensorType.swift @@ -14,6 +14,8 @@ public enum LibreSensorType: String { case libre2C5 = "C5" + case libre2C6 = "C6" // Libre 2+ EU + case libreUS = "E5" case libreUSE6 = "E6" @@ -36,6 +38,9 @@ public enum LibreSensorType: String { case .libre2C5: return "Libre 2 C5" + case .libre2C6: + return "Libre 2+ C6" + case .libreUS: return "Libre US" @@ -61,7 +66,7 @@ public enum LibreSensorType: String { } // decrypt if libre2 or libreUS - if self == .libre2 || self == .libre2C5 || self == .libreUS || self == .libreUSE6 { + if self == .libre2 || self == .libre2C5 || self == .libre2C6 || self == .libreUS || self == .libreUSE6 { var libreData = rxBuffer.subdata(in: headerLength..<(rxBufferEnd + 1)) @@ -131,6 +136,9 @@ public enum LibreSensorType: String { case "C5": return .libre2C5 // new Libre 2 EU type (May 2023) + case "C6": + return .libre2C6 // new Libre 2+ EU type (May 2024) + case "E5": return .libreUS @@ -160,6 +168,9 @@ public enum LibreSensorType: String { case .libre2, .libre2C5: return 14.5 + + case .libre2C6: + return 15 case .libreUS, .libreUSE6: return nil