-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCCurrentWeatherData.py
538 lines (495 loc) · 26.8 KB
/
CCurrentWeatherData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
#!/usr/bin/python
## This driver is based is based on reverse engineering of HeavyWeather 2800 v 1.54
## All copyright goes to La Crosse Technology (c) 2008
## Python port by Eddi De Pieri <[email protected]>
## Use this software as your own risk.
## Me and La Crosse Technology is not responsable for any damage using this software
import time
import logging
import USBHardware
import CWeatherTraits
import CMinMaxMeasurement
CWeatherTraits = CWeatherTraits.CWeatherTraits()
USBHardware = USBHardware.USBHardware()
class CCurrentWeatherData(object):
def __init__(self):
self.logger = logging.getLogger('ws28xx.CCurrentWeatherData')
self._PressureRelative_hPa = CWeatherTraits.PressureNP()
self._PressureRelative_hPaMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._PressureRelative_inHg = CWeatherTraits.PressureNP()
self._PressureRelative_inHgMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._WindSpeed = CWeatherTraits.WindNP()
self._WindSpeedMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._WindDirection = 16
self._WindDirection1 = 16
self._WindDirection2 = 16
self._WindDirection3 = 16
self._WindDirection4 = 16
self._WindDirection5 = 16
self._Gust = CWeatherTraits.WindNP()
self._GustMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._GustDirection = 16
self._GustDirection1 = 16
self._GustDirection2 = 16
self._GustDirection3 = 16
self._GustDirection4 = 16
self._GustDirection5 = 16
self._Rain1H = CWeatherTraits.RainNP()
self._Rain1HMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._Rain24H = CWeatherTraits.RainNP()
self._Rain24HMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._RainLastWeek = CWeatherTraits.RainNP()
self._RainLastWeekMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._RainLastMonth = CWeatherTraits.RainNP()
self._RainLastMonthMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._RainTotal = CWeatherTraits.RainNP()
self._LastRainReset = time.time()
self._IndoorTemp = CWeatherTraits.TemperatureNP()
self._IndoorTempMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._OutdoorTemp = CWeatherTraits.TemperatureNP()
self._OutdoorTempMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._IndoorHumidity = CWeatherTraits.HumidityNP()
self._IndoorHumidityMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._OutdoorHumidity = CWeatherTraits.HumidityNP()
self._OutdoorHumidityMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._Dewpoint = CWeatherTraits.TemperatureNP()
self._DewpointMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._Windchill = CWeatherTraits.TemperatureNP()
self._WindchillMinMax = CMinMaxMeasurement.CMinMaxMeasurement()
self._WeatherState = 3
self._WeatherTendency = 3
self._AlarmRingingFlags = 0
self._AlarmMarkedFlags = 0
def CCurrentWeatherData_buf(self,buf,pos):
self.logger.debug("")
#CMinMaxMeasurement::CMinMaxMeasurement(&this->_PressureRelative_hPaMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_PressureRelative_inHgMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_WindSpeedMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_GustMinMax);
#CMeasurement::CMeasurement(&thisa->_Rain1HMax);
#CMeasurement::CMeasurement(&thisa->_Rain24HMax);
#CMeasurement::CMeasurement(&thisa->_RainLastWeekMax);
#CMeasurement::CMeasurement(&thisa->_RainLastMonthMax);
self._LastRainReset = time.time()
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_IndoorTempMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_OutdoorTempMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_IndoorHumidityMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_OutdoorHumidityMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_DewpointMinMax);
#CMinMaxMeasurement::CMinMaxMeasurement(&thisa->_WindchillMinMax);
#std::bitset<29>::bitset<29>(&thisa->_AlarmRingingFlags);
#std::bitset<29>::bitset<29>(&thisa->_AlarmMarkedFlags);
self.read(buf,pos);
def read(self,buf,pos):
self.logger.debug("")
newbuf = [0]
newbuf[0] = buf[0]
USBHardware.ReverseByteOrder(newbuf, pos + 0, 2);
#CCurrentWeatherData::readAlarmFlags(thisa, buf, &thisa->_AlarmRingingFlags);
self._WeatherState = newbuf[0][pos + 2] & 0xF;
self._WeatherTendency = (newbuf[0][pos + 2] >> 4) & 0xF;
USBHardware.ReverseByteOrder(newbuf, pos + 3, 0x12);
self._IndoorTemp = USBHardware.ToTemperature(newbuf, pos + 3, 1)
self._IndoorTempMinMax._Min._Value = USBHardware.ToTemperature(newbuf, pos + 5, 0);
if self._IndoorTempMinMax._Min._Value == CWeatherTraits.TemperatureNP():
self._IndoorTempMinMax._Min._IsError = 1
else:
self._IndoorTempMinMax._Min._IsError = 1
if self._IndoorTempMinMax._Min._Value == CWeatherTraits.TemperatureOFL():
self._IndoorTempMinMax._Min._IsOverflow = 1
else:
self._IndoorTempMinMax._Min._IsOverflow = 0
self._IndoorTempMinMax._Max._Value = USBHardware.ToTemperature(newbuf, pos + 8, 1)
if self._IndoorTempMinMax._Max._Value == CWeatherTraits.TemperatureNP():
self._IndoorTempMinMax._Max._IsError = 1
else:
self._IndoorTempMinMax._Max._IsError = 0
if self._IndoorTempMinMax._Max._Value == CWeatherTraits.TemperatureOFL():
self._IndoorTempMinMax._Max._IsOverflow = 1
else:
self._IndoorTempMinMax._Max._IsOverflow = 0
if 1 == 0:
#if ( CMinMaxMeasurement::IsMinValueError(&thisa->_IndoorTempMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_IndoorTempMinMax) ):
# ATL::COleDateTime::SetStatus(&thisa->_IndoorTempMinMax._Min._Time, partial);
pass
else:
self._IndoorTempMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 10, 0);
if 1 == 0:
#if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_IndoorTempMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_IndoorTempMinMax) ):
# ATL::COleDateTime::SetStatus(&thisa->_IndoorTempMinMax._Max._Time, partial);
pass
else:
self._IndoorTempMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 15, 0);
USBHardware.ReverseByteOrder(newbuf, pos + 21, 0x12);
self._OutdoorTemp = USBHardware.ToTemperature(newbuf, pos + 21, 1)
self._OutdoorTempMinMax._Min._Value = USBHardware.ToTemperature(newbuf, pos + 23, 0);
if self._OutdoorTempMinMax._Min._Value == CWeatherTraits.TemperatureNP():
self._OutdoorTempMinMax._Min._IsError = 1
else:
self._OutdoorTempMinMax._Min._IsError = 0
if self._OutdoorTempMinMax._Min._Value == CWeatherTraits.TemperatureOFL():
self._OutdoorTempMinMax._Min._IsOverflow = 1
else:
self._OutdoorTempMinMax._Min._IsOverflow = 0
self._OutdoorTempMinMax._Max._Value = USBHardware.ToTemperature(newbuf, pos + 26, 1)
if self._OutdoorTempMinMax._Max._Value == CWeatherTraits.TemperatureNP():
self._OutdoorTempMinMax._Max._IsError = 1
else:
self._OutdoorTempMinMax._Max._IsError = 0
if self._OutdoorTempMinMax._Max._Value == CWeatherTraits.TemperatureOFL():
self._OutdoorTempMinMax._Max._IsOverflow = 1
else:
self._OutdoorTempMinMax._Max._IsOverflow = 0
if 1 == 0:
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_OutdoorTempMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_OutdoorTempMinMax) ):
# ATL::COleDateTime::SetStatus(&thisa->_OutdoorTempMinMax._Min._Time, partial);
pass
else:
self._OutdoorTempMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 28, 0)
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_OutdoorTempMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_OutdoorTempMinMax) ):
# ATL::COleDateTime::SetStatus(&thisa->_OutdoorTempMinMax._Max._Time, partial);
pass
else:
self._OutdoorTempMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 33, 0)
USBHardware.ReverseByteOrder(newbuf, pos + 39, 0x12);
self._Windchill = USBHardware.ToTemperature(newbuf, pos + 39, 1);
self._WindchillMinMax._Min._Value = USBHardware.ToTemperature(newbuf, pos + 41, 0);
if self._WindchillMinMax._Min._Value == CWeatherTraits.TemperatureNP():
self._WindchillMinMax._Min._IsError = 1
else:
self._WindchillMinMax._Min._IsError = 0
if self._WindchillMinMax._Min._Value == CWeatherTraits.TemperatureOFL():
self._WindchillMinMax._Min._IsOverflow = 1
else:
self._WindchillMinMax._Min._IsOverflow = 0
self._WindchillMinMax._Max._Value = USBHardware.ToTemperature(newbuf, pos + 44, 1);
if self._WindchillMinMax._Max._Value == CWeatherTraits.TemperatureNP():
self._WindchillMinMax._Max._IsError = 1
else:
self._WindchillMinMax._Max._IsError = 0
if self._WindchillMinMax._Max._Value == CWeatherTraits.TemperatureOFL():
self._WindchillMinMax._Max._IsOverflow = 1
else:
self._WindchillMinMax._Max._IsOverflow = 0
if 1 == 0:
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_WindchillMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_WindchillMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_WindchillMinMax._Min._Time, partial);
pass
else:
self._WindchillMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 46, 0)
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_WindchillMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_WindchillMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_WindchillMinMax._Max._Time, partial);
pass
else:
self._WindchillMinMax._Max._Time = USBHardware.ToDateTime(newbuf,pos + 51, 0)
USBHardware.ReverseByteOrder(newbuf, pos + 57, 0x12);
self._Dewpoint = USBHardware.ToTemperature(newbuf, pos + 57, 1);
self._DewpointMinMax._Min._Value = USBHardware.ToTemperature(newbuf, pos + 59, 0);
if self._DewpointMinMax._Min._Value == CWeatherTraits.TemperatureNP():
self._DewpointMinMax._Min._IsError = 1
else:
self._DewpointMinMax._Min._IsError = 0
if self._DewpointMinMax._Min._Value == CWeatherTraits.TemperatureOFL():
self._DewpointMinMax._Min._IsOverflow = 1
else:
self._DewpointMinMax._Min._IsOverflow = 0
self._DewpointMinMax._Max._Value = USBHardware.ToTemperature(newbuf, pos + 62, 1);
if self._DewpointMinMax._Max._Value == CWeatherTraits.TemperatureNP():
self._DewpointMinMax._Max._IsError = 1
else:
self._DewpointMinMax._Max._IsError = 0
if self._DewpointMinMax._Max._Value == CWeatherTraits.TemperatureOFL():
self._DewpointMinMax._Max._IsOverflow = 1
else:
self._DewpointMinMax._Max._IsOverflow = 0
if 1 == 0:
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_DewpointMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_DewpointMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_DewpointMinMax._Min._Time, partial);
pass
else:
self._DewpointMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 64, 0);
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_DewpointMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_DewpointMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_DewpointMinMax._Max._Time, partial);
pass
else:
self._DewpointMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 69, 0)
USBHardware.ReverseByteOrder(newbuf, pos + 75, 0xD);
self._IndoorHumidity = USBHardware.ToHumidity(buf, pos + 75, 1)
self._IndoorHumidityMinMax._Min._Value = USBHardware.ToHumidity(newbuf, pos + 76, 1)
if self._IndoorHumidityMinMax._Min._Value == CWeatherTraits.HumidityNP():
self._IndoorHumidityMinMax._Min._IsError = 1
else:
self._IndoorHumidityMinMax._Min._IsError = 0
if self._IndoorHumidityMinMax._Min._Value == CWeatherTraits.HumidityOFL():
self._IndoorHumidityMinMax._Min._IsOverflow = 1
else:
self._IndoorHumidityMinMax._Min._IsOverflow = 0
self._IndoorHumidityMinMax._Max._Value = USBHardware.ToHumidity(newbuf, pos + 77, 1)
if self._IndoorHumidityMinMax._Max._Value == CWeatherTraits.HumidityNP():
self._IndoorHumidityMinMax._Max._IsError = 1
else:
self._IndoorHumidityMinMax._Max._IsError = 0
if self._IndoorHumidityMinMax._Max._Value == CWeatherTraits.HumidityOFL():
self._IndoorHumidityMinMax._Max._IsOverflow = 1
else:
self._IndoorHumidityMinMax._Max._IsOverflow = 0
if 1 == 0:
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_IndoorHumidityMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_IndoorHumidityMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_IndoorHumidityMinMax._Min._Time, partial);
pass
else:
self._IndoorHumidityMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 78, 1)
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_IndoorHumidityMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_IndoorHumidityMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_IndoorHumidityMinMax._Max._Time, partial);
pass
else:
self._IndoorHumidityMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 83, 1)
USBHardware.ReverseByteOrder(newbuf, pos + 88, 0xD);
self._OutdoorHumidity = USBHardware.ToHumidity(newbuf,pos + 88, 1)
self._OutdoorHumidityMinMax._Min._Value = USBHardware.ToHumidity(newbuf, pos + 89, 1);
if self._OutdoorHumidityMinMax._Min._Value == CWeatherTraits.HumidityNP():
self._OutdoorHumidityMinMax._Min._IsError = 1
else:
self._OutdoorHumidityMinMax._Min._IsError = 0
if self._OutdoorHumidityMinMax._Min._Value == CWeatherTraits.HumidityOFL():
self._OutdoorHumidityMinMax._Min._IsOverflow = 1
else:
self._OutdoorHumidityMinMax._Min._IsOverflow = 0
self._OutdoorHumidityMinMax._Max._Value = USBHardware.ToHumidity(newbuf, pos + 90, 1);
if self._OutdoorHumidityMinMax._Max._Value == CWeatherTraits.HumidityNP():
self._OutdoorHumidityMinMax._Max._IsError = 1
else:
self._OutdoorHumidityMinMax._Max._IsError = 0
if self._OutdoorHumidityMinMax._Max._Value == CWeatherTraits.HumidityOFL():
self._OutdoorHumidityMinMax._Max._IsOverflow = 1
else:
self._OutdoorHumidityMinMax._Max._IsOverflow = 0
if 1 == 0:
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_OutdoorHumidityMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_OutdoorHumidityMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_OutdoorHumidityMinMax._Min._Time, partial);
pass
else:
self._OutdoorHumidityMinMax._Min._Time = USBHardware.ToDateTime(newbuf, pos + 91, 1)
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_OutdoorHumidityMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_OutdoorHumidityMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_OutdoorHumidityMinMax._Max._Time, partial);
pass
else:
self._OutdoorHumidityMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 96, 1)
USBHardware.ReverseByteOrder(newbuf, pos + 101, 0xB);
#thisa->_RainLastMonth = USBHardware::To4Pre2Post(buf + 101);
#thisa->_RainLastMonthMax._Value = USBHardware::To4Pre2Post(buf + 104);
# thisa->_RainLastMonthMax._IsError = CWeatherTraits::RainNP();
# thisa->_RainLastMonthMax._IsOverflow = CWeatherTraits::RainOFL();
# if ( CMeasurement::IsError(&thisa->_RainLastMonthMax) || CMeasurement::IsOverflow(&thisa->_RainLastMonthMax) )
# ATL::COleDateTime::SetStatus(&thisa->_RainLastMonthMax._Time, partial);
# else
# v46 = USBHardware::ToDateTime((ATL::COleDateTime *)&v93, buf + 107, 1);
# v47 = (char *)&thisa->_RainLastMonthMax._Time;
# LODWORD(thisa->_RainLastMonthMax._Time.m_dt) = LODWORD(v46->m_dt);
# *((_DWORD *)v47 + 1) = HIDWORD(v46->m_dt);
# *((_DWORD *)v47 + 2) = v46->m_status;
USBHardware.ReverseByteOrder(newbuf, pos + 112, 0xB);
# v48 = USBHardware::To4Pre2Post(buf + 112);
# thisa->_RainLastWeek = v48;
# v49 = USBHardware::To4Pre2Post(buf + 115);
# thisa->_RainLastWeekMax._Value = v49;
# v80 = thisa->_RainLastWeekMax._Value == CWeatherTraits::RainNP();
# thisa->_RainLastWeekMax._IsError = v80;
# v80 = thisa->_RainLastWeekMax._Value == CWeatherTraits::RainOFL();
# thisa->_RainLastWeekMax._IsOverflow = v80;
# if ( CMeasurement::IsError(&thisa->_RainLastWeekMax) || CMeasurement::IsOverflow(&thisa->_RainLastWeekMax) )
# ATL::COleDateTime::SetStatus(&thisa->_RainLastWeekMax._Time, partial);
# else
# v50 = USBHardware::ToDateTime((ATL::COleDateTime *)&v94, buf + 118, 1);
# v51 = (char *)&thisa->_RainLastWeekMax._Time;
# LODWORD(thisa->_RainLastWeekMax._Time.m_dt) = LODWORD(v50->m_dt);
# *((_DWORD *)v51 + 1) = HIDWORD(v50->m_dt);
# *((_DWORD *)v51 + 2) = v50->m_status;
# }
USBHardware.ReverseByteOrder(newbuf, pos + 123, 0xB)
# thisa->_Rain24H = USBHardware::To4Pre2Post(buf + 123);
# v53 = USBHardware::To4Pre2Post(buf + 126);
# thisa->_Rain24HMax._Value = v53;
# v80 = thisa->_Rain24HMax._Value == CWeatherTraits::RainNP();
# thisa->_Rain24HMax._IsError = v80;
# v80 = thisa->_Rain24HMax._Value == CWeatherTraits::RainOFL();
# thisa->_Rain24HMax._IsOverflow = v80;
# if ( CMeasurement::IsError(&thisa->_Rain24HMax) || CMeasurement::IsOverflow(&thisa->_Rain24HMax) )
# ATL::COleDateTime::SetStatus(&thisa->_Rain24HMax._Time, partial);
# else
# v54 = USBHardware::ToDateTime((ATL::COleDateTime *)&v95, buf + 129, 1);
# v55 = (char *)&thisa->_Rain24HMax._Time;
# LODWORD(thisa->_Rain24HMax._Time.m_dt) = LODWORD(v54->m_dt);
# *((_DWORD *)v55 + 1) = HIDWORD(v54->m_dt);
# *((_DWORD *)v55 + 2) = v54->m_status;
# }
USBHardware.ReverseByteOrder(newbuf, pos + 134, 0xB);
self._Rain1H = USBHardware.To4Pre2Post(newbuf,pos + 134);
self._Rain1HMax._Value = USBHardware.To4Pre2Post(newbuf,pos + 137);
# v80 = thisa->_Rain1HMax._Value == CWeatherTraits::RainNP();
# thisa->_Rain1HMax._IsError = v80;
# v80 = thisa->_Rain1HMax._Value == CWeatherTraits::RainOFL();
# thisa->_Rain1HMax._IsOverflow = v80;
# if ( CMeasurement::IsError(&thisa->_Rain1HMax) || CMeasurement::IsOverflow(&thisa->_Rain1HMax) )
# ATL::COleDateTime::SetStatus(&thisa->_Rain1HMax._Time, partial);
# else
# v58 = USBHardware::ToDateTime((ATL::COleDateTime *)&v96, buf + 140, 1);
# v59 = (char *)&thisa->_Rain1HMax._Time;
# LODWORD(thisa->_Rain1HMax._Time.m_dt) = LODWORD(v58->m_dt);
# *((_DWORD *)v59 + 1) = HIDWORD(v58->m_dt);
# *((_DWORD *)v59 + 2) = v58->m_status;
USBHardware.ReverseByteOrder(newbuf, pos + 145, 9);
self._RainTotal = USBHardware.To4Pre3Post(newbuf, pos + 145);
# v61 = USBHardware::ToDateTime((ATL::COleDateTime *)&v97, buf + 148, 0);
# v62 = (char *)&thisa->_LastRainReset;
# LODWORD(thisa->_LastRainReset.m_dt) = LODWORD(v61->m_dt);
# *((_DWORD *)v62 + 1) = HIDWORD(v61->m_dt);
# *((_DWORD *)v62 + 2) = v61->m_status;
USBHardware.ReverseByteOrder(newbuf, pos + 154, 0xF);
self._WindSpeed = USBHardware.ToWindspeed(newbuf,pos + 154);
self._WindSpeedMinMax._Max._Value = USBHardware.ToWindspeed(newbuf, pos + 157);
# v80 = thisa->_WindSpeedMinMax._Min._Value == CWeatherTraits::WindNP();
# thisa->_WindSpeedMinMax._Max._IsError = v80;
# v80 = thisa->_WindSpeedMinMax._Min._Value == CWeatherTraits::WindOFL();
# thisa->_WindSpeedMinMax._Max._IsOverflow = v80;
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_WindSpeedMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_WindSpeedMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_WindSpeedMinMax._Max._Time, partial);
pass
else:
self._WindSpeedMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 160, 1)
# WindErrFlags = buf[165];
(w ,w1) = USBHardware.ReadWindDirectionShared(newbuf, pos + 166)
(w2,w3) = USBHardware.ReadWindDirectionShared(newbuf, pos + 167)
(w4,w5) = USBHardware.ReadWindDirectionShared(newbuf, pos + 168)
self._WindDirection = w;
self._WindDirection1 = w1;
self._WindDirection2 = w2;
self._WindDirection3 = w3;
self._WindDirection4 = w4;
self._WindDirection5 = w5;
# CCurrentWeatherData::CheckWindErrFlags(
# thisa,
# WindErrFlags,
# &thisa->_WindSpeed,
# &thisa->_WindSpeedMinMax,
# &thisa->_WindDirection,
# &thisa->_WindDirection1,
# &thisa->_WindDirection2,
# &thisa->_WindDirection3,
# &thisa->_WindDirection4,
# &thisa->_WindDirection5);
USBHardware.ReverseByteOrder(newbuf, pos + 169, 0xF)
self._Gust = USBHardware.ToWindspeed(newbuf, pos + 169)
self._GustMinMax._Max._Value = USBHardware.ToWindspeed(newbuf, pos + 172)
# v80 = thisa->_GustMinMax._Min._Value == CWeatherTraits::WindNP();
# thisa->_GustMinMax._Max._IsError = v80;
# v80 = thisa->_GustMinMax._Min._Value == CWeatherTraits::WindOFL();
# thisa->_GustMinMax._Max._IsOverflow = v80;
if 1 == 0:
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_GustMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_GustMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_GustMinMax._Max._Time, partial);
pass
else:
self._GustMinMax._Max._Time = USBHardware.ToDateTime(newbuf, pos + 175, 1)
GustErrFlags = newbuf[0][180];
(g ,g1) = USBHardware.ReadWindDirectionShared(newbuf, pos + 181)
(g2,g3) = USBHardware.ReadWindDirectionShared(newbuf, pos + 182)
(g4,g5) = USBHardware.ReadWindDirectionShared(newbuf, pos + 183)
self._GustDirection = g;
self._GustDirection1 = g1;
self._GustDirection2 = g2;
self._GustDirection3 = g3;
self._GustDirection4 = g4;
self._GustDirection5 = g5;
# CCurrentWeatherData::CheckWindErrFlags(
# thisa,
# GustErrFlags,
# &thisa->_Gust,
# &thisa->_GustMinMax,
# &thisa->_GustDirection,
# &thisa->_GustDirection1,
# &thisa->_GustDirection2,
# &thisa->_GustDirection3,
# &thisa->_GustDirection4,
# &thisa->_GustDirection5);
USBHardware.ReverseByteOrder(newbuf, pos + 184, 0x19)
(self._PressureRelative_hPa, self._PressureRelative_inHg) = USBHardware.ReadPressureShared(newbuf, pos + 184)
(self._PressureRelative_hPaMinMax._Min._Value,self._PressureRelative_inHgMinMax._Min._Value) = USBHardware.ReadPressureShared(newbuf, pos + 189)
(self._PressureRelative_hPaMinMax._Max._Value,self._PressureRelative_inHgMinMax._Max._Value) = USBHardware.ReadPressureShared(newbuf, pos + 194)
# thisa->_PressureRelative_hPaMinMax._Min._Value = CWeatherTraits::PressureOFL();
# thisa->_PressureRelative_hPaMinMax._Min._IsError = 1;
# thisa->_PressureRelative_hPaMinMax._Min._IsOverflow = 1;
# thisa->_PressureRelative_hPaMinMax._Max._Value = CWeatherTraits::PressureOFL();
# thisa->_PressureRelative_hPaMinMax._Max._IsError = 1;
# thisa->_PressureRelative_hPaMinMax._Max._IsOverflow = 1;
# if ( CMinMaxMeasurement::IsMinValueError(&thisa->_PressureRelative_hPaMinMax)
# || CMinMaxMeasurement::IsMinValueOverflow(&thisa->_PressureRelative_hPaMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_PressureRelative_hPaMinMax._Min._Time, partial);
# ATL::COleDateTime::SetStatus(&thisa->_PressureRelative_inHgMinMax._Min._Time, partial);
# else
# v71 = USBHardware::ToDateTime((ATL::COleDateTime *)&v100, buf + 199, 1);
# v72 = (char *)&thisa->_PressureRelative_hPaMinMax._Min._Time;
# LODWORD(thisa->_PressureRelative_hPaMinMax._Min._Time.m_dt) = LODWORD(v71->m_dt);
# *((_DWORD *)v72 + 1) = HIDWORD(v71->m_dt);
# *((_DWORD *)v72 + 2) = v71->m_status;
# v73 = (char *)&thisa->_PressureRelative_hPaMinMax._Min._Time;
# v74 = (char *)&thisa->_PressureRelative_inHgMinMax._Min._Time;
# LODWORD(thisa->_PressureRelative_inHgMinMax._Min._Time.m_dt) = LODWORD(thisa->_PressureRelative_hPaMinMax._Min._Time.m_dt);
# *((_DWORD *)v74 + 1) = *((_DWORD *)v73 + 1);
# *((_DWORD *)v74 + 2) = *((_DWORD *)v73 + 2);
# if ( CMinMaxMeasurement::IsMaxValueError(&thisa->_PressureRelative_hPaMinMax)
# || CMinMaxMeasurement::IsMaxValueOverflow(&thisa->_PressureRelative_hPaMinMax) )
# ATL::COleDateTime::SetStatus(&thisa->_PressureRelative_hPaMinMax._Max._Time, partial);
# ATL::COleDateTime::SetStatus(&thisa->_PressureRelative_inHgMinMax._Max._Time, partial);
# else
# v75 = USBHardware::ToDateTime((ATL::COleDateTime *)&v101, buf + 204, 1);
# v76 = (char *)&thisa->_PressureRelative_hPaMinMax._Max._Time;
# LODWORD(thisa->_PressureRelative_hPaMinMax._Max._Time.m_dt) = LODWORD(v75->m_dt);
# *((_DWORD *)v76 + 1) = HIDWORD(v75->m_dt);
# *((_DWORD *)v76 + 2) = v75->m_status;
# v77 = (char *)&thisa->_PressureRelative_hPaMinMax._Max._Time;
# v78 = (char *)&thisa->_PressureRelative_inHgMinMax._Max._Time;
# LODWORD(thisa->_PressureRelative_inHgMinMax._Max._Time.m_dt) = LODWORD(thisa->_PressureRelative_hPaMinMax._Max._Time.m_dt);
# *((_DWORD *)v78 + 1) = *((_DWORD *)v77 + 1);
# *((_DWORD *)v78 + 2) = *((_DWORD *)v77 + 2);
# thisa->_PressureRelative_inHgMinMax._Min._Value = CWeatherTraits::PressureOFL();
# thisa->_PressureRelative_inHgMinMax._Min._IsError = 1;
# thisa->_PressureRelative_inHgMinMax._Min._IsOverflow = 1;
# thisa->_PressureRelative_inHgMinMax._Max._Value = CWeatherTraits::PressureOFL();
# thisa->_PressureRelative_inHgMinMax._Max._IsError = 1;
# thisa->_PressureRelative_inHgMinMax._Max._IsOverflow = 1;
# std::bitset<29>::bitset<29>((std::bitset<29> *)&v102, 0);
# thisa->_AlarmMarkedFlags._Array[0] = v102;
self.logger.info("_WeatherState=%s _WeatherTendency=%s" % ( CWeatherTraits.forecastMap[self._WeatherState], CWeatherTraits.trends[self._WeatherTendency]))
self.logger.info("_IndoorTemp= %7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._IndoorTemp, self._IndoorTempMinMax._Min._Value, self._IndoorTempMinMax._Min._Time, self._IndoorTempMinMax._Max._Value, self._IndoorTempMinMax._Max._Time))
self.logger.info("_IndoorHumidity= %7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._IndoorHumidity, self._IndoorHumidityMinMax._Min._Value, self._IndoorHumidityMinMax._Min._Time, self._IndoorHumidityMinMax._Max._Value, self._IndoorHumidityMinMax._Max._Time))
self.logger.info("_OutdoorTemp= %7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._OutdoorTemp, self._OutdoorTempMinMax._Min._Value, self._OutdoorTempMinMax._Min._Time, self._OutdoorTempMinMax._Max._Value, self._OutdoorTempMinMax._Max._Time))
self.logger.info("_OutdoorHumidity=%7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._OutdoorHumidity, self._OutdoorHumidityMinMax._Min._Value, self._OutdoorHumidityMinMax._Min._Time, self._OutdoorHumidityMinMax._Max._Value, self._OutdoorHumidityMinMax._Max._Time))
self.logger.info("_Windchill= %7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._Windchill, self._WindchillMinMax._Min._Value, self._WindchillMinMax._Min._Time, self._WindchillMinMax._Max._Value, self._WindchillMinMax._Max._Time))
self.logger.info("_Dewpoint= %7.2f _Min=%7.2f(%s) _Max=%7.2f(%s)" % (self._Dewpoint, self._DewpointMinMax._Min._Value, self._DewpointMinMax._Min._Time, self._DewpointMinMax._Max._Value, self._DewpointMinMax._Max._Time))
self.logger.info("_WindSpeed= %7.2f _Max=%7.2f(%s)" % (self._WindSpeed * 3.6, self._WindSpeedMinMax._Max._Value * 3.6, self._WindSpeedMinMax._Max._Time))
self.logger.info("_Gust= %7.2f _Max=%7.2f(%s)" % (self._Gust * 3.6, self._GustMinMax._Max._Value * 3.6, self._GustMinMax._Max._Time))
self.logger.info("_PressureRelative_hPa=%8.2f" % self._PressureRelative_hPa)
self.logger.info("_PressureRelative_inHg=%7.2f" % self._PressureRelative_inHg)
self.logger.info("_Rain1H=%8.2f" % self._Rain1H)
self.logger.info("_Rain1HMax._Value=%8.2f" % self._Rain1HMax._Value)