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 
 

Callbacks and event listener

There are a lot of events for which you can create listeners.
Your callback function will not be called in the same thread as your controlling program. You should always build a reference to your main variables which can be reachable from a different thread.
Per default libhomeradar will start the callback function not in the same thread where the collector is running to prevent loss of data or deadlocks. You can disable this option by setting the LHR_NOCALLBACKTHEADS flag during the libhomeradar_init() call or later with the homeradar_config() function.

libhomeradar has two types of callback functions.

Version I - Hostevents
Your registered callback function will be called as:

 (void)callback_function(LHR H, const int *item);

The first paramater is the handle to the library and the second is a pointer to the hostid from which the event was thrown.
You can use the libhomeradar_gethostbyid(handle,*(item)) function to get the hostname or you can use the hostid to make some other calls which requires the hostid

Version II - Contactevents
Your registered callback function will be called as:

  (void)callback_function(LHR H, const int *id, const char *item)

The first parameter is the handle to the library, the second is the hostid of the host on which the event was thrown.
The third parameter is a pointer to the LHR_CONTACT struct which contains all informations about the contacted aircraft.
You MUST call the libhomeradar_freecontact() function with the address of *item before you leave the function to free all allocated memory.
 
Short example for the ONCONTACT event listener:

void newcontact(void *handle,const int *id, LHR_CONTACT *C) {
  LHR_AIRPORTS *P;

  printf("------------------------------\n%s
          Contact: %s [%s]\nAirline: %s\nFlightnumber: %s  Callsign: %s\n
          Squawk: %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  Position LAT: %0.5f LON: %0.5f\n",C->route,C->lat,C->lon);
  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 used memory */
  homeradar_freecontact(C); 
}

EXAMPLE OUTPUT:

------------------------------
Contact: 3C7207 [D-ALPG]
Airline: LTU International Airways
Flightnumber: LT1732  Callsign: LTU1732
Squawk: 0
Aircraft: Airbus A332 [A330-223] cn:0493
Routing: MUC-CMB-MLE LAT: 0.00000 LON: 0.00000
Airport [MUC / EDDM] Name: Munich, Franz Josef Strauss, Germany
Airport [CMB / VCBI] Name: Colombo, Katunayake, Sri Lanka
Airport [MLE / VRMM] Name: Male/Hulule Island, International, Maldives

As you see you can get all airport informations within a simple while() construct. The airport informations are encapsulated within the LHR_AIRPORTS and the LHR_AP datatype. You should always check if the next pointer is NULL. In this case you have reached the end of the available airport informations.
The datatype LHR_AP will provide all needed informations for a single airport (if available and lookup is enabled).

THE AIRPORT LOOKUP DEPENDS ON THE FLIGHTLOOKUP!

Informations like squawk code or the current position are not always available on the socket output and can be added later. libhomeradar will buffer some informations about the contact to add later missing informations like the squawk or the current position.
 
A special event is the ONAIR event. This event will thrown on every AIR message from the SBS-1 system. This means the radar has contacted a new aircraft. In this case (if you have registered a callback function for this event) the LHR_CONTACT item will only contain informations about the aircraft and not about the flight and aircraft position.

Manually connect to hosts Docu
Table of contents
Possible events in libhomeradar