This page will describe how to programmatically interface to an A320 FLIR Infrared Camera. The A320 has a variety of interfaces, but the ones I will describe are using the ethernet port and a telnet connection. This allows you to communicate to the built in command line interface to control the camera and take pictures. The code does not encompass all of the features of the camera. It is meant to simply take pictures and download them from the camera. In addition, the program shows how to get version information. This method is the same as sending any other command if addition features need to be implemented. It also uses the libCOMM library to handle the socket connection functions.
Telnet is a network protocol that is used for bidirectional text oriented communication. After search and trying a variety of free c libraries, I did not find a good telnet library. The code starts from scratch based on the telnet spec found here. The entire protocol is not implemented due to time constraints. The readers digest version is Telnet typically communicates over port 23 and it uses specific commands found in the documentation preceded by the Interpret As Command (IAC) byte. The protocol also ends messages with <CR><LF>. It was also found the FLIR sends this twice and then \> characters as well. Because of this the code waits for the > character to be received as this means the FLIR is ready to interpret another command.
The basics steps are the following:
- Open a socket to the IP address of the camera and port 23
- Connect to the socket.
- Listen for the camera to send a WILL command which it will do with a <CR>
- byte order: 255 251 1 255 251 3
- Respond with DON’T
- byte order: 255 254 1 255 254 3
- Wait for ‘>’ or 62
- Now you are ready to send commands
- All you have to do is stuff byte arrays and finish with <CR><LF>
- Version info: “version\r\n”
- Delete Pic: “del filename.jpg\r\n”
- Get Pic: “store filename.jpg\r\n”
- Make sure you wait for the ‘>’ byte after each command
- Here is how you get a picture and then delete it from the camera
- Send the Get Pic command
- Wait for ‘>’
- Use system commands to wget the picture: system(“wget IP:/filename.jpg”);
- Send the Delete Pic command
- Wait for ‘>’