KAATcpKaaSync Class Reference
Inherits from | KAAMqttFrame : NSObject |
---|---|
Declared in | KAATcpKaaSync.h KAATcpKaaSync.m |
Overview
KaaSync message class.
The KAASYNC message is used as intermediate class for decoding messages
SyncRequest,SyncResponse,BootstrapResolve,BootstrapResponse.
Variable header
Protocol Name
byte 1 Length MSB (0)
byte 2 Length LSB (6)
byte 3 K
byte 4 a
byte 5 a
byte 6 t
byte 7 c
byte 8 p
Protocol version
byte 9 Version (1)
Message ID (2 bytes)
byte 10 ID MSB
byte 11 ID LSB
Flags
byte 12
Request/Response (bit 0)
1 - request, 0 - response
Zipped (bit 1)
1 - zepped, 0 - unzipped
Encrypted(bit 2)
1 - encrypted, 0 - unencrypted
Unused(bit 3)
bit4-bit7 - KAASYNC subcomand messageIdid
KAASYNC subcomand id table
Mnemonic | Enumeration | Description |
UNUSED | 0 | reserved value |
SYNC | 1 | Sync request/response |
BOOTSTRAP | 2 | Bootstrap resolve/response |
Other Methods
– initRequest:zipped:encypted:
Default constructor.
- (instancetype)initRequest:(BOOL)isRequest zipped:(BOOL)isZipped encypted:(BOOL)isEncrypted
Parameters
isRequest |
boolean ‘true’ is request, else response |
---|---|
isZipped |
boolean if message is Zipped |
isEcrypted |
boolean if message is Encrypted |
Discussion
Default constructor.
Declared In
KAATcpKaaSync.h
Other Methods
– 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
– 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
– 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