disconnect.go 729 B

12345678910111213141516171819202122232425262728293031323334
  1. package packets
  2. import (
  3. "io"
  4. )
  5. // DisconnectPacket is an internal representation of the fields of the
  6. // Disconnect MQTT packet
  7. type DisconnectPacket struct {
  8. FixedHeader
  9. }
  10. func (d *DisconnectPacket) String() string {
  11. return d.FixedHeader.String()
  12. }
  13. func (d *DisconnectPacket) Write(w io.Writer) error {
  14. packet := d.FixedHeader.pack()
  15. _, err := packet.WriteTo(w)
  16. return err
  17. }
  18. // Unpack decodes the details of a ControlPacket after the fixed
  19. // header has been read
  20. func (d *DisconnectPacket) Unpack(b io.Reader) error {
  21. return nil
  22. }
  23. // Details returns a Details struct containing the Qos and
  24. // MessageID of this ControlPacket
  25. func (d *DisconnectPacket) Details() Details {
  26. return Details{Qos: 0, MessageID: 0}
  27. }