PodProgressStatus.swift 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // PodProgressStatus.swift
  3. // OmniKit
  4. //
  5. // Created by Pete Schwamb on 9/28/18.
  6. // Copyright © 2018 Pete Schwamb. All rights reserved.
  7. //
  8. import Foundation
  9. public enum PodProgressStatus: UInt8, CustomStringConvertible, Equatable {
  10. case initialized = 0
  11. case memoryInitialized = 1
  12. case reminderInitialized = 2
  13. case pairingCompleted = 3
  14. case priming = 4
  15. case primingCompleted = 5
  16. case basalInitialized = 6
  17. case insertingCannula = 7
  18. case aboveFiftyUnits = 8
  19. case fiftyOrLessUnits = 9
  20. case oneNotUsed = 10
  21. case twoNotUsed = 11
  22. case threeNotUsed = 12
  23. case faultEventOccurred = 13 // fault event occurred (a "screamer")
  24. case activationTimeExceeded = 14 // took > 2 hrs from progress 2 to 3 OR > 1 hr from 3 to 8
  25. case inactive = 15 // pod deactivated or a fatal packet state error
  26. public var readyForDelivery: Bool {
  27. return self == .fiftyOrLessUnits || self == .aboveFiftyUnits
  28. }
  29. public var description: String {
  30. switch self {
  31. case .initialized:
  32. return LocalizedString("Initialized", comment: "Pod initialized")
  33. case .memoryInitialized:
  34. return LocalizedString("Memory initialized", comment: "Pod memory initialized")
  35. case .reminderInitialized:
  36. return LocalizedString("Reminder initialized", comment: "Pod pairing reminder initialized")
  37. case .pairingCompleted:
  38. return LocalizedString("Pairing completed", comment: "Pod status when pairing completed")
  39. case .priming:
  40. return LocalizedString("Priming", comment: "Pod status when priming")
  41. case .primingCompleted:
  42. return LocalizedString("Priming completed", comment: "Pod state when priming completed")
  43. case .basalInitialized:
  44. return LocalizedString("Basal initialized", comment: "Pod state when basal initialized")
  45. case .insertingCannula:
  46. return LocalizedString("Inserting cannula", comment: "Pod state when inserting cannula")
  47. case .aboveFiftyUnits:
  48. return LocalizedString("Normal", comment: "Pod state when running above fifty units")
  49. case .fiftyOrLessUnits:
  50. return LocalizedString("Low reservoir", comment: "Pod state when running with fifty or less units")
  51. case .oneNotUsed:
  52. return LocalizedString("oneNotUsed", comment: "Pod state oneNotUsed")
  53. case .twoNotUsed:
  54. return LocalizedString("twoNotUsed", comment: "Pod state twoNotUsed")
  55. case .threeNotUsed:
  56. return LocalizedString("threeNotUsed", comment: "Pod state threeNotUsed")
  57. case .faultEventOccurred:
  58. return LocalizedString("Fault event occurred", comment: "Pod state when fault event has occurred")
  59. case .activationTimeExceeded:
  60. return LocalizedString("Activation time exceeded", comment: "Pod state when activation not completed in the time allowed")
  61. case .inactive:
  62. return LocalizedString("Deactivated", comment: "Pod state when deactivated")
  63. }
  64. }
  65. }