CustomMessage Format for ProPTT2

ProPTT2 client is using CustomMessage for special features.(especially sending picture)
ProPTT2 developer can use this format for ProPTT2 client and their clients.
Please refer to http://dev.proptt2.com/sdk-client-ref2-pttchannel.html#sendPublicCustomMessage

1. Format structure

CustomMessage = Custom Message Basic header + { Chunking header } + Custom Message header + Custom Data

2. Custom Message Basic header

FieldTypeDescription
CommandByteRequest command
0x01: SENDPHOTO2CHANNEL
0x02~0x9F: Reserved for ProPTT2
0xA0~0xFF: User command. Other client can use this command.
ContentTypeByte0:Single message, 1:Chunked message
MsgIDShort(2Bytes)You can decide it.

3. Chunking header

FieldTypeDescription
CurrChunkShort(2Bytes)Current index, 1~ChunkCount
ChunkCountShort(2Bytes)Total chunk count.

4. Custom Message header

4.1 SENDPHOTO2CHANNEL(0x01)

FieldTypeDescription
TypeByteImage format
0x01: BMP
0x02: JPEG
0x03: PNG
ReservedByteMust be 0x00
ReservedByteMust be 0x00
ReservedByteMust be 0x00

The custom data must be a image file.
Custom Message Basic header + Chunking header + Custom Message header + Image file data.