Searching, please wait...

libhomeradar

easy collect aircraft information
~50,000,000 registered contacts
303894 unique aircraft records, 28.78% unresolved records
 ACARS DECODER Planespotting Network Kinetic Avionics AirNav Systems Airframes.org Atlas Tracking
libhomeradar - easy collect aircraft informations

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.


Yahoo! My Web  Google Bookmarks  Windows Live  Facebook  Ask  del.icio.us  Furl 
 

This short example will demonstrate the data sharing option of libhomeradar.
As known from SBS1 and Radarbox, you can also pickup all contacts over TCP/IP sockets. Since version 1.005 libhomeradar can also enable the data sharing option on port 30003 (can be changed).
You have to decide who can connect and pickup your contacts with a simple IP-based exclusion table.

After start of this example you can start a telnet session to see the shared data:
telnet localhost 3333


 
Data sharing is not legal in every country. Please check this before you enable this option.
You have to assume total responsibility on the consequences of sharing your aircraft contacts
libhomeradar - easy collect aircraft informations - Download example  Download this source
/* System includes */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

/* libhomeradar header include */
#include "libhomeradar.h"

/* Callback function to show aircraft informations */
void newcontact(void *handle,const int *id, LHR_CONTACT *C) {
  LHR_AIRPORTS *P;

  printf("%sContact: %s [%s]\nAirline: %s\nFlightnumber: %s  Callsign: %s\nSquawk: %d\n",
         (C->newcontact)?"AIR":"",
          C->icao24,(C->reg)?C->reg:"UNKNOWN",
         (C->airline)?C->airline:"NULL",C->flightnum,C->callsign,C->squawk);
  printf("Aircraft: %s %s [%s] cn:%s\n",C->manufacturer,C->model,C->details,C->cn);
  printf("Routing: %s LAT: %0.5f LON: %0.5f\n",C->route,C->lat,C->lon);

  /* Get airport informations */
  P = C->airports;
  while (P) {
    if (P->airport) {
      printf("Airport [%s / %s] Name: %s, %s\n",
             P->airport->iata,P->airport->icao,
             P->airport->name,P->airport->country);
    } else printf("Unresolveable: %s\n",P->apcode);
    P = P->next;
  }

  /* Free LHR_CONTACT struct */
  homeradar_freecontact(C); 
}

/* Connect is established */
void connected(LHR handle, const int *item) {
  printf("SUCCESSFULLY CONNECTED TO = %s\n",homeradar_gethostbyid(handle,*(item)));

  /* Setup the event listener for the LHR_ONCONTACT event */
  if (homeradar_onhandler(handle, LHR_ONCONTACT, *(item), newcontact)==0) {
    printf("Unable to add event listener\n");
  } else printf("Contact handler successfully installed\n");
}

/* Main program */
int main(int argc, char **argv) {
  int e;
  LHR H = homeradar_init(16,LHR_AUTOCONNECT,&e,NULL);

  /* No error */
  if (H == NULL) {
    printf("Error initializing libhomeradar. Errorcode #%d\n",e);
    return 255;
  }

  /* Add host without event listener */
  e = homeradar_addhost(H, "sbs1.libhomeradar.org", 33033, LHR_SBS1, LHR_ONCONNECT, connected);

  /* Enable direct data sharing on localhost port 3333 
     3rd parameter will enable (1) or disable (0) the sharing function
     4th parameter (1) allow access for all (0) all access denied except 
                   (see access homeradar_access_rule() 
   */
  if (!(homeradar_share(H, 3333, 1, 1))) {
    fprintf(stderr,"Unable to share data\n");
  } else {

    /* Set limit to max. 3 connections */
    e = 3; homeradar_config(H, LHR_SHARE_LIMIT, &e);

    /* Add allowed host 
       By default all hosts are accepted. 
       To exclude all and include only special ips, use the following function */
    // homeradar_access_rule(H, "<allowed ip here>", FALSE);

    fprintf(stderr,"Now start a telnet application with: telnet localhost 3333\n");
  }  

  /* Do nothing - in this example - loop will be finished after 5 minutes
     In your real program you can do now what you want */
  e = 50;
  while (e--) sleep(6);

  /* Shutdown libhomeradar and free all alocated memory */
  printf("Shutdown libhomeradar...\n");
  homeradar_destroy(H);

  /* Return success */
  return 0;
}