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

Add transmitter and sensor information to bloodglucose type

(cherry picked from commit b1c7890f624b2a3756fa7832f511aac2ac2ca3d4)
Jan Dittmer 4 лет назад
Родитель
Сommit
65d7203e14

+ 4 - 1
FreeAPS/Sources/APS/CGM/DexcomSource.swift

@@ -57,7 +57,10 @@ extension DexcomSource: TransmitterManagerDelegate {
                 filtered: nil,
                 noise: nil,
                 glucose: value,
-                type: "sgv"
+                type: "sgv",
+                activationDate: glucose.activationDate,
+                sessionStartDate: glucose.sessionStartDate,
+                transmitterID: glucose.transmitterID
             )
         }
         promise?(.success(bloodGlucose))

+ 5 - 2
FreeAPS/Sources/APS/CGM/GlucoseSimulatorSource.swift

@@ -103,7 +103,7 @@ class IntelligentGenerator: BloodGlucoseGenerator {
     // direction of last step
     @Persisted(key: "GlucoseSimulatorDirection") private var trandsStepDirection = BloodGlucose.Direction.flat.rawValue
     var currentGlucose: Int
-
+    let startup = Date()
     init(currentGlucose: Int) {
         self.currentGlucose = currentGlucose
     }
@@ -135,7 +135,10 @@ class IntelligentGenerator: BloodGlucoseGenerator {
             filtered: nil,
             noise: nil,
             glucose: currentGlucose,
-            type: nil
+            type: nil,
+            activationDate: startup,
+            sessionStartDate: startup,
+            transmitterID: "SIMULATOR"
         )
         return glucose
     }