Send voltage Value as healthEvent
This commit is contained in:
parent
488152c37d
commit
334d67fd22
@ -2,6 +2,7 @@
|
|||||||
#include "src/ATBAPP/ATBHealthEvent.h"
|
#include "src/ATBAPP/ATBHealthEvent.h"
|
||||||
#include "src/ATBAPP/ATBMachineEvent.h"
|
#include "src/ATBAPP/ATBMachineEvent.h"
|
||||||
#include "src/ATBAPP/Utils.h"
|
#include "src/ATBAPP/Utils.h"
|
||||||
|
#include "src/ATBAPP/support/JSON.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
@ -47,6 +48,7 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
|||||||
|
|
||||||
|
|
||||||
this->diag = new DeviceControllerDiag(this);
|
this->diag = new DeviceControllerDiag(this);
|
||||||
|
connect(this->diag, &DeviceControllerDiag::newVoltage, this, &ATBDeviceControllerPlugin::onNewVoltage);
|
||||||
|
|
||||||
|
|
||||||
this->currentSelectedTicketType = 0;
|
this->currentSelectedTicketType = 0;
|
||||||
@ -345,6 +347,34 @@ void ATBDeviceControllerPlugin::onAllDoorsClosed()
|
|||||||
emit this->requestModeIDLE();
|
emit this->requestModeIDLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::onNewVoltage(uint32_t voltage)
|
||||||
|
{
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::onNewVoltage() = " << voltage;
|
||||||
|
|
||||||
|
QString voltageString = QString::number(voltage);
|
||||||
|
|
||||||
|
JSON::setPrettySerialize(true);
|
||||||
|
JSON::JsonObject json;
|
||||||
|
|
||||||
|
json = JSON::objectBuilder()
|
||||||
|
->set("Name", "batt")
|
||||||
|
->set("Value", voltageString)
|
||||||
|
->set("Unit", "V")
|
||||||
|
->create();
|
||||||
|
|
||||||
|
|
||||||
|
ATBHealthEvent *healthEvent = new ATBHealthEvent(
|
||||||
|
ATB_HEALTH_MODE::STATE,
|
||||||
|
"VOLTAGE",
|
||||||
|
JSON::serialize(json)
|
||||||
|
);
|
||||||
|
|
||||||
|
QCoreApplication::postEvent(eventReceiver, healthEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TASKS: printing ------------------------------------------------------------
|
// TASKS: printing ------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public slots:
|
|||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
// public Signals are defined in interface
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -145,6 +145,9 @@ private slots:
|
|||||||
void private_startAccount();
|
void private_startAccount();
|
||||||
void private_checkAccountData();
|
void private_checkAccountData();
|
||||||
void private_getAccountData();
|
void private_getAccountData();
|
||||||
|
|
||||||
|
// measurement values
|
||||||
|
void onNewVoltage(uint32_t voltage);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ATBDEVICECONTROLLERPLUGIN_H
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|
||||||
|
@ -161,6 +161,15 @@ uint8_t DeviceControllerDiag::sub_componentAssessment()
|
|||||||
struct T_devices devPara;
|
struct T_devices devPara;
|
||||||
hw->sys_restoreDeviceParameter(&devPara);
|
hw->sys_restoreDeviceParameter(&devPara);
|
||||||
|
|
||||||
|
// store some interesting results:
|
||||||
|
// -> voltage:
|
||||||
|
uint32_t voltage = hw->dc_getVoltage();
|
||||||
|
emit newVoltage(voltage);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// check for invalid states:
|
||||||
|
|
||||||
if (modCond.rtc>=200)
|
if (modCond.rtc>=200)
|
||||||
return 1;
|
return 1;
|
||||||
if (modCond.printer==200 || modCond.printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
if (modCond.printer==200 || modCond.printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
||||||
|
@ -22,6 +22,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void diagResponse(ATBMachineEvent* machineEvent);
|
void diagResponse(ATBMachineEvent* machineEvent);
|
||||||
|
|
||||||
|
void newVoltage(uint32_t voltage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QObject *eventReceiver;
|
QObject *eventReceiver;
|
||||||
@ -35,6 +36,8 @@ private:
|
|||||||
uint8_t sub_componentAssessment();
|
uint8_t sub_componentAssessment();
|
||||||
uint8_t sys_getSystemErrors();
|
uint8_t sys_getSystemErrors();
|
||||||
|
|
||||||
|
int lastVoltage;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDiagRequestTimeoutTimerTimeout();
|
void onDiagRequestTimeoutTimerTimeout();
|
||||||
|
|
||||||
|
@ -135,6 +135,10 @@ signals:
|
|||||||
*/
|
*/
|
||||||
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* emitted on error
|
* emitted on error
|
||||||
* depending on errorCode:
|
* depending on errorCode:
|
||||||
|
Loading…
Reference in New Issue
Block a user