From: adrian Date: Thu, 24 Nov 2011 15:40:37 +0000 (+0200) Subject: add function for navaid reception X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ff89b811973455e62ed9a583405b70744431fec9;p=flightgear.git add function for navaid reception --- diff --git a/src/Radio/radio.cxx b/src/Radio/radio.cxx index 260894655..0b31647c0 100644 --- a/src/Radio/radio.cxx +++ b/src/Radio/radio.cxx @@ -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, diff --git a/src/Radio/radio.hxx b/src/Radio/radio.hxx index 378cfa37b..6f37a5201 100644 --- a/src/Radio/radio.hxx +++ b/src/Radio/radio.hxx @@ -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); };