LoopEnacted.swift 816 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // LoopEnacted.swift
  3. // RileyLink
  4. //
  5. // Created by Pete Schwamb on 7/28/16.
  6. // Copyright © 2016 Pete Schwamb. All rights reserved.
  7. //
  8. import Foundation
  9. public struct LoopEnacted {
  10. let rate: Double
  11. let duration: TimeInterval
  12. let timestamp: Date
  13. let received: Bool
  14. public init(rate: Double, duration: TimeInterval, timestamp: Date, received: Bool) {
  15. self.rate = rate
  16. self.duration = duration
  17. self.timestamp = timestamp
  18. self.received = received
  19. }
  20. public var dictionaryRepresentation: [String: Any] {
  21. var rval = [String: Any]()
  22. rval["rate"] = rate
  23. rval["duration"] = duration / 60.0
  24. rval["timestamp"] = TimeFormat.timestampStrFromDate(timestamp)
  25. rval["received"] = received
  26. return rval
  27. }
  28. }