Keywords
--------
- The system is only able to process one command at a time (both SYS and DIR commands).
- ComInstance.ReplyStatus holds the information about command processing.
- Writing flag indicated that the reply is ready to be transmitted
- Direct commands are commands to be interpreted by VM - Direct commands are not interpreted until process is
returned to the VM
- System commands are usually processed when received except for large messages (messages larger that buffersize)
- Brick responds on the same channel as a message is received - ComInstance.ActiveComCh = received channel
Message flow
------------
Direct command --------------> When received ----> if reply required ----> ComInstance.ReplyStatus = DIR_CMD_REPLY
|
'------------> if no reply required ----> ComInstance.ReplyStatus = DIR_CMD_NOREPLY
VM reply to direct command -> if (ComInstance.ReplyStatus = DIR_CMD_REPLY)----> pTxBuf->Writing = 1
(VM always replies, after interpretation) ComInstance.ReplyStatus = 0
|
'-----------------> if (ComInstance.ReplyStatus = DIR_CMD_NOREPLY)--> pTxBuf->Writing = 0
ComInstance.ReplyStatus = 0
System command --------------> if reply required -> ComInstance.ReplyStatus = SYS_CMD_REPLY --> if (pRxBuf->State = RXFILEDL) -> Do nothing
| |
| '------------------------> if (pRxBuf->State != RXFILEDL) -> pTxBuf->Writing = 1
| ComInstance.ReplyStatus = 0
|
'-----------------------> If reply not req. -> ComInstance.ReplyStatus = SYS_CMD_NOREPLY -> if (pRxBuf->State = RXFILEDL) -> Do nothing
|
'------------------------> if (pRxBuf->State != RXFILEDL) -> ComInstance.ReplyStatus = 0
Large messages - Massages larger than buffer size (1024 bytes):
Potential large message commands:
- BEGIN_DOWNLOAD
- CONTINUE_DOWNLOAD
- BEGIN_UPLOAD
- CONTINUE_UPLOAD
- BEGIN_GETFILE
- CONTINUE_GETFILE
- LIST_FILES
- CONTINUE_LIST_FILES
Large files ---------> (Message size <= Buffer size) --> Write bytes to file
| --> pRxBuf->State = RXIDLE
|
|
'---------------> (Message size > Buffer Size) --> Write bytes from buffer
--> pRxBuf->State = RXFILEDL
Buffer full ---> if pRxBuf->State = RXFILEDL --> Yes -> write into buffer
| |
| '------------------> if Remainig msg = 0 --> pRxBuf->State = RXIDLE
|
'------------------> No --> Interprete as new command