| 1 | /* |
| 2 | * SPDX-License-Identifier: CC0-1.0 |
| 3 | * |
| 4 | * dme.hxx - distance-measuring equipment. |
| 5 | * Written by David Megginson, started 2003. |
| 6 | * |
| 7 | * This file is in the Public Domain and comes with no warranty. |
| 8 | */ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #include <Instrumentation/AbstractInstrument.hxx> |
| 13 | |
| 14 | // forward decls |
| 15 | class FGNavRecord; |
| 16 | |
| 17 | /** |
| 18 | * Model a DME radio. |
| 19 | * |
| 20 | * Input properties: |
| 21 | * |
| 22 | * /position/longitude-deg |
| 23 | * /position/latitude-deg |
| 24 | * /position/altitude-ft |
| 25 | * /systems/electrical/outputs/dme |
| 26 | * /instrumentation/"name"/serviceable |
| 27 | * /instrumentation/"name"/frequencies/source |
| 28 | * /instrumentation/"name"/frequencies/selected-mhz |
| 29 | * |
| 30 | * Output properties: |
| 31 | * |
| 32 | * /instrumentation/"name"/in-range |
| 33 | * /instrumentation/"name"/indicated-distance-nm |
| 34 | * /instrumentation/"name"/indicated-ground-speed-kt |
| 35 | * /instrumentation/"name"/indicated-time-kt |
| 36 | */ |
| 37 | class DME : public AbstractInstrument |
| 38 | { |
| 39 | public: |
| 40 | DME ( SGPropertyNode *node ); |
| 41 | virtual ~DME (); |
| 42 | |
| 43 | // Subsystem API. |
| 44 | void init() override; |
| 45 | void reinit() override; |
| 46 | void update(double delta_time_sec) override; |
| 47 | |
| 48 | // Subsystem identification. |
| 49 | static const char* staticSubsystemClassId() { return "dme"; } |
| 50 | |
| 51 | private: |
| 52 | void clear(); |
| 53 | |
| 54 | SGPropertyNode_ptr _source_node; |
| 55 | SGPropertyNode_ptr _frequency_node; |
| 56 | |
| 57 | SGPropertyNode_ptr _in_range_node; |
| 58 | SGPropertyNode_ptr _distance_node; |
| 59 | SGPropertyNode_ptr _speed_node; |
| 60 | SGPropertyNode_ptr _time_node; |
| 61 | SGPropertyNode_ptr _ident_btn_node; |
| 62 | SGPropertyNode_ptr _volume_node; |
| 63 | |
| 64 | SGPropertyNode_ptr _distance_string; |
| 65 | SGPropertyNode_ptr _speed_string; |
| 66 | SGPropertyNode_ptr _time_string; |
| 67 | |
| 68 | double _last_distance_nm; |
| 69 | double _last_frequency_mhz; |
| 70 | double _time_before_search_sec; |
| 71 | |
| 72 | FGNavRecord * _navrecord; |
| 73 | |
| 74 | class AudioIdent * _audioIdent; |
| 75 | }; |