Compare commits

..

4 Commits
2.1.0 ... 2.2.0

5 changed files with 57 additions and 5 deletions

View File

@@ -134,6 +134,37 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
}
void ATBDeviceControllerPlugin::sendDeviceParameter(const QJsonObject &jsonObject)
{
qCritical() << "ATBDeviceControllerPlugin::sendDeviceParameter:";
// extract location info and store location info in persistent data:
QJsonValue jsonSubVal;
jsonSubVal = jsonObject["Location"];
QString locationString = jsonSubVal.toString("");
if (locationString == "") {
qCritical() << " --> locationString NULL";
return;
}
uint16_t customerNr = PTUSystem::readCustomerNumber();
uint16_t machineNr = PTUSystem::readMachineNumber();
uint16_t borough = PTUSystem::readZoneNumber();
uint16_t zone = PTUSystem::readGroupNumber();
uint16_t alias = 0;
QByteArray locationBa = locationString.toLocal8Bit();
this->hw->sendMachineID(customerNr, machineNr, borough, zone, alias, locationBa.data());
}
void ATBDeviceControllerPlugin::startPhysicalLayer()
{
if (!this->isMaster) return;

View File

@@ -44,6 +44,8 @@ public:
// interface:
PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings);
void sendDeviceParameter(const QJsonObject & jsonObject);
// TASKS: Cash handling -------------------------------------------------------
void requestStartCashInput(const QString & amount);
void requestStopCashInput();

View File

@@ -12,6 +12,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
, eventReceiver(nullptr)
, isRequestRunning(false)
, flagInterruptDiag(false)
, lastState(DeviceController::State::INITIAL_STATE)
, pData(pData)
{
diagRequestTimeoutTimer = new QTimer(this);
@@ -365,7 +366,6 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
{
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
if (this->eventReceiver == nullptr) {
qCritical() << "DeviceControllerDiag: no eventReceiver";
return;
@@ -388,6 +388,8 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
QString parameter;
switch (result) {
case DeviceController::State::INITIAL_STATE:
break;
case DeviceController::State::A000: // alarm / intrusion
eventClass = EVENT_CLASS::ALARM;
parameter = "alarm / intrusion";
@@ -480,7 +482,13 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
this->machineEventSet.clear();
eventClass = EVENT_CLASS::OPERATE;
parameter = "";
if (this->lastState == DeviceController::State::O000) {
qCritical() << " ... everything fine, no state change -> skip sending";
return;
}
else {
qCritical() << " ... everything fine";
}
break;
case DeviceController::State::W001: // paper low
@@ -501,6 +509,7 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
break;
}
this->lastState = result;
ATBMachineEvent *machineEvent = new ATBMachineEvent(
eventId,

View File

@@ -52,7 +52,9 @@ namespace DeviceController {
W001,
W002,
W003,
W004
W004,
INITIAL_STATE
};
Q_ENUM_NS(State)
}
@@ -91,6 +93,7 @@ private:
int lastVoltage;
DeviceController::State lastState;
QSet<DeviceController::State> machineEventSet;
PersistentData* pData;

View File

@@ -5,6 +5,7 @@
#include <QSettings>
#include <QString>
#include <QJsonObject>
#include "ATBAPPplugin.h"
@@ -39,6 +40,12 @@ public:
virtual nsDeviceControllerInterface::PLUGIN_STATE initDCPlugin(QObject *eventReceiver,
const QSettings & settings) = 0;
/**
* e.g. send location
*/
virtual void sendDeviceParameter(const QJsonObject & jsonObject) = 0;
// TASKS: Cash handling -------------------------------------------------------
/**
* enables coin input
@@ -196,7 +203,7 @@ signals:
Q_DECLARE_INTERFACE(DeviceControllerInterface,
"eu.atb.ptu.plugin.DeviceControllerInterface/1.1.3")
"eu.atb.ptu.plugin.DeviceControllerInterface/1.1.4")
namespace nsDeviceControllerInterface {