ReadOtherDevicesStatusMessageBody.swift 769 B

123456789101112131415161718192021222324252627
  1. //
  2. // ReadOtherDevicesStatusMessageBody.swift
  3. // MinimedKit
  4. //
  5. // Copyright © 2018 Pete Schwamb. All rights reserved.
  6. //
  7. import Foundation
  8. public class ReadOtherDevicesStatusMessageBody: CarelinkLongMessageBody {
  9. public let isEnabled: Bool
  10. public required init?(rxData: Data) {
  11. guard rxData.count == type(of: self).length else {
  12. return nil
  13. }
  14. isEnabled = rxData[1] == 1
  15. super.init(rxData: rxData)
  16. }
  17. }
  18. // Body[1] encodes the bool state
  19. // 0200010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  20. // 0201010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000