]> git.mxchange.org Git - flightgear.git/commitdiff
add function for navaid reception
authoradrian <adrian@localhost.com>
Thu, 24 Nov 2011 15:40:37 +0000 (17:40 +0200)
committeradrian <adrian@localhost.com>
Thu, 24 Nov 2011 15:40:37 +0000 (17:40 +0200)
src/Radio/radio.cxx
src/Radio/radio.hxx

index 260894655729249c6bef29b24e455f686107afdc..0b31647c056ffaa37acf36b5467d5f0949d9740f 100644 (file)
@@ -82,6 +82,22 @@ void FGRadio::receiveChat(SGGeod tx_pos, double freq, string text,
 
 }
 
+/*** TODO: receive navaid 
+***/
+double FGRadio::receiveNav(SGGeod tx_pos, double freq, int transmission_type) {
+       
+       // need to implement transmitter power
+       if ( _propagation_model == 1) {
+               return LOS_calculate_attenuation(tx_pos, freq, 1);
+       }
+       else if ( _propagation_model == 2) {
+               return ITM_calculate_attenuation(tx_pos, freq, 1);
+       }
+       
+       return -1;
+
+}
+
 /*** Receive ATC radio communication as text
 ***/
 void FGRadio::receiveATC(SGGeod tx_pos, double freq, string text,
index 378cfa37b71d600c25706a4d6e9ffcdf1c777cfa..6f37a520100899a3264aa34c97e68f15ccac7712 100644 (file)
@@ -57,10 +57,13 @@ public:
     void setFrequency(double freq, int radio);
     double getFrequency(int radio);
     void setTxPower(double txpower) { _transmitter_power = txpower; };
+    void setPropagationModel(int model) { _propagation_model = model; };
     // transmission_type: 0 for air to ground 1 for ground to air, 2 for air to air, 3 for pilot to ground, 4 for pilot to air
     void receiveATC(SGGeod tx_pos, double freq, string text, int transmission_type);
     void receiveChat(SGGeod tx_pos, double freq, string text, int transmission_type);
-    void setPropagationModel(int model) { _propagation_model = model; };
+    // returns signal quality
+    // transmission_type: 0 for VOR, 1 for ILS
+    double receiveNav(SGGeod tx_pos, double freq, int transmission_type);
     
 };