Changeset 4076 for trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc
- Timestamp:
- 05/15/04 16:46:27 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc
r2615 r4076 2 2 3 3 #include <iostream> 4 5 #include "MString.h" 4 6 5 7 using namespace std; … … 53 55 } 54 56 55 cout << "Zd/Az: " << zd << "/" << az << " ";56 cout << "Ra/Dec: " << ra << "/" << dec << " ";57 cout << "Temp: " << temp << "'C ";58 cout << "Hum: " << hum << "% ";59 cout << "SolRad: " << solar << "W/m² ";60 cout << "Wind: " << wind << "km/h" << endl;61 62 57 fHumidity = hum; 63 58 fTemperature = temp; 64 59 fSolarRadiation = solar; 65 60 fWindSpeed = wind; 61 62 cout << "Zd/Az: " << zd << "/" << az << " "; 63 cout << "Ra/Dec: " << ra/15 << "h/" << dec << " "; 64 cout << "SolRad: " << solar << "W/m²" << endl; 66 65 67 66 fComStat = kCmdReceived; … … 86 85 } 87 86 88 bool MCeCoCom::Send(const char * str)87 bool MCeCoCom::Send(const char *cmd, const char *str) 89 88 { 90 89 MTime t; … … 100 99 fT.GetTime(h2, m2, s2, ms2); 101 100 102 const char *msg =103 Form("%s "101 MString msg; 102 msg.Print("%s " 104 103 "%02d %04d %02d %02d %02d %02d %02d %03d " 105 104 "%02d %04d %02d %02d %02d %02d %02d %03d " 106 "%s\n", (const char*)fCommand,105 "%s\n", cmd, 107 106 fStatus, y1, mon1, d1, h1, m1, s1, ms1, 108 107 fComStat, y2, mon2, d2, h2, m2, s2, ms2, … … 113 112 return rc; 114 113 } 114 115 TString MCeCoCom::GetWeather() const 116 { 117 if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11) 118 return ""; 119 120 MString str; 121 return str.Print("Temp: %.1f'C Hum: %.1f%% Wind: %.1fkm/h", 122 fTemperature, fHumidity, fWindSpeed); 123 } 124 125 Int_t MCeCoCom::GetWeatherStatus() const 126 { 127 if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11) 128 return 0; 129 130 Int_t rc = 0; 131 if (fHumidity>80) 132 rc++; 133 if (fWindSpeed>20) 134 rc++; 135 if (fWindSpeed>30) 136 rc++; 137 if (fWindSpeed>50) 138 rc++; 139 140 return rc; 141 }
Note:
See TracChangeset
for help on using the changeset viewer.