teste de publish
devices.h
- Committer:
- brunofgc
- Date:
- 2017-03-30
- Revision:
- 1:3f9e5b86d9e4
- Parent:
- 0:8c59a494a451
- Child:
- 2:ca3723da6668
File content as of revision 1:3f9e5b86d9e4:
#include "mbed.h" #include "funcoesSDCard.h" #include "modbusMaster1.h" #ifndef _devices_h_ #define _devices_h_ #define maxCaractereLeLinha 40 #include <cstdlib> #define enderecoControladoraVirtual 0 enum { modBusType_float=1, modBusType_bit, modBusType_uint8_t, modBusType_uint16_t, modBusType_uint32_t, IrCommandType, PWMCommandType }; typedef struct _alarm{ uint32_t id; //Tempos de confirmação uint32_t seconds; //Var Read block uint8_t type; uint16_t addrModbusRead; uint8_t funcModbusRead; uint16_t regModbusRead; uint8_t max; //1 Max; 0 Min uint8_t value[4]; //Act block uint32_t idAct; //Maquina de estados alarme uint32_t secAlarm; bool alarmFound; }alarm; typedef struct _reading{ uint8_t type; uint8_t addr; uint8_t func; uint16_t reg; uint8_t numRegs; }reading; typedef struct _schedule{ uint32_t id; uint8_t weekday; uint16_t minute; // Minuto do dia em que será executada a ação programada //Act block uint32_t idAct; //Maquina de estados alarme bool actSent; }schedule; class device{ private: uint8_t execActAlarm(uint32_t); public: uint8_t execAct(uint32_t); uint8_t numAlarms; uint8_t numSchedules; uint16_t numReadings; alarm *alarms; reading *readings; schedule *schedules; //uint32_t id; device(); void floatToBin(uint8_t,float *,uint8_t *); void uint32_t_ToBin(uint8_t,uint32_t *,uint8_t *); void uint16_t_ToBin(uint8_t,uint16_t *,uint8_t *); void setAlarm(char *); void setReading(char *); void setSchedule(char *); void verifyAlarms(); void verifySchedules(); void writeReadingsToSD(); }; int criaDevices(FILE *); int configuraDevices(FILE *); uint8_t resizeArray(uint32_t,uint32_t,char **,uint16_t); void testaTudoDevices(); void writeReadingsToSD(); void verifyAlarms(); void verifySchedules(); #endif