From d50aa8999d15dfe07133bdd2f17b366e3bcf9263 Mon Sep 17 00:00:00 2001
From: ThorstenB <brehmt@gmail.com>
Date: Sun, 1 Jul 2012 16:30:53 +0200
Subject: [PATCH] ADF: add "operable" property Add same property as for nav
 radio, to provide a property to cockpit models whether the ADF is active
 (serviceable/switched on/power ok/...). Useful to enable/disable displays
 (i.e. KR87).

---
 src/Instrumentation/adf.cxx | 3 +++
 src/Instrumentation/adf.hxx | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/Instrumentation/adf.cxx b/src/Instrumentation/adf.cxx
index bfde62385..5ac1c3107 100644
--- a/src/Instrumentation/adf.cxx
+++ b/src/Instrumentation/adf.cxx
@@ -104,6 +104,7 @@ ADF::init ()
     _ident_node = node->getChild("ident", 0, true);
     _ident_audible_node = node->getChild("ident-audible", 0, true);
     _power_btn_node = node->getChild("power-btn", 0, true);
+    _operable_node      = node->getChild("operable", 0, true);
 
     if (_power_btn_node->getType() == simgear::props::NONE) 
       _power_btn_node->setBoolValue(true); // front end didn't implement a power button
@@ -125,10 +126,12 @@ ADF::update (double delta_time_sec)
             || !_serviceable_node->getBoolValue()
             || !_power_btn_node->getBoolValue()     ) {
         _in_range_node->setBoolValue(false);
+        _operable_node->setBoolValue(false);
         _ident_node->setStringValue("");
         return;
     }
 
+    _operable_node->setBoolValue(true);
     string mode = _mode_node->getStringValue();
     if (mode == "ant" || mode == "test") set_bearing(delta_time_sec, 90);
     if (mode != "bfo" && mode != "adf") {
diff --git a/src/Instrumentation/adf.hxx b/src/Instrumentation/adf.hxx
index c8f36e4ff..04355b767 100644
--- a/src/Instrumentation/adf.hxx
+++ b/src/Instrumentation/adf.hxx
@@ -82,6 +82,7 @@ private:
     SGPropertyNode_ptr _ident_audible_node;
     SGPropertyNode_ptr _volume_node;
     SGPropertyNode_ptr _power_btn_node;
+    SGPropertyNode_ptr _operable_node;
 
     double _time_before_search_sec;