Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:f1d3878b8dd9 1 #ifndef _SENSOR_H_
vpcola 0:f1d3878b8dd9 2 #define _SENSOR_H_
vpcola 0:f1d3878b8dd9 3
vpcola 0:f1d3878b8dd9 4
vpcola 0:f1d3878b8dd9 5 #include <stdio.h>
vpcola 0:f1d3878b8dd9 6 #include <stdint.h>
vpcola 0:f1d3878b8dd9 7 #include <string>
vpcola 0:f1d3878b8dd9 8 #include "Utils.h"
vpcola 0:f1d3878b8dd9 9
vpcola 0:f1d3878b8dd9 10 // Keep SensorData a POD type
vpcola 0:f1d3878b8dd9 11 typedef struct _SensorData
vpcola 0:f1d3878b8dd9 12 {
vpcola 0:f1d3878b8dd9 13 uint64_t deviceaddr;
vpcola 0:f1d3878b8dd9 14
vpcola 0:f1d3878b8dd9 15 uint16_t humidity;
vpcola 0:f1d3878b8dd9 16 float temperature;
vpcola 0:f1d3878b8dd9 17 uint16_t luminance;
vpcola 0:f1d3878b8dd9 18 // Relay value (negative logic)
vpcola 0:f1d3878b8dd9 19 // true = off
vpcola 0:f1d3878b8dd9 20 // false = on
vpcola 0:f1d3878b8dd9 21 bool sprinkler;
vpcola 0:f1d3878b8dd9 22
vpcola 0:f1d3878b8dd9 23
vpcola 0:f1d3878b8dd9 24 void debug()
vpcola 0:f1d3878b8dd9 25 {
vpcola 0:f1d3878b8dd9 26 printf("Channel id (lo): [%lX]\r\n", UINT64_HI32(deviceaddr));
vpcola 0:f1d3878b8dd9 27 printf("Channel id (hi): [%lX]\r\n", UINT64_LO32(deviceaddr));
vpcola 0:f1d3878b8dd9 28 printf("Humidity : [%d]\r\n", humidity);
vpcola 0:f1d3878b8dd9 29 printf("Temperature : [%.2f]\r\n", temperature);
vpcola 0:f1d3878b8dd9 30 printf("Luminance : [%d]\r\n", luminance);
vpcola 0:f1d3878b8dd9 31 }
vpcola 0:f1d3878b8dd9 32 } SensorData;
vpcola 0:f1d3878b8dd9 33
vpcola 0:f1d3878b8dd9 34 typedef struct _SensorInfo
vpcola 0:f1d3878b8dd9 35 {
vpcola 0:f1d3878b8dd9 36 int id;
vpcola 0:f1d3878b8dd9 37 std::string name;
vpcola 0:f1d3878b8dd9 38 } SensorInfo;
vpcola 0:f1d3878b8dd9 39
vpcola 0:f1d3878b8dd9 40
vpcola 0:f1d3878b8dd9 41 #endif