| 123456789101112131415161718192021222324252627282930313233 |
- //
- // CorrectionRange.swift
- // NightscoutUploadKit
- //
- // Created by Pete Schwamb on 5/28/18.
- // Copyright © 2018 Pete Schwamb. All rights reserved.
- //
- import Foundation
- import HealthKit
- public struct CorrectionRange {
- let minValue: Int
- let maxValue: Int
-
- public init(minValue: HKQuantity, maxValue: HKQuantity) {
- // BG values in nightscout are in mg/dL.
- let unit = HKUnit.milligramsPerDeciliterUnit()
- self.minValue = Int(round(minValue.doubleValue(for: unit)))
- self.maxValue = Int(round(maxValue.doubleValue(for: unit)))
- }
-
- public var dictionaryRepresentation: [String: Any] {
- var rval = [String: Any]()
-
- rval["minValue"] = minValue
- rval["maxValue"] = maxValue
-
- return rval
- }
- }
|