MsgQueue command group
The MsgQueue command group allows to exchange arbitrary data messages between multiple BRP hosts.
The message exchange is based on a queue that can be accessed by the different BRP hosts. Every host can put a message into the queue (Send command) or can retrieve a message from it (Receive command).
Only one single message can reside in the queue. If a host wants to put a message into a non-empty queue it can only overwrite the queue content if it originates from the host itself. Otherwise a MSGQ_COLLISION_ERR is returned in order to avoid data loss. In this case the message has to be picked up with the Receive command first, which clears the queue. Then a new message can be sent.
The maximum allowed size of a message can be retrieved with GetMsgSize command. A Send/SendReceive command that exceeds this size returns the status code MSGQ_BUFOVERFLOW_ERR.
There are 3 commands for the message handling:
- Receive: Retrieve a message from the queue
- Send: Put a message into the queue
- SendReceive: Put a message into the queue and wait for reception of a new message (combines Send and Receive)
A basic data exchange with alternated sent messages (A => B => A => B => A => B ....) could be implemented like this:
A: Wait until there is a message to be sent: SendReceive(Msg1)
B: Receive returns with Msg1;Answer with Msg2: SendReceive(Msg2)
A: SendReceive returns with Msg2; Answer with Msg3: SendReceive(Msg3)
A larger data transfer from A to B consisting of multiples messages without B having to send a response every time could be implemented this way:
A: Wait until there is a message to be sent: Send(Msg1)
B: Receive returns Msg1; Receive next part: Receive
A: Send returns after B picked up the data; Send next part: Send(Msg2)
B: Receive returns Msg2; Receive next part: Receive
Every Send call of A returns as soon as B has picked up the data, so A can directly proceed with the next Send.
WARNING: This command set is not available in all Baltech reader firmware variants.
|BRP status||BRP Library Error Code||Mnemonic||Description|
|0x01||0xA601 (42497)||MsgQueue.ErrMsgqRecvTimeout||Timeout: no message received within the specified time interval|
|0x02||0xA602 (42498)||MsgQueue.ErrMsgqNotackedTimeout||Timeout: the message was not picked up within the specified time interval|
|0x03||0xA603 (42499)||MsgQueue.ErrMsgqCollision||Collision: there is already a message in the queue - pick up this data first|
|0x04||0xA604 (42500)||MsgQueue.ErrMsgqBufoverflow||Buffer Overflow: the message is too large and can not be processed|