1 // ---------------------------------------------------------------------------- 2 // Copyright (C) 2019 3 // David Freese, W1HKJ 4 // 5 // This file is part of fldigi 6 // 7 // fldigi is free software; you can redistribute it and/or modify 8 // it under the terms of the GNU General Public License as published by 9 // the Free Software Foundation; either version 3 of the License, or 10 // (at your option) any later version. 11 // 12 // fldigi is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 // You should have received a copy of the GNU General Public License 18 // along with this program. If not, see <http://www.gnu.org/licenses/>. 19 // ---------------------------------------------------------------------------- 20 21 #ifndef METAR_H 22 #define METAR_H 23 24 #include "network.h" 25 26 class Metar { 27 Url url; 28 std::string _wx_text_full; 29 std::string _wx_text_parsed; 30 std::string _metar_station; 31 std::string _metar_text; 32 std::string _station_name; 33 34 std::string _field; 35 std::string _conditions; 36 std::string _temp; 37 std::string _winds; 38 std::string _baro; 39 40 bool _inches; 41 bool _mbars; 42 bool _fahrenheit; 43 bool _celsius; 44 bool _mph; 45 bool _kph; 46 bool _condx; 47 bool _name; 48 49 bool _debug; 50 public: Metar()51 Metar() { init(); } Metar(std::string _station)52 Metar(std::string _station) { 53 init(); 54 _metar_station = _station; 55 } ~Metar()56 ~Metar() {} 57 init()58 void init() { 59 _metar_station.clear(); 60 _metar_text.clear(); 61 _wx_text_full.clear(); 62 _wx_text_parsed.clear(); 63 _station_name.clear(); 64 65 _field.clear(); 66 _conditions.clear(); 67 _temp.clear(); 68 _winds.clear(); 69 _baro.clear(); 70 71 _inches = _mbars = 72 _fahrenheit = _celsius = 73 _mph = _kph = 74 _condx = _name = true; 75 76 _debug = false; 77 } 78 79 void parse(); 80 int get(); get(std::string station)81 int get(std::string station) { 82 _metar_station = station; 83 return get(); 84 } 85 station(std::string s)86 void station(std::string s) { _metar_station = s; } station()87 std::string station() { return _metar_station; } 88 station_name()89 std::string station_name() { return _station_name; } 90 full()91 std::string full() { return _wx_text_full; } parsed()92 std::string parsed() { return _wx_text_parsed; } 93 params(bool inches,bool mbars,bool fahrenheit,bool celsius,bool mph,bool kph,bool condx,bool name)94 void params( bool inches, bool mbars, 95 bool fahrenheit, bool celsius, 96 bool mph, bool kph, 97 bool condx, bool name) 98 { 99 _inches = inches; 100 _mbars = mbars; 101 _fahrenheit= fahrenheit; 102 _celsius = celsius; 103 _mph = mph; 104 _kph = kph; 105 _condx = condx; 106 _name = name; 107 } inches(bool b)108 void inches(bool b) { _inches = b; } inches()109 bool inches() { return _inches; } 110 mbars(bool b)111 void mbars(bool b) { _mbars = b; } mbars()112 bool mbars() { return _mbars; } 113 fahrenheit(bool b)114 void fahrenheit(bool b) { _fahrenheit = b; } fahrenheit()115 bool fahrenheit() { return _fahrenheit; } 116 celsius(bool b)117 void celsius(bool b) { _celsius = b; } celsius()118 bool celsius() { return _celsius; } 119 mph(bool b)120 void mph(bool b) { _mph = b; } mph()121 bool mph() { return _mph; } 122 kph(bool b)123 void kph(bool b) { _kph = b; } kph()124 bool kph() { return _kph; } 125 condx(bool b)126 void condx(bool b) { _condx = b; } condx()127 bool condx() { return _condx; } 128 name(bool b)129 void name(bool b) { _name = b; } name()130 bool name() { return _name; } 131 debug(bool on)132 void debug(bool on) { };//_debug = on; url.debug(on); } 133 }; 134 135 #endif //METAR_H 136 137