- Main Page
- Related Pages
- Classes
- Files

libcanaero, a C++ library to access CAN Aerospace over UDP

## INTRODUCTION

This library allows an easy, reliable and fast access to CAN aerospace over network. It uses UDP multicast to feed multiple clients with flight data from a variety of flight simulators. Currently Laminar Research X-Plane (R) and Microsoft Flight Simulator (R) are supported.

## FEATURES

- Runs on Linux, Mac OS X and Windows
- No end-user configuration required
- Simulator data is normalized to the SI system
- Applications using libcanaero are agnostic of which simulator is providing data
- Strongly typed data access

## PREREQUISITES

### Linux

Make sure you have gcc 4.5 installed. It is most likely already part of your distribution, or available as a distribution package.

1. The boost threading library version 1.45 is required.
   To get it, go to https://sourceforge.net/projects/boost/files/boost/1.45.0/
2. Unpack boost to your home folder.
3. Open a terminal, navigate to the boost folder and run

        ./bootstrap.sh

4. Run

        sudo ./bjam install -q --layout=system --with-system --with-thread toolset=gcc variant=release link=static threading=multi

   This places the boost libraries in /usr/local/lib and the boost headers in /usr/local/include.
5. You may now delete the folder where you unpacked boost.

### Mac OS X

1. Install the developer tools from your OS X DVD.
2. Users of 10.6 Snow Leopard skip to step 4.
3. The 10.5 Leopard developer tools ship with gcc versions 4.01 and 4.2.1. Unfortunately 4.0.1 is set as default, which isn't very mature. So we set 4.2.1 as the default compiler. Open a terminal and run

           cd /usr/bin
           sudo rm cc gcc c++ g++
           ln -s gcc-4.2 cc
           ln -s gcc-4.2 gcc
           ln -s c++-4.2 c++
           ln -s g++-4.2 g++
           cd

   As usual sudo requires the password of your administrator account.
4. The boost threading library version 1.45 is required.
   To get it, go to https://sourceforge.net/projects/boost/files/boost/1.45.0/
5. Unpack boost to your home folder.
6. Open a terminal, navigate to the boost folder and run

        ./bootstrap.sh

   Ignore the Unicode/ICU support for boost.Regex?... not found message.
7. Run

        sudo ./bjam install -q --layout=system --with-system --with-thread toolset=darwin variant=release link=static threading=multi architecture=combined

   This places the boost libraries in /usr/local/lib and the boost headers in /usr/local/include.
8. You may now delete the folder where you unpacked boost.

### Windows

1. Get the gcc 4.4 compiler bundled with the Qt SDK 2010.05. Download it from ftp://ftp.qt.nokia.com/qtsdk/qt-sdk-win-opensource-2010.05.exe
2. Install it with all options set to default, by just clicking "Continue".
3. The boost threading library version 1.45 is required.
   To get it, go to https://sourceforge.net/projects/boost/files/boost/1.45.0/
4. Unpack boost to your home folder.
5. Open Start->Programs->Qt SDK by Nokia v2010.05 (open source)->Qt Command Prompt
   Note:
     It won't work with the default commandline window, since the environment variables must be set to match the compiler. The Shortcut placed in the Qt SDK folder of the start menu does this conveniently.
6. In this command window, navigate to the boost folder and run

        bootstrap.bat

7. Run

        bjam.exe install -q --layout=system --with-system --with-thread toolset=gcc variant=release link=static threading=multi

   This places the boost libraries in C:\boost\lib and the boost headers in C:\boost\include.
8. You may now delete the folder where you unpacked boost.

### OTHER

Most platforms offer additional compiler environments than those listed above. In order to guarantee success with SCS on all platforms, using the above compiler environments is mandatory.

## USAGE SUMMARY

1. Include receiver.h and import the namespace SCS.
2. Include ids.h to have a convenient access to all available IDs (data offered by SCS).
3. Create a SCS::Receiver instance.
4. Inform the receiver instance which data you want to receive from or send to the network.
5. Call SCS::Receiver::run from your application's main loop.
6. For more advanced usage, like publishing your own data or exposing modules to configuration services, you can create a class inheriting from Receiver.
7. To do so, familiarize yourself with the SCS::Receiver class.
8. Use one of the supplied Makefiles.xxx to build the application.

## EXAMPLE

See the examples directory for the annotated "hello-scs" example that shows the basic concept. To compile it, use the supplied Makefiles.

### Windows

- Open the Qt SDK command prompt Start->Programs->Qt SDK by Nokia v2010.05 (open source)->Qt Command Prompt
- Navigate to the hello-scs directory and run

       mingw32-make -f Makefile.Win

### Mac

- Open a terminal, navigate to the hello-scs directory and run

       make -f Makefile.Mac

### Linux

- Open a terminal, navigate to the hello-scs directory and run

       make -f Makefile.Linux

## NOTES

- For accessing Microsoft Flight Simulator (R), FSUIPC by Pete Dowson is required.
- Detailed specification of CAN Aerospace can be found at http://stockflightsystems.com

## LICENSE

Copyright (C) 2008-2010 by Philipp Münzel. All rights reserved.

You are hereby granted the right to include an unmodified copy of libcanaero in binary form into your open- or closed-source, commercially or non-commercially licensed application.

Modifying your copy of libcanaero in any way is prohibited. Although some parts of libcanaero's source code (.h-files) are published, you are not allowed to modify these parts and/or create new binary distributions of libcanaero.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.