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() void ATBDeviceControllerPlugin::startPhysicalLayer()
{ {
if (!this->isMaster) return; if (!this->isMaster) return;

View File

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

View File

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

View File

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

View File

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