Skip to content

Instantly share code, notes, and snippets.

@ZeronSix
Created July 12, 2017 14:18
Show Gist options
  • Save ZeronSix/c703e673358d33e35b486d3d282a92b0 to your computer and use it in GitHub Desktop.
Save ZeronSix/c703e673358d33e35b486d3d282a92b0 to your computer and use it in GitHub Desktop.
//
// Created by zeronsix on 7/12/17.
//
#ifndef GREENHOUSE_GUI_ConfigMgr_H
#define GREENHOUSE_GUI_ConfigMgr_H
#include <string>
namespace gh {
enum OperationMode
{
OPMODE_MANUAL,
OPMODE_AUTO_TIME,
OPMODE_AUTO_SENSOR
};
namespace gui {
class ConfigMgr {
public:
ConfigMgr();
// connection
bool connected;
// watering
OperationMode watering_mode;
bool manual_watering_on;
int watering_frequency;
int watering_sensor_period;
double min_humidity;
double max_humidity;
// lighting
OperationMode lighting_mode;
bool manual_lighting_on;
int lighting_sensor_period;
int lighting_day;
double min_luminocity;
double max_luminocity;
void load_from_file();
void update();
private:
std::string filename;
};
}
}
#endif //GREENHOUSE_GUI_ConfigMgr_H
//
// Created by zeronsix on 7/12/17.
//
#ifndef GREENHOUSE_GUI_DEVICEMGR_H
#define GREENHOUSE_GUI_DEVICEMGR_H
#include <string>
#include <map>
#include <vector>
namespace gh {
namespace gui {
struct Sensor {
std::string name;
std::map<std::string, double> data;
};
struct Device {
std::string id;
int battery;
bool connection;
std::string last_connect_date;
std::vector<Sensor> sensors;
};
class DeviceMgr {
public:
std::vector<Device> devices;
void parseFromFile(std::string filename);
void parseToFile(std::string filename);
};
}
}
#endif //GREENHOUSE_GUI_DEVICEMGR_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment