瀏覽代碼

Add transmitter and sensor information to bloodglucose type

(cherry picked from commit b1c7890f624b2a3756fa7832f511aac2ac2ca3d4)
Jan Dittmer 4 年之前
父節點
當前提交
65d7203e14
共有 2 個文件被更改,包括 9 次插入3 次删除
  1. 4 1
      FreeAPS/Sources/APS/CGM/DexcomSource.swift
  2. 5 2
      FreeAPS/Sources/APS/CGM/GlucoseSimulatorSource.swift

+ 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
     }