NightscoutStatus.swift 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import Foundation
  2. struct NightscoutStatus: JSON {
  3. let device: String
  4. let openaps: OpenAPSStatus
  5. let pump: NSPumpStatus
  6. let preferences: Preferences
  7. let uploader: Uploader
  8. }
  9. struct OpenAPSStatus: JSON {
  10. let iob: IOBEntry?
  11. let suggested: Suggestion?
  12. let enacted: Suggestion?
  13. let version: String
  14. }
  15. struct NSPumpStatus: JSON {
  16. let clock: Date
  17. let battery: Battery?
  18. let reservoir: Decimal?
  19. let status: PumpStatus?
  20. }
  21. struct Uploader: JSON {
  22. let batteryVoltage: Decimal?
  23. let battery: Int
  24. }
  25. struct NightscoutTimevalue: JSON {
  26. // rep["time"] = String(format:"%02i:%02i", Int(hours), Int(minutes))
  27. // rep["value"] = value
  28. // rep["timeAsSeconds"] = Int(offset)
  29. let time: String
  30. let value: Decimal
  31. let timeAsSeconds: Int
  32. }
  33. struct ScheduledNightscoutProfile: JSON {
  34. let dia: Decimal
  35. let carbs_hr: Decimal
  36. let delay: Decimal
  37. let timezone: String
  38. let target_low: [NightscoutTimevalue]
  39. let target_high: [NightscoutTimevalue]
  40. let sens: [NightscoutTimevalue]
  41. let basal: [NightscoutTimevalue]
  42. let carbratio: [NightscoutTimevalue]
  43. }
  44. struct NightscoutProfileStore: JSON {
  45. let defaultProfile: String
  46. let startDate: Date
  47. let mills: Int
  48. let units: String
  49. let enteredBy: String
  50. let store: [String: ScheduledNightscoutProfile]
  51. }