MAKING QUALITY CONNECTIONS
Øystein Holvik Johnsen
Lightning talk - in English
You may be creating a software application that will communicate with an external device like a motor controller, a sensor, a television set or a washing machine. However, handling connections to external devices in a software application can be challenging. The communication port may be busy, or may be missing entirely in the system if for instance a USB based serial port is unplugged. The operator may have forgotten to press the “Connect” button. The device may have crashed or had a power loss, leaving the device in an uninitialized state or out of synchronization with the application.
A good way to handle these problems is to use a connection handler whose only purpose is to keep a quality connection to the device. The connection handler will take care of:
- Determining the presence and availability of the configured port.
- Obtaining control of the configured port.
- Determining the presence of a connected device.
- Initializing the device with a handshake routine.
- Monitoring and maintaining the connection to the device.
- Cleaning up if the connection is lost, and starting over again.
I will demonstrate a quick example on how to be in control.