
libhomeradar is an easy to use library for all type of programming language which can use libraries. libhomeradar can connect to different sources to collect aircraft informations arround the world with extended informations, powerful filtering and structured data access. libhomeradar is written in C and is available for Linux and Windows (2003, XP, NT, Vista). Currently libhomeradar works with the Kinetic Avionics SBS-1 base station and the Airnav Systems Radarbox.
|
How to use libhomeradar - Examples
Here you'll find some examples on how to use the libhomeradar functions in your own program. For tests you can use our server which is connected to SBS-1 and Radarbox. The server should be up 24/7. ( see our latest news )
SBS-1 address sbs1.libhomeradar.org Port 33033
Radarbox address radarbox.libhomeradar.org Port 33333
These samples are created for the Linux version of libhomeradar and can be compiled with the following commandline under Linux. FOR LINUX USERS: If you have the library not in your standard system library path, you should add the library location to your systems path with the following command
export LD_LIBRARY_PATH=<path to the library folder>
To use these examples under Windows (CYGWIN or MINGW) you have to include the Windows headerfile #include <windows.h> and replace the call so sleep(t) to Sleep(t*1000)
FOR WINDOWS USERS: There is a working example binary included within the latest library package.
gcc -s -Wall -O3 <example.c> -o <output> -lhomeradar -lpthread -L./
Connecting to 2 hosts and show contacts
This example will connect to two SBS-1 hosts and will show all the contacted aircrafts on stdout. The library will be initialized with the LHR_AUTOCONNECT flag to immediatly connect to added hosts....
Connect to hosts with event handler
In this example we try to add 3 hosts to the library handle and for every host we add an event handler for the LHR_ONCONNECT, LHR_ONTIMEOUT, LHR_ONFAILED and LHR_ONLOSS event handler. All contacted...
Show contacts with full database support
This example is nearly the same as example #1. Now we try to load the provided databases and now (if successfully loaded) all contacted aircrafts can be written will full type informations, flight ...
Connecting to one host with eventhandler
This example will show you how to connect to a single SBS-1 source with an event listener for the LHR_ONCONTACT event. Contacted aircrafts will be written to the terminal. The lib will be initializ...
Show only Lufthansa aircrafts
This example will connect to a single SBS-1 host and only aircrafts from the German Carrier 'Lufthansa' will be written to stdout. We use a single filter rule to realize this plan. For some filter ...
Connecting to a single host and get new contacts
This example will connect to one SBS-1 host and only the new contacted aircrafts will be written to stdout. All other contacts will be ignored. The library will be initialized with the LHR_AUTOCONN...
FullQueue event listener example
This example will connect to our SBS-1 box and will immediatly new contacted aircrafts. All other contacts will be inserted into the libraries internal queue. After the queue has reached the limit ...
Extended filter rules in use
This short example will connect to our SBS-1 host and will display only aircrafts from the Austrian carrier 'Austrian Airlines' and only aircrafts which are not build by Airbus. This will be realiz...
Connect to two hosts with statistic output
Here we try to connect to two SBS-1 hosts. All contacted aircrafts will be written to stdout. New contacts will get a special output format. During shutdown of the program the usage statistics from...
Show all aircrafts within 100km from server
This short example will try to establish a connection with our SBS-1 box and will set the GPS coordinates of the SBS-1 host location. Only aircrafts will be shown which are within an radius of 100k...
libhomeradar database lookup samples
This program will only initialize the libhomeradar handle but we will not add any hosts. Here you see the database lookups which can be made by libhomeradar. To enable database lookups you should l...
Show only aircrafts from the russian federation
This example will establish a connection to our SBS-1 server and will display only aircrafts which are registered in the Russian Federation. This will be done by a filterrule ( see homeradar_addfil...
Send contacts to the collector server
This example show you how to send your contact data to our collector server at collector.libhomeradar.org on port 8080 . All messages from the connected host will be send to the collector. This is ...
Connect to SBS1 and RadarBox
This short example will connect to an SBS1 host and to an RadarBox host. There will be a listener on port 10000 installed on which you can see all decoded messages (telnet localhost 10000). After 5...
Connect to a socketserver on port 10000
With this example we will not add any hosts. We try to connect to a running libhomeradar instance which have a listener on port 10000 installed. (See example #13). The mode is LHR_POLL (active mode...
|