Merge commit '6099d07650acb28df1a5c9659479351daa7c2d27'
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "shared_mem_buffer.h"
|
||||
#include <QDebug>
|
||||
#include <QSharedMemory>
|
||||
|
||||
#include "interfaces.h"
|
||||
|
||||
static uint32_t hwapi_lastStartAmount;
|
||||
@@ -34,7 +33,7 @@ static const QMap<QString, int> baudrateMap = {
|
||||
{"57600" , 4}, {"115200" , 5}
|
||||
};
|
||||
|
||||
hwapi::hwapi(QWidget *parent) : QObject(parent) {
|
||||
hwapi::hwapi(QObject *parent) : QObject(parent) {
|
||||
// create or attach shared memory segment
|
||||
// !!! The compoment creating the shared memory MUST be ATBQT !!!
|
||||
m_sharedMem = SharedMemBuffer::getShm(sizeof(SharedMemBuffer));
|
||||
@@ -1652,20 +1651,6 @@ uint8_t hwapi::coin_escrowFlapOpened(void) const
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Level4 devices are operated by DC
|
||||
// processes with more then one devices
|
||||
// timer controlled or long term processes
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
void hwapi::sendDeviceSettings(uint8_t kindOfPrinter, uint8_t kindOfCoinChecker,
|
||||
uint8_t kindOfMifareReader, uint8_t suppressSleep,
|
||||
uint8_t kindOfModem, uint8_t kindOfCredit) const
|
||||
@@ -3531,12 +3516,17 @@ bool hwapi::prn_sendDynamicPrnValues(uint8_t *dynPrnVal ) const
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool hwapi::prn_printTemplate(uint8_t nrOftemplate) const
|
||||
// print one of the templates loaded by Json prior
|
||||
// nr = 1..32
|
||||
{
|
||||
// return true if sending, false if cmd-stack is full
|
||||
return sendFDcmd_set(152, 0,0, nrOftemplate,0,0,0);
|
||||
|
||||
// 3.5.23: die dynVals und alle templates sollen am stück gesendet
|
||||
uint8_t data[64];
|
||||
data[0]=nrOftemplate;
|
||||
return longFDcmd_set(152, 0,0, 1, data);
|
||||
}
|
||||
|
||||
void hwapi::log_getHoldAccountNumbers(uint8_t *nrOfVals, uint16_t *accNr ) const
|
||||
@@ -3717,6 +3707,20 @@ uint64_t hwapi::sys_getWakeSource(void) const
|
||||
return epi_getWakeSources();
|
||||
}
|
||||
|
||||
uint8_t hwapi::sys_getWakeReason(void) const
|
||||
{
|
||||
// Master was woken by following reason:
|
||||
// 1: MDB Event
|
||||
// 2: Coin Event
|
||||
// ( 3: Master Event) - will not set the wake line
|
||||
// ( 4: 32s pulse) - will not set the wake line
|
||||
// 5: Door Event
|
||||
// ( 6: Diag Event) - will not set the wake line
|
||||
// 7: 30min-Pulse for HB
|
||||
|
||||
return epi_getWakeReason();
|
||||
}
|
||||
|
||||
|
||||
void hwapi::sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const
|
||||
{
|
||||
@@ -3852,3 +3856,209 @@ uint8_t hwapi::prn_getCurrentPrinterState() const
|
||||
}
|
||||
|
||||
|
||||
// 21.4.23TS: change function "sendDeviceSettings()" to use this struct: "struct T_devices"
|
||||
void hwapi::sys_sendDeviceParameter(struct T_devices *deviceSettings) const
|
||||
{
|
||||
// same as "sendDeviceSettings()" but with much more data
|
||||
uint8_t buf[64];
|
||||
uint16_t LL, nn;
|
||||
tslib_strclr(buf,0,64);
|
||||
uint8_t *start;
|
||||
|
||||
// den gesamten struct in einen Puffer kopieren
|
||||
LL=sizeof(struct T_devices);
|
||||
start = &deviceSettings->kindOfPrinter;
|
||||
nn=0;
|
||||
do
|
||||
{
|
||||
buf[nn] = *start;
|
||||
start++;
|
||||
} while(++nn<LL);
|
||||
|
||||
epi_store64BdevParameter(LL,buf); // this buffer holds the device settings to be used here in hwapi
|
||||
epi_store64ByteSendData(LL, buf); // this buffer holds sending data temporarely
|
||||
sendWRcmd_setSendCommand0(SENDDIRCMD_DEVICE_PARA);
|
||||
|
||||
}
|
||||
|
||||
void hwapi::sys_restoreDeviceParameter(struct T_devices *deviceSettings) const
|
||||
{
|
||||
uint8_t buf[64];
|
||||
uint8_t LL, nn;
|
||||
tslib_strclr(buf,0,64);
|
||||
uint8_t *start;
|
||||
|
||||
epi_restore64BdevParameter(&LL, buf);
|
||||
|
||||
// Puffer in struct eintragen:
|
||||
start = &deviceSettings->kindOfPrinter;
|
||||
nn=0;
|
||||
do
|
||||
{
|
||||
*start = buf[nn];
|
||||
start++;
|
||||
} while(++nn<LL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------
|
||||
// ------------ supervise all hardware components
|
||||
// ------------ assess the machine state
|
||||
|
||||
1. check if DC startup test is through, retrigger if not
|
||||
2. get results and find errors
|
||||
3. in case of error check if component is used (e.g. billreader is seldom used)
|
||||
4: check doors
|
||||
5. return value: 0: no response from DC
|
||||
1: no Test results and Test not running. need retrigger!
|
||||
2: state not clear by now, test ongoing, wait
|
||||
3: Service or battery door is open, goto INTRUSION MODE
|
||||
from here: after valid ID-card goto SERVICE MODE
|
||||
4: vault door is open, goto INTRUSION MODE
|
||||
from here: after valid ID-card and vault door closed goto TEST MODE
|
||||
in TEST MODE: complete system check decides if vending mode allowed
|
||||
5: All doors are closed but errors found,
|
||||
goto OOO MODE (out-of-order)
|
||||
from here: run system test until problem is fixed
|
||||
6: All doors are closed, no error, maybe warnings,
|
||||
goto VENDING MODE (normal operation)
|
||||
(priority sinks from 0 to 6)
|
||||
|
||||
--------------------------------------------------------------------------------------------- */
|
||||
|
||||
uint8_t hwapi::sys_componentAssessment(void) const
|
||||
{
|
||||
// this function decides if vending mode is possible, independant from door
|
||||
// return >0 in case of error
|
||||
// is inncluded in sys_superviseSystem
|
||||
|
||||
struct T_moduleCondition *modCond=0;
|
||||
sys_getDeviceConditions(modCond);
|
||||
|
||||
struct T_dynamicCondition *dynMaCond=0;
|
||||
sys_getDynMachineConditions(dynMaCond);
|
||||
|
||||
struct T_devices *devPara=0;
|
||||
sys_restoreDeviceParameter(devPara);
|
||||
|
||||
if (modCond->rtc>=200)
|
||||
return 1;
|
||||
if (modCond->printer==200 || modCond->printer==201) // 200: not connected 201: printer-HW-error 202: no paper
|
||||
return 2;
|
||||
if (modCond->printer==202)
|
||||
return 3;
|
||||
|
||||
if (modCond->coinBlocker>=200)
|
||||
return 4;
|
||||
if (modCond->mdbBus>=200)
|
||||
return 5;
|
||||
if (modCond->intEe>=200)
|
||||
return 6;
|
||||
|
||||
if (devPara->kindOfCoinChecker==1 || devPara->kindOfCoinChecker==2) // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
||||
{
|
||||
if (modCond->coinChecker>=200 || modCond->coinEscrow>=200)
|
||||
{
|
||||
// Fehler Münzver.
|
||||
return 7;
|
||||
}
|
||||
if (modCond->coinSafe>200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
} else
|
||||
if (devPara->kindOfCoinChecker==3)
|
||||
{
|
||||
if (modCond->changer>=200)
|
||||
{
|
||||
// Fehler Münzver.
|
||||
return 7;
|
||||
}
|
||||
if (modCond->coinSafe>200) // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
if ( modCond->billReader>=200 && devPara->BillAcceptor>0)
|
||||
{
|
||||
// Fehler BNA
|
||||
return 9;
|
||||
}
|
||||
|
||||
if (dynMaCond->onAlarm>0)
|
||||
return 10;
|
||||
|
||||
if (dynMaCond->modeAbrech>0)
|
||||
return 11;
|
||||
|
||||
if (dynMaCond->nowCardTest>0)
|
||||
return 12;
|
||||
|
||||
if (dynMaCond->startupTestIsRunning>0)
|
||||
return 13;
|
||||
|
||||
if (modCond->voltage>=200)
|
||||
return 14;
|
||||
if (modCond->temper>=200)
|
||||
return 15;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// retrigger System-Check with:
|
||||
// bool hwapi::sys_runCompleteTest(void) const
|
||||
|
||||
|
||||
uint8_t hwapi::sys_superviseSystem(void) const
|
||||
{
|
||||
// this function proofs if vending is possible depending of doors state
|
||||
|
||||
struct T_dynamicCondition *dynMaCond=0;
|
||||
struct T_moduleCondition *modCond=0;
|
||||
|
||||
if (!gpi_areDcDataValid())
|
||||
{
|
||||
// es gibt keinerlei gültige Daten vom DC
|
||||
return 0;
|
||||
}
|
||||
|
||||
// jetzt sind die DC-Daten aktuell, also reinholen:
|
||||
sys_getDynMachineConditions(dynMaCond);
|
||||
sys_getDeviceConditions(modCond);
|
||||
|
||||
if (!modCond->allModulesChecked)
|
||||
{
|
||||
// noch keine Testergebnisse
|
||||
if (dynMaCond->startupTestIsRunning)
|
||||
return 2; // Starttest läuft gerade
|
||||
else
|
||||
return 1; // Starttest ist noch nicht gelaufen
|
||||
}
|
||||
|
||||
// all doors: 99: undefined 0:closed 1:open
|
||||
if (dynMaCond->lowerDoor || dynMaCond->upperDoor)
|
||||
return 3;
|
||||
if (dynMaCond->middleDoor)
|
||||
return 4;
|
||||
|
||||
if (sys_componentAssessment() >0)
|
||||
return 5; // errors found
|
||||
|
||||
return 6; // everything fine
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t hwapi::sys_getSystemErrors(void) const
|
||||
{
|
||||
|
||||
return sys_componentAssessment();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user