Giter Club home page Giter Club logo

adsb's Introduction

Ads-b decoder for PHP

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 

adsb's People

Contributors

kletellier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hitzi inghoststv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.