Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

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