]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/transponder.hxx
Support for multiple data dirs.
[flightgear.git] / src / Instrumentation / transponder.hxx
index 88a9dedec19cbe1d1e8a51ba97a4e8e013b95d0e..5ca5204c0e55671a4a42b469eb22ec7317136380 100644 (file)
@@ -3,6 +3,7 @@
 // Written by Roy Vegard Ovesen, started September 2004.
 //
 // Copyright (C) 2004  Roy Vegard Ovesen - rvovesen@tiscali.no
+// Copyright (C) 2013  Clement de l'Hamaide - clemaez@hotmail.fr
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -16,7 +17,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifndef TRANSPONDER_HXX
 #define TRANSPONDER_HXX 1
 #include <Main/fg_props.hxx>
 
 #include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
 
-
-class Transponder : public SGSubsystem
+class Transponder : public SGSubsystem, public SGPropertyChangeListener
 {
 public:
     Transponder(SGPropertyNode *node);
-    ~Transponder();
-
-    void init ();
-    void update (double dt);
+    virtual ~Transponder();
 
+    virtual void init ();
+    virtual void update (double dt);
+    virtual void bind();
+    virtual void unbind();
+    
 private:
+    enum Mode
+    {
+        MODE_A = 0,
+        MODE_C,
+        MODE_S
+    };
+    
+    enum KnobPosition
+    {
+        KNOB_OFF = 0,
+        KNOB_STANDBY,
+        KNOB_TEST,
+        KNOB_GROUND,
+        KNOB_ON,
+        KNOB_ALT
+    };
+    
+    // annunciators, for KT-70 compatability only
+    // these should be replaced with conditionals in the instrument
+    bool getFLAnnunciator() const;
+    bool getAltAnnunciator() const;
+    bool getGroundAnnuciator() const;
+    bool getOnAnnunciator() const;
+    bool getStandbyAnnunciator() const;
+    bool getReplyAnnunciator() const;
+    
     // Inputs
-    SGPropertyNode_ptr pressureAltitudeNode;
-    SGPropertyNode_ptr busPowerNode;
-    SGPropertyNode_ptr serviceableNode;
+    SGPropertyNode_ptr _pressureAltitude_node;
+    SGPropertyNode_ptr _busPower_node;
+    SGPropertyNode_ptr _serviceable_node;
 
+    SGPropertyNode_ptr _mode_node;
+    SGPropertyNode_ptr _knob_node;
+    SGPropertyNode_ptr _idCode_node;
+    SGPropertyNode_ptr _digit_node[4];
+    
+    simgear::TiedPropertyList _tiedProperties;
+    
+    SGPropertyNode_ptr _identBtn_node;
+    bool _identMode;
+    bool _kt70Compat;
+    
     // Outputs
-    SGPropertyNode_ptr idCodeNode;
-    SGPropertyNode_ptr flightLevelNode;
+    SGPropertyNode_ptr _altitude_node;
+    SGPropertyNode_ptr _altitudeValid_node;
+    SGPropertyNode_ptr _transmittedId_node;
+    SGPropertyNode_ptr _ident_node;
 
     // Internal
-    string name;
-    int num;
-    string encoder;
+    std::string _name;
+    int _num;
+    Mode _mode;
+    KnobPosition _knob;
+    double _identTime;
+    int _listener_active;
+    double _requiredBusVolts;
+    std::string _altitudeSourcePath;
+    
+    void valueChanged (SGPropertyNode *);
+    int setMinMax(int val);
+    bool has_power() const;
 };
 
 #endif // TRANSPONDER_HXX