-
Notifications
You must be signed in to change notification settings - Fork 1
/
configfile.h
47 lines (38 loc) · 1.09 KB
/
configfile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CONFIGFILE_H
#define CONFIGFILE_H
#include "MtbModules.h"
#include <QObject>
#include <QTimer>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QFile>
#include <QDebug>
#include <QList>
class configfile : public QObject
{
Q_OBJECT
public:
explicit configfile(QObject *parent = nullptr);
void loadfromfile(QString filename);
void savetofile(QString filename);
void parseOneConfig(int pos, QJsonObject jsonConf);
bool isModuleInConfig(uint8_t addr);
void setServoOuts(int module, int servo, int state);
QList<TMtbModuleState> modules;
int findPosByAddress(int addr);
void setModuleName(int module, QString newname);
void setModuleType(int module, int type);
void setModuleAddress(int oldAddress, int newAddress);
private:
QJsonDocument doc;
int id;
//TMtbModuleTypes mtbModuleTypes;
void sendJson(QJsonObject json);
int limit(int val, int min, int max);
float limit(float val, float min, float max);
signals:
void moduleListChanged();
void moduleChanged(int pos);
};
#endif // CONFIGFILE_H