EnliteSensorDisplayable.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // EnliteSensorDisplayable.swift
  3. // Loop
  4. //
  5. // Created by Timothy Mecklem on 12/28/16.
  6. // Copyright © 2016 LoopKit Authors. All rights reserved.
  7. //
  8. import Foundation
  9. import HealthKit
  10. import LoopKit
  11. struct EnliteSensorDisplayable: Equatable, GlucoseDisplayable {
  12. public let isStateValid: Bool
  13. public let trendType: LoopKit.GlucoseTrend?
  14. public let trendRate: HKQuantity?
  15. public let isLocal: Bool
  16. // TODO Placeholder. This functionality will come with LOOP-1311
  17. var glucoseRangeCategory: GlucoseRangeCategory? {
  18. return nil
  19. }
  20. var glucoseCondition: GlucoseCondition? {
  21. return nil
  22. }
  23. public init(_ event: MinimedKit.RelativeTimestampedGlucoseEvent) {
  24. isStateValid = event.isStateValid
  25. trendType = event.trendType
  26. trendRate = event.trendRate
  27. isLocal = event.isLocal
  28. }
  29. public init(_ status: MySentryPumpStatusMessageBody) {
  30. isStateValid = status.isStateValid
  31. trendType = status.trendType
  32. trendRate = nil
  33. isLocal = status.isLocal
  34. }
  35. }
  36. extension MinimedKit.RelativeTimestampedGlucoseEvent {
  37. var isStateValid: Bool {
  38. return self is SensorValueGlucoseEvent
  39. }
  40. var trendType: LoopKit.GlucoseTrend? {
  41. return nil
  42. }
  43. var trendRate: HKQuantity? {
  44. return nil
  45. }
  46. var isLocal: Bool {
  47. return true
  48. }
  49. }