YOUSEFUL / DELPHI / COMPONENTS

TMqttPacketKind

The sixteen MQTT control packet types; the ordinal is the type number on the wire.

Enumeration Unit Atlas.MqttCodec · Product Atlas MQTT

Description

pascal
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

MemberKindWhat it does
mkReserved0valueType 0, reserved.
mkConnectvalueCONNECT, client to broker: identifier, credentials, will, keep-alive.
mkConnAckvalueCONNACK, broker to client: ReturnCode 0 accepts, 1 to 5 refuse; SessionPresent.
mkPublishvaluePUBLISH, both ways: a message.
mkPubAckvaluePUBACK: acknowledges a quality-1 PUBLISH.
mkPubRecvaluePUBREC: first answer to a quality-2 PUBLISH.
mkPubRelvaluePUBREL: the sender's reply to PUBREC.
mkPubCompvaluePUBCOMP: completes the quality-2 exchange.
mkSubscribevalueSUBSCRIBE, client to broker: Filters and FilterQoS.
mkSubAckvalueSUBACK, broker to client: one Granted code per filter.
mkUnsubscribevalueUNSUBSCRIBE, client to broker: Filters.
mkUnsubAckvalueUNSUBACK, broker to client.
mkPingReqvaluePINGREQ: keep-alive ping, client to broker.
mkPingRespvaluePINGRESP: the broker's answer to PINGREQ.
mkDisconnectvalueDISCONNECT, client to broker: an orderly goodbye; the will is discarded.
mkReserved15valueType 15, reserved.

Values

mkReserved0 value

mkReserved0

Type 0, reserved. Never sent; decoding it raises EAtlasMqttProtocolError.

mkConnect value

mkConnect

CONNECT, client to broker: identifier, credentials, will, keep-alive.

mkConnAck value

mkConnAck

CONNACK, broker to client: ReturnCode 0 accepts, 1 to 5 refuse; SessionPresent.

mkPublish value

mkPublish

PUBLISH, both ways: a message.

mkPubAck value

mkPubAck

PUBACK: acknowledges a quality-1 PUBLISH.

mkPubRec value

mkPubRec

PUBREC: first answer to a quality-2 PUBLISH.

mkPubRel value

mkPubRel

PUBREL: the sender's reply to PUBREC.

mkPubComp value

mkPubComp

PUBCOMP: completes the quality-2 exchange.

mkSubscribe value

mkSubscribe

SUBSCRIBE, client to broker: Filters and FilterQoS.

mkSubAck value

mkSubAck

SUBACK, broker to client: one Granted code per filter.

mkUnsubscribe value

mkUnsubscribe

UNSUBSCRIBE, client to broker: Filters.

mkUnsubAck value

mkUnsubAck

UNSUBACK, broker to client.

mkPingReq value

mkPingReq

PINGREQ: keep-alive ping, client to broker.

mkPingResp value

mkPingResp

PINGRESP: the broker's answer to PINGREQ.

mkDisconnect value

mkDisconnect

DISCONNECT, client to broker: an orderly goodbye; the will is discarded.

mkReserved15 value

mkReserved15

Type 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.

pascal
uses
  Atlas.MqttCodec;

function KindOf(FirstByte: Byte): TMqttPacketKind;
begin
  Result := TMqttPacketKind(FirstByte shr 4);
end;

TMqttPacket · TAtlasMqttCodec

Also in Atlas MQTT

TAtlasMqttClient · TAtlasMqttBroker