Skip to content

Commit

Permalink
Merge pull request JohanDegraeve#539 from paulplant/L2Plus
Browse files Browse the repository at this point in the history
Libre 2+ EU implementation
  • Loading branch information
JohanDegraeve authored May 19, 2024
2 parents 5f43e5e + 549647a commit 03f8980
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public struct LibreSensorSerialNumber: CustomStringConvertible {

first = "1"

case .libre2, .libre2C5:
case .libre2, .libre2C5, .libre2C6:

first = "3"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public enum LibreSensorType: String {

case libre2C5 = "C5"

case libre2C6 = "C6" // Libre 2+ EU

case libreUS = "E5"

case libreUSE6 = "E6"
Expand All @@ -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"

Expand All @@ -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))

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -160,6 +168,9 @@ public enum LibreSensorType: String {

case .libre2, .libre2C5:
return 14.5

case .libre2C6:
return 15

case .libreUS, .libreUSE6:
return nil
Expand Down

0 comments on commit 03f8980

Please sign in to comment.