소스 검색

Add transmitter and sensor information to bloodglucose type

Jan Dittmer 4 년 전
부모
커밋
e45bbef770
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,
                 filtered: nil,
                 noise: nil,
                 noise: nil,
                 glucose: value,
                 glucose: value,
-                type: "sgv"
+                type: "sgv",
+                activationDate: glucose.activationDate,
+                sessionStartDate: glucose.sessionStartDate,
+                transmitterID: glucose.transmitterID
             )
             )
         }
         }
         promise?(.success(bloodGlucose))
         promise?(.success(bloodGlucose))

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

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