public interface IPacket
| Modifier and Type | Field and Description |
|---|---|
static String |
MQTT_CHARSET
MQTT/UDP character set
|
static String[] |
pTYpeNames |
| Modifier and Type | Method and Description |
|---|---|
static int |
decodeTopicLen(byte[] pkt)
Decode 2-byte string length.
|
static Collection<TaggedTailRecord> |
decodeTTRs(byte[] raw,
int total_len,
int headerEnd,
int recvLen) |
static byte[] |
encodeTotalLength(byte[] pkt,
int packetType,
byte flags,
AbstractCollection<TaggedTailRecord> ttr)
Rename to encodePacketHeader?
|
static byte[] |
encodeTTR(AbstractCollection<TaggedTailRecord> ttrs,
byte[] packetBeginning)
Have 'classic' MQTT packet at input, extend it with Tagged Tail Records.
|
static IPacket |
fromBytes(byte[] raw,
IPacketAddress from)
Construct packet object from binary data (recvd from net).
|
IPacketAddress |
getFrom()
Get packet sender address.
|
static String |
getPacketTypeName(int packetType)
Get packet type name.
|
int |
getType()
Get packet type byte, as sent over the net (& 0xF0).
|
byte[] |
toBytes()
Generate network representation of packet to be sent.
|
static final String MQTT_CHARSET
static final String[] pTYpeNames
byte[] toBytes()
IPacketAddress getFrom()
int getType()
static IPacket fromBytes(byte[] raw, IPacketAddress from) throws MqttProtocolException
raw - binary data from UDP packetfrom - source addressMqttProtocolException - on incorrect binary packet datastatic Collection<TaggedTailRecord> decodeTTRs(byte[] raw, int total_len, int headerEnd, int recvLen) throws MqttProtocolException
MqttProtocolExceptionstatic int decodeTopicLen(byte[] pkt)
pkt - Binary packet data.static byte[] encodeTotalLength(byte[] pkt,
int packetType,
byte flags,
AbstractCollection<TaggedTailRecord> ttr)
pkt - packet payload bytespacketType - type ( & 0xF0 )flags - flagsttr - TTRs to encode to packetstatic byte[] encodeTTR(AbstractCollection<TaggedTailRecord> ttrs, byte[] packetBeginning)
Have 'classic' MQTT packet at input, extend it with Tagged Tail Records.
Add packet number if one is missing. Add signature.
ttrs - Collection of TTRs to add.packetBeginning - Classic packet.static String getPacketTypeName(int packetType)
packetType - as in incoming byte (& 0xF0).Copyright © 2019. All rights reserved.