Просмотр исходного кода

Testing suggested change for libreUS14day and libreUS14dayE6

Jon Mårtensson 3 лет назад
Родитель
Сommit
7c0305f930

+ 3 - 2
Dependencies/LibreTransmitter/Sources/LibreTransmitter/Bluetooth/LibreTransmitterMetadata.swift

@@ -81,6 +81,7 @@ public enum SensorType: String, CustomStringConvertible {
     case libre1A2 =  "A2"
     case libre2    = "9D"
     case libreUS14day   = "E5"
+    case libreUS14dayE6 = "E6"
     case libreProH = "70"
 
     public var description: String {
@@ -91,7 +92,7 @@ public enum SensorType: String, CustomStringConvertible {
             return "Libre 1 A2"
         case .libre2:
             return "Libre 2"
-        case .libreUS14day:
+        case .libreUS14day, .libreUS14dayE6:
             return "Libre US"
         case .libreProH:
             return "Libre PRO H"
@@ -105,7 +106,7 @@ public extension SensorType {
 
         let start = patchInfo[0..<2].uppercased()
 
-        let choices: [String: SensorType] = ["DF": .libre1, "A2": .libre1A2, "9D": .libre2, "E5": .libreUS14day, "70": .libreProH]
+        let choices: [String: SensorType] = ["DF": .libre1, "A2": .libre1A2, "9D": .libre2, "E5": .libreUS14day, "E6": .libreUS14dayE6, "70": .libreProH]
 
         if let res = choices[start] {
             self = res

+ 2 - 2
Dependencies/LibreTransmitter/Sources/LibreTransmitter/LibreSensor/SensorContents/PreLibre2.swift

@@ -9,7 +9,7 @@ public enum Libre2 {
     ///   - data: Encrypted FRAM data
     /// - Returns: Decrypted FRAM data
     static public func decryptFRAM(type: SensorType, id: [UInt8], info: [UInt8], data: [UInt8]) throws -> [UInt8] {
-        guard type == .libre2 || type == .libreUS14day else {
+        guard type == .libre2 || type == .libreUS14day || type == .libreUS14dayE6 else {
             struct DecryptFRAMError: Error {
                 let errorDescription = "Unsupported sensor type"
             }
@@ -18,7 +18,7 @@ public enum Libre2 {
 
         func getArg(block: Int) -> UInt16 {
             switch type {
-            case .libreUS14day:
+            case .libreUS14day, .libreUS14dayE6:
                 if block < 3 || block >= 40 {
                     // For header and footer it is a fixed value.
                     return 0xcadc