]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/trafficcontrol.hxx
Merge branch 'next' into durk-atc
[flightgear.git] / src / ATC / trafficcontrol.hxx
index 7e83a72b476097808a23c9745046a93eab2d1a64..66381af52f140e930c307c33a790b13e7546340c 100644 (file)
@@ -31,8 +31,8 @@
 // There is probably a better include than sg_geodesy to get the SG_NM_TO_METER...
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/debug/logstream.hxx>
-
-
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
 
 #include <string>
 #include <vector>
@@ -223,6 +223,9 @@ typedef vector<ActiveRunway>::iterator ActiveRunwayVecIterator;
  *************************************************************************************/
 class FGATCController
 {
+private:
+     bool initialized;
+
 protected:
   bool available;
   time_t lastTransmission;
@@ -232,6 +235,7 @@ protected:
 
   string formatATCFrequency3_2(int );
   string genTransponderCode(string fltRules);
+  bool isUserAircraft(FGAIAircraft*); 
 
 public:
   typedef enum {
@@ -257,21 +261,26 @@ public:
       ATC_AIR_TO_GROUND,
       ATC_GROUND_TO_AIR } AtcMsgDir;
   FGATCController();
-  virtual ~FGATCController() {};
+  virtual ~FGATCController();
+  void init();
+
   virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
-                               double lat, double lon,
-                               double hdg, double spd, double alt, double radius, int leg,
-                               FGAIAircraft *aircraft) = 0;
+                                double lat, double lon,
+                                double hdg, double spd, double alt, double radius, int leg,
+                                FGAIAircraft *aircraft) = 0;
   virtual void             signOff(int id) = 0;
-  virtual void             update(int id, double lat, double lon, 
-                                 double heading, double speed, double alt, double dt) = 0;
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
+                                                     double heading, double speed, double alt, double dt) = 0;
   virtual bool             hasInstruction(int id) = 0;
   virtual FGATCInstruction getInstruction(int id) = 0;
 
   double getDt() { return dt_count; };
   void   setDt(double dt) { dt_count = dt;};
-  void transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir);
+  void transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir, bool audible);
   string getGateName(FGAIAircraft *aircraft);
+
+private:
+ AtcMsgDir lastTransmissionDirection;
 };
 
 /******************************************************************************
@@ -291,7 +300,7 @@ public:
                                double hdg, double spd, double alt, double radius, int leg,
                                FGAIAircraft *aircraft);
   virtual void             signOff(int id);
-  virtual void             update(int id, double lat, double lon, 
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
                                  double heading, double speed, double alt, double dt);
   virtual bool             hasInstruction(int id);
   virtual FGATCInstruction getInstruction(int id);
@@ -319,7 +328,7 @@ public:
                                double hdg, double spd, double alt, double radius, int leg,
                                FGAIAircraft *aircraft);
   virtual void             signOff(int id);
-  virtual void             update(int id, double lat, double lon, 
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
                                  double heading, double speed, double alt, double dt);
   virtual bool             hasInstruction(int id);
   virtual FGATCInstruction getInstruction(int id);
@@ -327,6 +336,10 @@ public:
   bool hasActiveTraffic() { return activeTraffic.size() != 0; };
   TrafficVector &getActiveTraffic() { return activeTraffic; };
 
+  // Hpoefully, we can move this function to the base class, but I need to verify what is needed for the other controllers before doing so.
+  bool checkTransmissionState(int st, time_t now, time_t startTime, TrafficVectorIterator i, AtcMsgId msgId,
+                               AtcMsgDir msgDir);
+
 }; 
 
 /******************************************************************************
@@ -346,7 +359,7 @@ public:
                                double hdg, double spd, double alt, double radius, int leg,
                                FGAIAircraft *aircraft);
   virtual void             signOff(int id);
-  virtual void             update(int id, double lat, double lon, 
+  virtual void             updateAircraftInformation(int id, double lat, double lon, 
                                  double heading, double speed, double alt, double dt);
   virtual bool             hasInstruction(int id);
   virtual FGATCInstruction getInstruction(int id);