Introduction:
In this example, it demonstrates how to use a produce consumer architecture to be able to send and receive commands from a COM Port. The producer loop handles all the user generated events while the consumer loop manages the communication to the COM Port.
Components to the Example:
1.) Initializes the Queue that passes the states.
2.) Produce Loop Cases of the Event Structure:
Timeout: Check to see if the is any errors.
Initialize: Sends the Initialize command
Write: Sends the write command
Close: Sends the Close Command
3.) Consumer Loop Cases of the Case Structure
Wait: Waits for a command from the Consumer loop
Initialize: Initialize the COM Port and send it to the Read Port State
Read Port: Checks the bytes at port and reads the data back from port
Write Port: Writes a command to the port and send it to the Read Port State
Close: Closes the Session and stops the while loop.
4.) Closes the Queue and displays errors.