RadioSelectionTableViewController.swift 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RadioSelectionTableViewController.swift
  3. // Loop
  4. //
  5. // Created by Nate Racklyeft on 8/26/16.
  6. // Copyright © 2016 Nathan Racklyeft. All rights reserved.
  7. //
  8. import UIKit
  9. import LoopKitUI
  10. import MinimedKit
  11. extension RadioSelectionTableViewController: IdentifiableClass {
  12. typealias T = RadioSelectionTableViewController
  13. static func insulinDataSource(_ value: InsulinDataSource) -> T {
  14. let vc = T()
  15. vc.selectedIndex = value.rawValue
  16. vc.options = (0..<2).compactMap({ InsulinDataSource(rawValue: $0) }).map { String(describing: $0) }
  17. vc.contextHelp = LocalizedString("Insulin delivery can be determined from the pump by either interpreting the event history or comparing the reservoir volume over time. Reading event history allows for a more accurate status graph and uploading up-to-date treatment data to Nightscout, at the cost of faster pump battery drain and the possibility of a higher radio error rate compared to reading only reservoir volume. If the selected source cannot be used for any reason, the system will attempt to fall back to the other option.", comment: "Instructions on selecting an insulin data source")
  18. return vc
  19. }
  20. static func batteryChemistryType(_ value: MinimedKit.BatteryChemistryType) -> T {
  21. let vc = T()
  22. vc.selectedIndex = value.rawValue
  23. vc.options = (0..<2).compactMap({ BatteryChemistryType(rawValue: $0) }).map { String(describing: $0) }
  24. vc.contextHelp = LocalizedString("Alkaline and Lithium batteries decay at differing rates. Alkaline tend to have a linear voltage drop over time whereas lithium cell batteries tend to maintain voltage until halfway through their lifespan. Under normal usage in a Non-MySentry compatible Minimed (x22/x15) insulin pump running Loop, Alkaline batteries last approximately 4 to 5 days. Lithium batteries last between 1-2 weeks. This selection will use different battery voltage decay rates for each of the battery chemistry types and alert the user when a battery is approximately 8 to 10 hours from failure.", comment: "Instructions on selecting battery chemistry type")
  25. return vc
  26. }
  27. static func useMySentry(_ value: Bool) -> T {
  28. let vc = T()
  29. vc.selectedIndex = value ? 0 : 1
  30. vc.options = ["Use MySentry", "Do not use MySentry"]
  31. vc.contextHelp = LocalizedString("Medtronic pump models 523, 723, 554, and 754 have a feature called 'MySentry' that periodically broadcasts the reservoir and pump battery levels. Listening for these broadcasts allows Loop to communicate with the pump less frequently, which can increase pump battery life. However, when using this feature the RileyLink stays awake more of the time and uses more of its own battery. Enabling this may lengthen pump battery life, while disabling it may lengthen RileyLink battery life. This setting is ignored for other pump models.", comment: "Instructions on selecting setting for MySentry")
  32. return vc
  33. }
  34. }