Adsb is a PHP library that decode adsb DF17 message issued from dump1090 raw message (port3002).

dev-master 2017-08-31 15:30 UTC

This package is not auto-updated.

Last update: 2024-05-11 16:29:13 UTC


README

This component decode DF17 raw message from dump1090 program (port 30002). [dump1090] (https://github.com/antirez/dump1090)

For using it :

in the composer.json file add this require :

"require": {
    "kletellier/adsb": "dev-master"
}

after composer update you can use it by adding the composer autoload to your project.

require 'vendor/autoload.php';

###Example :

use Kletellier\Adsb;
// use message 8D4CA2AC9940E9B0600403144BEB
$adsb = new Adsb("8D4CA2AC9940E9B0600403144BEB");
if($adsb->isValid())
{
    // message CRC  is correct
    // you can test the message type
    if($adsb->isisAircraftVelocitiesMsg())
    {
        echo "Aircraft Icao code : " . $adsb->getIcao(); ."\n"; // present in all messages
        echo "Actual speed : " . $adsb->getSpeed()."\n";
        echo "Actual heading : " . $adsb->getHeading()."\n";
    }
    if($adsb->isAircraftIdentificationMsg())
    {
        echo "Aircraft Icao code : " . $adsb->getIcao(); ."\n"; // present in all messages
        echo "Actual flight number : " . $adsb->getIdent()."\n";         
    }
}

For retrieve position it's an different way. You must have 2 messages, one odd message, and one even message. You must specify the Epoch time for each message in constructor (or by setTs method). The Epoch Time difference for 2 messages must not greater than 10 seconds, or result will be incorrect.

Example :

use Kletellier\Adsb;
use Kletellier\AdsbUtils;

// use message 
$adsb_odd = new Adsb("*8D4CA1FA58BDF40C1A61F7846E27;",1443430837);
$adsb_even = new Adsb("*8D4CA1FA58BDF095F26507CB5A87;",1443430840);
// this message was necessary from same icao aircraft and a position message 
// test : $adsb_odd->isAircraftPositionMsg() must be true
// check odd and even bit 
if($adsb_odd->getOe=="1" && $adsb_even->getOe=="0")
{
    $latlon = AdsbUtils::getCoordinates($adsb_odd,$adsb_even);
    echo "airplane : " . $adsb_odd->getIcao . "\n";
    echo "latitude : " . $latlon["latitude"] . "\n";
    echo "longitude : " . $latlon["longitude"] . "\n";
}
  

You can use an example to connect directly to Dump1090 in example folder.

Just change the ip of your dump1090 instance :

$dump1090_ip = "127.0.0.1";

in linux change chmod :

chmod +x sbs-raw.php 

and launch it :

./sbs-raw.php