GetPumpModelCarelinkMessageBody.swift 767 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // GetPumpModelCarelinkMessageBody.swift
  3. // RileyLink
  4. //
  5. // Created by Pete Schwamb on 3/12/16.
  6. // Copyright © 2016 Pete Schwamb. All rights reserved.
  7. //
  8. import Foundation
  9. public class GetPumpModelCarelinkMessageBody: CarelinkLongMessageBody {
  10. public let model: String
  11. public required init?(rxData: Data) {
  12. guard rxData.count == type(of: self).length,
  13. let mdl = String(data: rxData.subdata(in: 2..<5), encoding: String.Encoding.ascii) else {
  14. model = ""
  15. super.init(rxData: rxData)
  16. return nil
  17. }
  18. model = mdl
  19. super.init(rxData: rxData)
  20. }
  21. public required init?(rxData: NSData) {
  22. fatalError("init(rxData:) has not been implemented")
  23. }
  24. }