#include <map>
#include <simgear/props/props.hxx>
-#include <simgear/sound/sample_openal.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
-#include "mk_viii.hxx" // voiceplayer only
+#include <Sound/voiceplayer.hxx>
using std::vector;
using std::deque;
typedef struct
{
- bool verticalTA;
- bool verticalRA;
- bool horizontalTA;
- bool horizontalRA;
- float horizontalTau;
- float verticalTau;
- float relativeAltitudeFt;
- float verticalFps;
+ string callsign;
+ bool verticalTA;
+ bool verticalRA;
+ bool horizontalTA;
+ bool horizontalRA;
+ bool isTracked;
+ float horizontalTau;
+ float verticalTau;
+ float relativeAltitudeFt;
+ float verticalFps;
+ int RASense;
} ThreatInfo;
+ typedef struct
+ {
+ int threatLevel;
+ double TAtimestamp;
+ double RAtimestamp;
+ } TrackerTarget;
+
+ typedef map<string,TrackerTarget*> TrackerTargets;
+
typedef struct
{
double lat;
double lon;
- float altFt;
+ float pressureAltFt;
+ float radarAltFt;
float heading;
float velocityKt;
float verticalFps;
} LocalInfo; /*< info structure for local aircraft */
-// /////////////////////////////////////////////////////////////////////////////
-// // TCAS::Timer //////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////////////
-//
-// class Timer
-// {
-// double start_time;
-//
-// public:
-// bool running;
-//
-// inline Timer ()
-// : running(false) {}
-//
-// inline void start () { running = true; start_time = globals->get_sim_time_sec(); }
-// inline void stop () { running = false; }
-// inline double elapsed () const { assert(running); return globals->get_sim_time_sec() - start_time; }
-// inline double start_or_elapsed ()
-// {
-// if (running)
-// return elapsed();
-// else
-// {
-// start();
-// return 0;
-// }
-// }
-// };
-
/////////////////////////////////////////////////////////////////////////////
// TCAS::PropertiesHandler ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
bool isPlaying (void) { return voicePlayer.is_playing();}
private:
+ TCAS* tcas;
ResolutionAdvisory previous;
FGVoicePlayer::Voice* pLastVoice;
VoicePlayer voicePlayer;
SGPropertyNode_ptr nodeTAWarning;
};
+ /////////////////////////////////////////////////////////////////////////////
+ // TCAS::Tracker ////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////
+
+ class Tracker
+ {
+ public:
+ Tracker (TCAS* _tcas);
+ ~Tracker (void) {}
+
+ void update (void);
+
+ void add (const string callsign, int detectedLevel);
+ bool active (void) { return haveTargets;}
+ bool newTraffic (void) { return newTargets;}
+ bool isTracked (string callsign) { if (!haveTargets) return false;else return _isTracked(callsign);}
+ bool _isTracked (string callsign);
+ int getThreatLevel (string callsign);
+
+ private:
+ TCAS* tcas;
+ double currentTime;
+ bool haveTargets;
+ bool newTargets;
+ TrackerTargets targets;
+ };
+
/////////////////////////////////////////////////////////////////////////////
// TCAS::AdvisoryGenerator //////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
AdvisoryGenerator (TCAS* _tcas);
~AdvisoryGenerator (void) {}
- void init (const LocalInfo* _pSelf, const ThreatInfo* _pCurrentThreat);
+ void init (const LocalInfo* _pSelf, ThreatInfo* _pCurrentThreat);
void setAlarmThresholds (const SensitivityLevel* _pAlarmThresholds);
private:
TCAS* tcas;
const LocalInfo* pSelf; /*< info structure for local aircraft */
- const ThreatInfo* pCurrentThreat; /*< info structure on current intruder/threat */
+ ThreatInfo* pCurrentThreat; /*< info structure on current intruder/threat */
const SensitivityLevel* pAlarmThresholds;
};
void horizontalThreat (float bearing, float distanceNm, float heading,
float velocityKt);
- void setAlt (float altFt) { self.altFt = altFt;}
- float getAlt (void) { return self.altFt;}
+ void setPressureAlt (float altFt) { self.pressureAltFt = altFt;}
+ float getPressureAlt (void) { return self.pressureAltFt;}
+
+ void setRadarAlt (float altFt) { self.radarAltFt = altFt;}
+ float getRadarAlt (void) { return self.radarAltFt;}
+
float getVelocityKt (void) { return self.velocityKt;}
+ int getRASense (void) { return currentThreat.RASense;}
private:
void unitTest (void);
SGPropertyNode_ptr nodeLat;
SGPropertyNode_ptr nodeLon;
- SGPropertyNode_ptr nodeAlt;
+ SGPropertyNode_ptr nodePressureAlt;
+ SGPropertyNode_ptr nodeRadarAlt;
SGPropertyNode_ptr nodeHeading;
SGPropertyNode_ptr nodeVelocity;
SGPropertyNode_ptr nodeVerticalFps;
PropertiesHandler properties_handler;
ThreatDetector threatDetector;
+ Tracker tracker;
AdvisoryCoordinator advisoryCoordinator;
AdvisoryGenerator advisoryGenerator;
Annunciator annunciator;