EnliteSensorDisplayable.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 LoopKit
  10. struct EnliteSensorDisplayable: Equatable, GlucoseDisplayable {
  11. public let isStateValid: Bool
  12. public let trendType: LoopKit.GlucoseTrend?
  13. public let isLocal: Bool
  14. // TODO Placeholder. This functionality will come with LOOP-1311
  15. var glucoseRangeCategory: GlucoseRangeCategory? {
  16. return nil
  17. }
  18. public init(_ event: MinimedKit.RelativeTimestampedGlucoseEvent) {
  19. isStateValid = event.isStateValid
  20. trendType = event.trendType
  21. isLocal = event.isLocal
  22. }
  23. public init(_ status: MySentryPumpStatusMessageBody) {
  24. isStateValid = status.isStateValid
  25. trendType = status.trendType
  26. isLocal = status.isLocal
  27. }
  28. }
  29. extension MinimedKit.RelativeTimestampedGlucoseEvent {
  30. var isStateValid: Bool {
  31. return self is SensorValueGlucoseEvent
  32. }
  33. var trendType: LoopKit.GlucoseTrend? {
  34. return nil
  35. }
  36. var isLocal: Bool {
  37. return true
  38. }
  39. }