As detailed in the environment setup section, we had to switch serial libraries. The integration of a Qt friendly library made the project much easier in terms of maintenance and development.
We elected to do an event driven approach to serial. Using the UART4 of the BeagleBone we were able to communicate with the SIM module in order to send messages and receive information. All traffic to and from the SIM was redirected to the the settings page for easy debug.
Each time the readyRead() function is called it gathers information about the packet on the wire. Some important things to note about AT commands:
- All commands end with a carriage return (“/r”)
- +CIND gives information about the status of the device
We parsed the data to make sense of the commands. This was all accomplished by leaning heavily on QString API and processing the strings into a message pool.
As always, we’ll let the code speak for itself: