YOUSEFUL / DELPHI / COMPONENTS
TMqttPacketKind
The sixteen MQTT control packet types; the ordinal is the type number on the wire.
Description
TMqttPacketKind = (mkReserved0, mkConnect, mkConnAck, mkPublish, mkPubAck, mkPubRec, mkPubRel, mkPubComp,
mkSubscribe, mkSubAck, mkUnsubscribe, mkUnsubAck, mkPingReq, mkPingResp, mkDisconnect, mkReserved15);The Kind of a TMqttPacket. Only needed when you work with the codec directly; the components hide packets entirely.
Members
| Member | Kind | What it does |
|---|---|---|
mkReserved0 | value | Type 0, reserved. |
mkConnect | value | CONNECT, client to broker: identifier, credentials, will, keep-alive. |
mkConnAck | value | CONNACK, broker to client: ReturnCode 0 accepts, 1 to 5 refuse; SessionPresent. |
mkPublish | value | PUBLISH, both ways: a message. |
mkPubAck | value | PUBACK: acknowledges a quality-1 PUBLISH. |
mkPubRec | value | PUBREC: first answer to a quality-2 PUBLISH. |
mkPubRel | value | PUBREL: the sender's reply to PUBREC. |
mkPubComp | value | PUBCOMP: completes the quality-2 exchange. |
mkSubscribe | value | SUBSCRIBE, client to broker: Filters and FilterQoS. |
mkSubAck | value | SUBACK, broker to client: one Granted code per filter. |
mkUnsubscribe | value | UNSUBSCRIBE, client to broker: Filters. |
mkUnsubAck | value | UNSUBACK, broker to client. |
mkPingReq | value | PINGREQ: keep-alive ping, client to broker. |
mkPingResp | value | PINGRESP: the broker's answer to PINGREQ. |
mkDisconnect | value | DISCONNECT, client to broker: an orderly goodbye; the will is discarded. |
mkReserved15 | value | Type 15, reserved. |
Values
mkReserved0 value
mkReserved0Type 0, reserved. Never sent; decoding it raises EAtlasMqttProtocolError.
mkConnect value
mkConnectCONNECT, client to broker: identifier, credentials, will, keep-alive.
mkConnAck value
mkConnAckCONNACK, broker to client: ReturnCode 0 accepts, 1 to 5 refuse; SessionPresent.
mkPublish value
mkPublishPUBLISH, both ways: a message.
mkPubAck value
mkPubAckPUBACK: acknowledges a quality-1 PUBLISH.
mkPubRec value
mkPubRecPUBREC: first answer to a quality-2 PUBLISH.
mkPubRel value
mkPubRelPUBREL: the sender's reply to PUBREC.
mkPubComp value
mkPubCompPUBCOMP: completes the quality-2 exchange.
mkSubscribe value
mkSubscribeSUBSCRIBE, client to broker: Filters and FilterQoS.
mkSubAck value
mkSubAckSUBACK, broker to client: one Granted code per filter.
mkUnsubscribe value
mkUnsubscribeUNSUBSCRIBE, client to broker: Filters.
mkUnsubAck value
mkUnsubAckUNSUBACK, broker to client.
mkPingReq value
mkPingReqPINGREQ: keep-alive ping, client to broker.
mkPingResp value
mkPingRespPINGRESP: the broker's answer to PINGREQ.
mkDisconnect value
mkDisconnectDISCONNECT, client to broker: an orderly goodbye; the will is discarded.
mkReserved15 value
mkReserved15Type 15, reserved. Never sent; decoding it raises EAtlasMqttProtocolError.
Examples
Packet type from the first byte
The type sits in the upper four bits of the first byte: $30 is mkPublish, $20 mkConnAck, $C0 mkPingReq.
uses
Atlas.MqttCodec;
function KindOf(FirstByte: Byte): TMqttPacketKind;
begin
Result := TMqttPacketKind(FirstByte shr 4);
end;