RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
ADSBClient Class Reference

Client for receiving and decoding ADS-B broadcast. More...

#include <ADSB.h>

Public Member Functions

 ADSBClient (PhysicalLayer *phy)
 Default constructor.
 
int16_t begin ()
 Initialization method.
 
int16_t decode (const uint8_t in[RADIOLIB_ADSB_FRAME_LEN_BYTES], ADSBFrame *out)
 Frame decoding method, turns raw received binary data into ADS-B frame.
 
int16_t parseHexId (const ADSBFrame *in, char id[RADIOLIB_ADSB_HEX_ID_LEN])
 Method to parse the transponder ICAO address (hex ID).
 
int16_t parseCallsign (const ADSBFrame *in, char callsign[RADIOLIB_ADSB_CALLSIGN_LEN], ADSBAircraftCategory *cat=NULL)
 Method to parse callsign from a received frame.
 
void setReferencePosition (float lat, float lon)
 Method to set reference position to be used during airborne position calculation.
 
int16_t parseAirbornePosition (const ADSBFrame *in, int *alt, float *lat, float *lon, bool *altGnss=NULL)
 Parse aircraft position from incoming frame, uasing reference position set by setReferencePosition. The reference position is the "rough area" where the aircraft is located, typically it is the receiver location. Aircraft position will be calcualted accurately only within 180 nautical miles (about 333 km) from the reference position!
 

Detailed Description

Client for receiving and decoding ADS-B broadcast.

Constructor & Destructor Documentation

◆ ADSBClient()

ADSBClient::ADSBClient ( PhysicalLayer phy)
explicit

Default constructor.

Parameters
phyPointer to the wireless module providing PhysicalLayer communication.

Member Function Documentation

◆ begin()

int16_t ADSBClient::begin ( )

Initialization method.

Returns
Status Codes

◆ decode()

int16_t ADSBClient::decode ( const uint8_t  in[RADIOLIB_ADSB_FRAME_LEN_BYTES],
ADSBFrame out 
)

Frame decoding method, turns raw received binary data into ADS-B frame.

Parameters
inReceived raw data.
outPointer to ADSBFrame where the decoded frame will be saved.
Returns
Status Codes

◆ parseAirbornePosition()

int16_t ADSBClient::parseAirbornePosition ( const ADSBFrame in,
int *  alt,
float *  lat,
float *  lon,
bool *  altGnss = NULL 
)

Parse aircraft position from incoming frame, uasing reference position set by setReferencePosition. The reference position is the "rough area" where the aircraft is located, typically it is the receiver location. Aircraft position will be calcualted accurately only within 180 nautical miles (about 333 km) from the reference position!

Parameters
inPointer to ADSBFrame where decoded frame was saved.
altPointer to variable where the parsed altitude will be saved. Can be set to null to skip altitude calculation. Units are feet for barometric altitude, meters for GNSS altitude.
latPointer to variable where the parsed latitude in degrees will be saved. Can be set to null to skip latitude calculation.
lonPointer to variable where the parsed longitude in degrees will be saved. Can be set to null to skip longitude calculation.
altGnssIf set, this variable will be set to true if the altitude source is GNSS, or false if the altitude is barometric.

◆ parseCallsign()

int16_t ADSBClient::parseCallsign ( const ADSBFrame in,
char  callsign[RADIOLIB_ADSB_CALLSIGN_LEN],
ADSBAircraftCategory *  cat = NULL 
)

Method to parse callsign from a received frame.

Parameters
inPointer to ADSBFrame where decoded frame was saved.
callsignBuffer where the parsed callsign will be saved as null-terminated string.
catIf set, parsed aircraft category will be saved here.
Returns
Status Codes

◆ parseHexId()

int16_t ADSBClient::parseHexId ( const ADSBFrame in,
char  id[RADIOLIB_ADSB_HEX_ID_LEN] 
)

Method to parse the transponder ICAO address (hex ID).

Parameters
inPointer to ADSBFrame where decoded frame was saved.
callsignBuffer where the parsed ID will be saved as null-terminated string.
Returns
Status Codes

◆ setReferencePosition()

void ADSBClient::setReferencePosition ( float  lat,
float  lon 
)

Method to set reference position to be used during airborne position calculation.

Parameters
latReference latitude in degrees (north positive, south negative).
latReference longitude in degrees (east positive, west negative).

The documentation for this class was generated from the following files: