-
Notifications
You must be signed in to change notification settings - Fork 17
/
app.cpp
22 lines (21 loc) · 970 Bytes
/
app.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <veutil/qt/ve_qitem.hpp>
#include "diagnostics_service.h"
#include "app.h"
App::App(VeQItem *subRoot, VeQItem *pubRoot, int tcpPort, QObject *parent) :
QObject(parent),
mServer(tcpPort, parent),
mBackend(parent),
mDBusServices(subRoot, parent),
mMapping(&mDBusServices, parent)
{
mMapping.importCSV("attributes.csv");
mMapping.importUnitIDMapping("unitid2di.csv");
connect(&mServer, SIGNAL(modbusRequest(ADU*)), &mBackend, SLOT(modbusRequest(ADU*)));
connect(&mBackend, SIGNAL(modbusReply(ADU*)), &mServer, SLOT(modbusReply(ADU*)));
connect(&mBackend, SIGNAL(mappingRequest(MappingRequest *)), &mMapping, SLOT(handleRequest(MappingRequest *)));
connect(&mMapping, SIGNAL(requestCompleted(MappingRequest *)),
&mBackend, SLOT(requestCompleted(MappingRequest *)));
VeQItem *serviceRoot = pubRoot->itemGetOrCreate("com.victronenergy.modbustcp");
new DiagnosticsService(&mDBusServices, &mMapping, serviceRoot, this);
mDBusServices.initialScan();
}