FLIR Integration

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:

  1. Open a socket to the IP address of the camera and port 23
  2. Connect to the socket.
  3. Listen for the camera to send a WILL command which it will do with a <CR>
    1. byte order: 255 251 1 255 251 3
  4. Respond with DON’T
    1. byte order: 255 254 1 255 254 3
  5. Wait for ‘>’ or 62
  6. Now you are ready to send commands
  7. All you have to do is stuff byte arrays and finish with <CR><LF>
    1. Version info: “version\r\n”
    2. Delete Pic: “del filename.jpg\r\n”
    3. Get Pic: “store filename.jpg\r\n”
  8. Make sure you wait for the ‘>’ byte after each command
  9. Here is how you get a picture and then delete it from the camera
    1. Send the Get Pic command
    2. Wait for ‘>’
    3. Use system commands to wget the picture: system(“wget IP:/filename.jpg”);
    4. Send the Delete Pic command
    5. Wait for ‘>’