KAAMqttFrame Class Reference

Inherits from NSObject
Declared in KAAMqttFrame.h
KAAMqttFrame.m

Overview

Basic Mqtt message.

Fixed header format

bit 7 6 5 4 3 2 1 0
byte 1 Message Type Dup flag QoS level RETAIN
byte 2 Remaining length

  remainingLength

Remaining length of mqtt frame

@property (nonatomic) int32_t remainingLength

Discussion

Remaining length of mqtt frame

Declared In

KAAMqttFrame.h

– pack

Pack message into mqtt frame

- (void)pack

Discussion

Pack message into mqtt frame

Declared In

KAAMqttFrame.h

– decode

Decode message from mqttFrame buffer

- (void)decode

Discussion

Decode message from mqttFrame buffer

Exceptions

KaaTcpProtocolException

TCP exception

Declared In

KAAMqttFrame.h

– needToCloseConnection

Check if this Mqtt frame should be last frame on connection and connection should be closed.

- (BOOL)needToCloseConnection

Return Value

YES if connection should be closed after frame transmition.

Discussion

Check if this Mqtt frame should be last frame on connection and connection should be closed.

Declared In

KAAMqttFrame.h

– fillFixedHeader:remainingLength:

Fill mqtt frame fixed header

- (int32_t)fillFixedHeader:(NSMutableData *)header remainingLength:(int32_t)remainingLength

Return Value

number of packet bytes

Discussion

Fill mqtt frame fixed header

Declared In

KAAMqttFrame.h

– pushBytes:toPosition:

Push bytes of frame

- (int32_t)pushBytes:(NSData *)bytes toPosition:(int32_t)position

Parameters

bytes

Data to push

position

Position in buffer

Return Value

Count of used bytes from buffer

Discussion

Push bytes of frame

Exceptions

KaaTcpProtocolException

TCP exception

Declared In

KAAMqttFrame.h

– upgradeFrame

Used in case if Frame Class should be changed during frame decode. Used for migration from KaaSync general frame to specific classes like Sync, Bootstrap. Default implementation returns self.

- (KAAMqttFrame *)upgradeFrame

Return Value

New MqttFrame as specific class.

Discussion

Used in case if Frame Class should be changed during frame decode. Used for migration from KaaSync general frame to specific classes like Sync, Bootstrap. Default implementation returns self.

Exceptions

KaaTcpProtocolException

TCP exception

Declared In

KAAMqttFrame.h