class SGSampleGroup;
-// Convert a frequency in MHz to tens of kHz
-// so we can use it e.g. as an index into commlist_freq
-//
-// If freq > 1000 assume it's already in tens of KHz;
-// otherwise assume MHz.
-//
-// Note: 122.375 must be rounded DOWN to 12237
-// in order to be consistent with apt.dat et cetera.
-inline int kHz10(double freq)
+namespace flightgear
{
- if (freq > 1000.) return int(freq);
- return int(freq*100.0 + 0.25);
+ class CommStation;
}
-
-enum plane_type {
- UNKNOWN,
- GA_SINGLE,
- GA_HP_SINGLE,
- GA_TWIN,
- GA_JET,
- MEDIUM,
- HEAVY,
- MIL_JET
-};
-
-// PlaneRec - a structure holding ATC-centric details of planes under control
-// This might move or change eventually
-struct PlaneRec {
- PlaneRec() : type(UNKNOWN), squawkcode(0) {}
- PlaneRec(const std::string& s) : type(UNKNOWN), callsign(s), squawkcode(0) {}
- plane_type type;
- std::string callsign;
- int squawkcode;
-};
// Possible types of ATC type that the radios may be tuned to.
// INVALID implies not tuned in to anything.
APPROACH,
DEPARTURE,
ENROUTE,
- INVALID /* must be last element; see ATC_NUM_TYPES */
+ INVALID /* must be last element; see ATC_NUM_TYPES */
};
+#ifdef OLD_ATC_MGR
const int ATC_NUM_TYPES = 1 + INVALID;
// DCL - new experimental ATC data store
struct ATCData {
- ATCData() : type(INVALID), cart(0, 0, 0), freq(0), range(0) {}
+ ATCData() : type(INVALID), cart(0, 0, 0), freq(0), range(0) {}
atc_type type;
SGGeod geod;
SGVec3d cart;
// perhaps we could use an FGRunway instead of this.
// That wouldn't cache the orthopos though.
struct RunwayDetails {
- RunwayDetails() : end1ortho(0, 0, 0), end2ortho(0, 0, 0), hdg(0), length(-1), width(-1) {}
+ RunwayDetails() : end1ortho(0, 0, 0), end2ortho(0, 0, 0), hdg(0), length(-1), width(-1) {}
SGGeod threshold_pos;
SGVec3d end1ortho; // ortho projection end1 (the threshold ATM)
SGVec3d end2ortho; // ortho projection end2 (the take off end in the current hardwired scheme)
};
std::ostream& operator << (std::ostream& os, atc_type atc);
+#endif
class FGATC {
- friend class FGATCMgr;
+ friend class FGATISMgr;
public:
FGATC();
// wish to use the response timer functionality.
virtual void Update(double dt);
- // Recieve a coded callback from the ATC menu system based on the user's selection
- virtual void ReceiveUserCallback(int code);
-
- // Add plane to a stack
- virtual void AddPlane(const std::string& pid);
-
- // Remove plane from stack
- virtual int RemovePlane();
-
// Indicate that this instance should output to the display if appropriate
inline void SetDisplay() { _display = true; }
// Indicate that this instance should not output to the display
inline void SetNoDisplay() { _display = false; }
+#ifdef OLD_ATC_MGR
+ // Receive a coded callback from the ATC menu system based on the user's selection
+ virtual void ReceiveUserCallback(int code);
+
// Generate the text of a message from its parameters and the current context.
virtual std::string GenText(const std::string& m, int c);
// AI traffic should check FreqClear() is true prior to transmitting.
// The user will just have to wait for a gap in dialog as in real life.
- // Return the type of ATC station that the class represents
- inline atc_type GetType() { return _type; }
- // Set the core ATC data
- void SetData(ATCData* d);
inline int get_freq() const { return freq; }
inline void set_freq(const int fq) {freq = fq;}
inline int get_range() const { return range; }
inline void set_range(const int rg) {range = rg;}
+#endif
+ // Return the type of ATC station that the class represents
+ inline atc_type GetType() { return _type; }
+
+ // Set the core ATC data
+ void SetStation(flightgear::CommStation* sta);
+
inline const std::string& get_ident() { return ident; }
inline void set_ident(const std::string& id) { ident = id; }
inline const std::string& get_name() { return name; }
inline void set_name(const std::string& nm) { name = nm; }
-
+
protected:
// Render a transmission
// Requires the sound manager refname if audio, else "".
void NoRender(const std::string& refname);
- // Transmit a message when channel becomes free of other dialog
- void Transmit(int callback_code = 0);
-
- // Transmit a message if channel becomes free within timeout (seconds). timeout of zero implies no limit
- void ConditionalTransmit(double timeout, int callback_code = 0);
-
- // Transmit regardless of other dialog on the channel eg emergency
- void ImmediateTransmit(int callback_code = 0);
-
- virtual void ProcessCallback(int code);
-
+ virtual FGATCVoice* GetVoicePointer() = 0;
+
SGGeod _geod;
SGVec3d _cart;
int freq;
- std::map<std::string,int> active_on;
-
+ flightgear::CommStation* _currentStation;
+
int range;
std::string ident; // Code of the airport its at.
std::string name; // Name transmitted in the broadcast.
+ std::string _currentMsg; // Current message being transmitted
-
// Rendering related stuff
bool _voice; // Flag - true if we are using voice
- bool _playing; // Indicates a message in progress
- bool _voiceOK; // Flag - true if at least one voice has loaded OK
+ bool _playing; // Indicates a message in progress
FGATCVoice* _vPtr;
SGSharedPtr<SGSampleGroup> _sgr; // default sample group;
-
+#ifdef OLD_ATC_MGR
bool freqClear; // Flag to indicate if the frequency is clear of ongoing dialog
bool receiving; // Flag to indicate we are receiving a transmission
bool responseReqd; // Flag to indicate we should be responding to a request/report
double _releaseTime;
double _releaseCounter;
- atc_type _type;
+ std::string pending_transmission; // derived classes set this string before calling Transmit(...)
+#endif
+ atc_type _type;
bool _display; // Flag to indicate whether we should be outputting to the ATC display.
- std::string pending_transmission; // derived classes set this string before calling Transmit(...)
-
+
private:
+
+#ifdef OLD_ATC_MGR
// Transmission timing stuff.
double _timeout;
bool _pending;
-
- int _callback_code; // A callback code to be notified and processed by the derived classes
- // A value of zero indicates no callback required
bool _transmit; // we are to transmit
bool _transmitting; // we are transmitting
double _counter;
double _max_count;
+#endif
- SGPropertyNode_ptr _volume;
+ SGPropertyNode_ptr _masterVolume;
SGPropertyNode_ptr _enabled;
SGPropertyNode_ptr _atc_external;
SGPropertyNode_ptr _internal;
};
+#ifdef OLD_ATC_MGR
std::istream& operator>> ( std::istream& fin, ATCData& a );
+#endif
#endif // _FG_ATC_HXX