Vergil Cola
/
MQTTGateway2
Fork of my original MQTTGateway
Embed:
(wiki syntax)
Show/hide line numbers
Sensor.h
00001 #ifndef _SENSOR_H_ 00002 #define _SENSOR_H_ 00003 00004 00005 #include <stdio.h> 00006 #include <stdint.h> 00007 #include <string> 00008 #include "Utils.h" 00009 00010 // Keep SensorData a POD type 00011 typedef struct _SensorData 00012 { 00013 uint64_t deviceaddr; 00014 00015 uint16_t humidity; 00016 float temperature; 00017 uint16_t luminance; 00018 // Relay value (negative logic) 00019 // true = off 00020 // false = on 00021 bool sprinkler; 00022 00023 00024 void debug() 00025 { 00026 printf("Channel id (lo): [%lX]\r\n", UINT64_HI32(deviceaddr)); 00027 printf("Channel id (hi): [%lX]\r\n", UINT64_LO32(deviceaddr)); 00028 printf("Humidity : [%d]\r\n", humidity); 00029 printf("Temperature : [%.2f]\r\n", temperature); 00030 printf("Luminance : [%d]\r\n", luminance); 00031 } 00032 } SensorData; 00033 00034 typedef struct _SensorInfo 00035 { 00036 int id; 00037 std::string name; 00038 } SensorInfo; 00039 00040 00041 #endif
Generated on Tue Jul 12 2022 18:06:46 by 1.7.2