packettypes.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """
  2. *******************************************************************
  3. Copyright (c) 2017, 2019 IBM Corp.
  4. All rights reserved. This program and the accompanying materials
  5. are made available under the terms of the Eclipse Public License v1.0
  6. and Eclipse Distribution License v1.0 which accompany this distribution.
  7. The Eclipse Public License is available at
  8. http://www.eclipse.org/legal/epl-v10.html
  9. and the Eclipse Distribution License is available at
  10. http://www.eclipse.org/org/documents/edl-v10.php.
  11. Contributors:
  12. Ian Craggs - initial implementation and/or documentation
  13. *******************************************************************
  14. """
  15. class PacketTypes:
  16. """
  17. Packet types class. Includes the AUTH packet for MQTT v5.0.
  18. Holds constants for each packet type such as PacketTypes.PUBLISH
  19. and packet name strings: PacketTypes.Names[PacketTypes.PUBLISH].
  20. """
  21. indexes = range(1, 16)
  22. # Packet types
  23. CONNECT, CONNACK, PUBLISH, PUBACK, PUBREC, PUBREL, \
  24. PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK, \
  25. PINGREQ, PINGRESP, DISCONNECT, AUTH = indexes
  26. # Dummy packet type for properties use - will delay only applies to will
  27. WILLMESSAGE = 99
  28. Names = [ "reserved", \
  29. "Connect", "Connack", "Publish", "Puback", "Pubrec", "Pubrel", \
  30. "Pubcomp", "Subscribe", "Suback", "Unsubscribe", "Unsuback", \
  31. "Pingreq", "Pingresp", "Disconnect", "Auth"]