pingreq.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2021 IBM Corp and others.
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v2.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * https://www.eclipse.org/legal/epl-2.0/
  10. * and the Eclipse Distribution License is available at
  11. * http://www.eclipse.org/org/documents/edl-v10.php.
  12. *
  13. * Contributors:
  14. * Allan Stockdill-Mander
  15. */
  16. package packets
  17. import (
  18. "io"
  19. )
  20. // PingreqPacket is an internal representation of the fields of the
  21. // Pingreq MQTT packet
  22. type PingreqPacket struct {
  23. FixedHeader
  24. }
  25. func (pr *PingreqPacket) String() string {
  26. return pr.FixedHeader.String()
  27. }
  28. func (pr *PingreqPacket) Write(w io.Writer) error {
  29. packet := pr.FixedHeader.pack()
  30. _, err := packet.WriteTo(w)
  31. return err
  32. }
  33. // Unpack decodes the details of a ControlPacket after the fixed
  34. // header has been read
  35. func (pr *PingreqPacket) Unpack(b io.Reader) error {
  36. return nil
  37. }
  38. // Details returns a Details struct containing the Qos and
  39. // MessageID of this ControlPacket
  40. func (pr *PingreqPacket) Details() Details {
  41. return Details{Qos: 0, MessageID: 0}
  42. }