Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_ADSB/sagetech-sdk/target.h
Views: 1799
/**1* @copyright Copyright (c) 2020 Sagetech, Inc. All rights reserved.2*3* @File: target.h4* @Author: jim billmeyer5*6* @date December 11, 2020, 12:49 AM7*/89#ifndef TARGET_H10#define TARGET_H1112#include <string.h>13#include <stdbool.h>14#include <stdint.h>1516#define XPNDR_ADSB_TARGETS 400 // change this to the max number of17// target supported in the system.1819typedef enum20{21trafLevel,22trafClimb,23trafDescend24} targetclimb_t;2526typedef enum27{28trafTraffic,29trafAdvisory,30trafResolution31} targetalert_t;3233// bit 0 - target found flag.34// bit 1 - target slot in use.35// bits 2-7 - the strike counter.36#define TARGET_FLAG_FOUND 0x0137#define TARGET_FLAG_USED 0x0238#define TARGET_FLAG_STRIKE_MASK 0xFC3940typedef struct __attribute__((packed))41{42uint32_t icao;43bool airborne;44float bearing;45uint8_t distance;46int8_t altDiff;47int16_t nvel;48int16_t evel;49targetclimb_t climb;50targetalert_t alert;51#ifdef TARGET_SVR52msg_svr_t svr;53#endif54uint8_t flag; // used internally to purge stale targets.55} target_t;5657typedef struct58{59uint32_t icao;60bool airborne;61float lat;62float lon;63int32_t alt;64int16_t heading;65uint16_t speed;66} ownship_t;6768/**69* Gets the target list.70*71* @return The array of traffic targets.72*/73target_t *targetList(void);7475/**76* Gets the ownship target information.77*78* @return The ownship target info.79*/80ownship_t *targetOwnship(void);8182/**83* Find a target based on its icao number.84*85* @param icao The target's icao number86*87* @return A pointer to the target element or null if not found.88*/89target_t *targetFind(uint32_t icao);9091/**92* Purge the traffic target list of stale traffic.93*94* The traffic gets purged if a find has not been done based95* on a strike counter.96*/97void targetPurge(void);9899/**100* Adds a target to the traffic target list.101*102* @param target The target to add.103*/104void targetAdd(target_t *target);105106/**107* Gets the target climb flag based on the vertical rate.108*109* @param vrate The current vertical rate of climb for the target.110*111* @return The level, climb or descend flag.112*/113targetclimb_t targetClimb(int16_t vrate);114115/**116* Gets the traffic alert flag.117*118* @param dist The distance of the target to the ownship.119* @param alt The altitude difference between the target and ownship.120* @param nvel The NS speed vector of the target.121* @param evel The EW speed vector of the target.122*123* @return The traffic flag based on the parameters.124*/125targetalert_t targetAlert(double dist,126uint16_t alt,127int16_t nvel,128int16_t evel);129130#endif /* TARGET_H */131132133