Merge with TS 21.04.23
This commit is contained in:
parent
080c00eda1
commit
1663d09d3a
@ -324,6 +324,7 @@ public:
|
||||
// Sende Schreibbefehle die bereits vorher asynchron gespeichert wurden
|
||||
void send_requests(uint16_t nextWrCmd);
|
||||
void sendHighLevel(uint16_t nxtHLCmd);
|
||||
bool areDataValid(void);
|
||||
|
||||
signals:
|
||||
void ResponseRecieved();
|
||||
|
35
include/hwChk.h
Executable file
35
include/hwChk.h
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef hwchk_H
|
||||
#define hwchk_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <QTabWidget>
|
||||
#include <QObject>
|
||||
#include "interfaces.h"
|
||||
//#include "datIf.h"
|
||||
#include <QDebug>
|
||||
#include <QSharedMemory>
|
||||
#include "hwapi.h"
|
||||
|
||||
//class QSharedMemory;
|
||||
class hwChk : public QObject,
|
||||
public hwinf
|
||||
{
|
||||
Q_OBJECT
|
||||
// Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json")
|
||||
// Q_INTERFACES(hwinf)
|
||||
//private:
|
||||
// QSharedMemory *m_sharedMem;
|
||||
|
||||
public:
|
||||
explicit hwChk(QWidget *parent = nullptr);
|
||||
virtual ~hwChk();
|
||||
|
||||
|
||||
public:
|
||||
hwinf *HWaccess;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
140
include/hwapi.h
140
include/hwapi.h
@ -1,87 +1,3 @@
|
||||
/*
|
||||
matching interfaces.h:
|
||||
|
||||
// History
|
||||
// 11.10.2021: V1.0 222 functions
|
||||
// 23.12.2021: V1.1 added block-parameter to function "read mifare data"
|
||||
// 30.12.2021: V1.2 added function: mif_clearDataBuffer(), mif_isBlockAvailable(uint8_t blkNr) and mif_getAvailableDataBlocks()
|
||||
// 1.1.2022: V1.3 Mifare extended. ( background: read 16 x 48byte from card to DC, read 12 x 64byte from DC to CA)
|
||||
// new: read full card with 768bytes from HWapi without block borders
|
||||
// added: mif_getNrOfAvailableDataBytes mif_getCardData768byteDec(uint8_t *buf, uint16_t bufferSize)
|
||||
// mif_getCardDataDec(uint16_t fromAddr, uint16_t toAddr, uint8_t *buf, uint16_t bufferSize)
|
||||
// mif_getCardDataStr(bool useHexFormat, char seperator)
|
||||
// 29.03.2023: V3.1 some extensions for PSA1256_ptu5,
|
||||
// V3.2 Bootloader improvement
|
||||
// 12.04.2023: V3.3 new features extended: loading and using Json-files, cash-collection, cash-data-logging
|
||||
|
||||
//#define HWINF_iid "Atb.Psa2020.software.HWapi/3.1"
|
||||
//#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.1"
|
||||
#define HWINF_iid "Atb.Psa1256ptu5.software.HWapi/3.3"
|
||||
|
||||
|
||||
PSA1259 hardware control using the DeviceController DC2
|
||||
|
||||
covering enclosure (switches and doors) and money devices,
|
||||
controls mifare card to access or program
|
||||
optional it can control printer, modem, bar code reader and credit card
|
||||
|
||||
* API to the PSA1259 Hardware
|
||||
* All data come in from device controller via serial interface and will be stored
|
||||
* in "PI" = peripheral image
|
||||
* PI is updated every 100ms (up to 30ms possible)
|
||||
* This api uses stored pi data and returns them in the following functions
|
||||
* created: Q1/2020 TS
|
||||
*
|
||||
|
||||
The devices, connected to device controller2 (DC2) can be controlled in different access levels.
|
||||
Level 1:
|
||||
direct connection to DC2, check versions, state and parameters
|
||||
control serial interfaces
|
||||
digital/analog IO's
|
||||
read and write to connected devices on lowest level, this is a kind of fall-back-level
|
||||
in case higher levels fail or do not support the needed (new) function
|
||||
Example: send a specific printer command, several bytes that need to be conform to
|
||||
printer manual. This command is routed to the printer through the DC2 without
|
||||
any action of the DC. You can write your own device driver that way.
|
||||
Level 1 is flexible but complicated
|
||||
|
||||
Level 2:
|
||||
The DC controls the connected devices containing a device driver. The DC offers
|
||||
usage of the device by simple commands,
|
||||
Example: "Printer on", "set Font size 3" "print "hello world"", "cut"
|
||||
In opposite to level 1 where you had to send a set of numbers and letters.
|
||||
In other words: you "talk" to the device controller, not to the device itself.
|
||||
|
||||
Level 3:
|
||||
start/stop complete processes.
|
||||
Example: 1) print (predefined) document nr 3 with Text, letter size, font set, cut.
|
||||
Also power up/down the printer, check if paper ok and so on.
|
||||
*/
|
||||
|
||||
/*
|
||||
Another access example: control the coin unit
|
||||
|
||||
Level 1): read digital inputs to detect coin,
|
||||
switch digital output which opens coin slot
|
||||
communicate with coin checker by certain mdb-commands (manual conform)
|
||||
poll coin checker for inserted coins
|
||||
close coin slot after 3seconds by setting DO to 0....
|
||||
|
||||
Level 2): get message of attached coin from DC
|
||||
send command "initialize coin checker" to DC
|
||||
send command "open slot for 3s"
|
||||
poll DC for inserted coins, DC polls coin checker in right way, no need
|
||||
to know the data sheet of the coin checker or mdb-bus
|
||||
command to DC "open coin escrow's return flap for 1s"
|
||||
|
||||
Level 3): send command: "start payment process"
|
||||
all coin devices are started up
|
||||
coin blocker opens for 3s if a coin is attached
|
||||
coin checker summarizes inserted value and reports sum
|
||||
later send command "stop payment process" (puts coins to vault) or
|
||||
send command "cancel payment process" (returns coins to user)
|
||||
|
||||
*/
|
||||
|
||||
#ifndef hwapi_H
|
||||
#define hwapi_H
|
||||
@ -121,7 +37,7 @@ public:
|
||||
T_datif *myDatif;
|
||||
|
||||
|
||||
QStringList dc_getStatus() const override;
|
||||
virtual QStringList dc_getStatus() const override;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Level 0 commands, interface
|
||||
@ -1080,6 +996,16 @@ public:
|
||||
uint64_t sys_getWakeSource(void) const override;
|
||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||
|
||||
uint8_t sys_getWakeReason(void) const override;
|
||||
// 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
|
||||
|
||||
void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const override;
|
||||
|
||||
void sys_getDeviceConditions(struct T_moduleCondition *devCond) const override;
|
||||
@ -1102,6 +1028,50 @@ public:
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
|
||||
void sys_sendDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||
|
||||
void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const override;
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------
|
||||
// ------------ 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 sys_componentAssessment(void) const override;
|
||||
// this function decides if vending mode is possible, independant from door
|
||||
// return >0 in case of error
|
||||
// is inncluded in sys_superviseSystem
|
||||
|
||||
uint8_t sys_superviseSystem(void) const override;
|
||||
// this function proofs if vending is possible depending of doors state
|
||||
|
||||
|
||||
uint8_t sys_getSystemErrors(void) const override;
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
signals:
|
||||
void hwapi_templatePrintFinished_OK(void) const override;
|
||||
|
@ -182,29 +182,25 @@ struct T_moduleCondition {
|
||||
uint8_t ResetReason;
|
||||
uint8_t allModulesChecked;
|
||||
|
||||
uint8_t alarmState;
|
||||
uint8_t res11;
|
||||
uint8_t res12;
|
||||
uint8_t res13;
|
||||
};
|
||||
|
||||
struct T_dynamicCondition {
|
||||
char allDoorsDebounced;
|
||||
char allDoorsDebounced; // 99: undefined, 0=all closed, bit1=upper door open 2=midlle door open 3=lower door open
|
||||
char openedAuthorized;
|
||||
uint8_t CBinDebounced;
|
||||
char upperDoor; // 0:fehlt 1:drin
|
||||
char middleDoor;
|
||||
char lowerDoor;
|
||||
char coinBox;
|
||||
char upperDoor; // 99: undefined 0:closed 1:open
|
||||
char middleDoor; // 99: undefined 0:closed 1:open
|
||||
char lowerDoor; // 99: undefined 0:closed 1:open
|
||||
char reserve; // not used, always 0
|
||||
char billBox;
|
||||
char modeAbrech;
|
||||
char onAlarm;
|
||||
char onAlarm; // 0:alarm aus 1:alarm 2:alarm mit Sirene 3: Sirenentest
|
||||
char nowCardTest;
|
||||
char nowPayment;
|
||||
char lastMifCardType;
|
||||
uint8_t lastSDoorState;
|
||||
uint8_t lastVDoorState;
|
||||
uint8_t lastCBstate;
|
||||
uint8_t lastCBstate; // 99: undefined 0:not there 1:insered
|
||||
char paymentInProgress;
|
||||
char res1;
|
||||
uint16_t U_Batt;
|
||||
@ -232,6 +228,7 @@ struct T_dynamicCondition {
|
||||
// bit4: paper jam in cutter
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
uint8_t startupTestIsRunning;
|
||||
//54
|
||||
};
|
||||
|
||||
@ -263,6 +260,39 @@ struct T_extTime {
|
||||
uint32_t MinutesOfMillenium;
|
||||
};
|
||||
|
||||
typedef uint8_t UCHAR;
|
||||
typedef uint16_t UINT;
|
||||
|
||||
struct T_devices
|
||||
{
|
||||
// set by master, used(1) or notused (0) or type 2....20
|
||||
|
||||
UCHAR kindOfPrinter; // 0:off 1:Gebe
|
||||
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
|
||||
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
|
||||
UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
|
||||
|
||||
UCHAR kindOfModem; // 0:off 1:Sunlink
|
||||
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
|
||||
UCHAR CoinEscrow;
|
||||
UCHAR CoinRejectUnit;
|
||||
|
||||
UCHAR CoinShutter;
|
||||
UCHAR BillAcceptor;
|
||||
UCHAR usevaultLock;
|
||||
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
|
||||
|
||||
UCHAR autoOpen; // 1: open door covers after valid ATBcard
|
||||
UCHAR printAccReceipt; // 0/1
|
||||
UCHAR printDoorReceipt;
|
||||
UCHAR printTokenTicket;
|
||||
|
||||
UINT VaultFullWarnLevel;
|
||||
UINT VaultFullErrorLevel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class hwinf {
|
||||
public:
|
||||
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||
@ -1451,6 +1481,16 @@ public:
|
||||
virtual uint64_t sys_getWakeSource(void) const =0;
|
||||
// retval: 6 bytes, bit coded, 1=event keeps DC awake
|
||||
|
||||
virtual uint8_t sys_getWakeReason(void) const=0;
|
||||
// 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
|
||||
|
||||
virtual void sys_getDeviceConditions(uint8_t *leng, uint8_t *data) const=0;
|
||||
/*
|
||||
|
||||
@ -1572,6 +1612,60 @@ public:
|
||||
// bit6: no response bit7: serial rec. error
|
||||
// bit5: printer not ready
|
||||
|
||||
virtual void sys_sendDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||
|
||||
virtual void sys_restoreDeviceParameter(struct T_devices *deviceSettings) const=0;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------
|
||||
// ------------ 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)
|
||||
|
||||
--------------------------------------------------------------------------------------------- */
|
||||
|
||||
virtual uint8_t sys_componentAssessment(void) const=0;
|
||||
// this function decides if vending mode is possible, independant from door
|
||||
// return >0 in case of error
|
||||
// is inncluded in sys_superviseSystem
|
||||
|
||||
virtual uint8_t sys_superviseSystem(void) const=0;
|
||||
// this function proofs if vending is possible depending of doors state
|
||||
|
||||
virtual uint8_t sys_getSystemErrors(void) const=0;
|
||||
|
||||
|
||||
// retrigger System-Check with:
|
||||
// bool hwapi::sys_runCompleteTest(void) const
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
signals:
|
||||
virtual void hwapi_templatePrintFinished_OK(void) const=0;
|
||||
virtual void hwapi_templatePrintFinished_Err(void) const=0;
|
||||
|
@ -237,6 +237,14 @@ uint8_t check4freeFDlongCmd(void);
|
||||
// returns number of free places in long-command stack
|
||||
|
||||
|
||||
|
||||
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf);
|
||||
// HWapi writes data to be stored
|
||||
|
||||
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -225,6 +225,9 @@ struct SharedMemBuffer {
|
||||
uint8_t vaultrecord[360];
|
||||
uint32_t amount;
|
||||
uint16_t nrOfCoins;
|
||||
bool dcDataValid;
|
||||
uint8_t wakeReason;
|
||||
|
||||
} store;
|
||||
|
||||
struct T_globTime {
|
||||
|
@ -3,7 +3,7 @@
|
||||
#define STOREINDATA_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "tslib.h"
|
||||
//#include "tslib.h"
|
||||
#include <QString>
|
||||
|
||||
|
||||
@ -384,6 +384,7 @@ bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values);
|
||||
|
||||
void gpi_storeWakeSources(uint8_t const *receivedData);
|
||||
uint64_t epi_getWakeSources(void);
|
||||
uint8_t epi_getWakeReason(void);
|
||||
|
||||
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data);
|
||||
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data);
|
||||
@ -415,6 +416,11 @@ uint8_t epi_mifGetCardType(uint8_t const *holder);
|
||||
//holder[8] = name of card holder
|
||||
// retval Type of MifareCard, 1=upper door, 2=lower door 3=test printer 4=test coins
|
||||
|
||||
void gpi_storeDcDataValid(bool isVal);
|
||||
bool gpi_areDcDataValid();
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
1585
plugins/interfaces.h
1585
plugins/interfaces.h
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,8 @@
|
||||
#include "src/ATBAPP/ATBDeviceControllerPlugin.h"
|
||||
#include "src/ATBAPP/ATBHealthEvent.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject(parent),
|
||||
pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||
@ -58,6 +60,14 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
||||
{
|
||||
struct T_dynDat *dynTicketData = new T_dynDat;
|
||||
|
||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||
<< " licenseplate = " << printingData["licenseplate"] << endl
|
||||
<< " amount = " << printingData["amount"] << endl
|
||||
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
||||
<< " currentTime = " << printingData["currentTime"] << endl
|
||||
<< " currentDate = " << printingData["currentDate"] << endl;
|
||||
|
||||
|
||||
strncpy((char*)dynTicketData->licensePlate, printingData["licenseplate"].toByteArray().data(), 7);
|
||||
strncpy((char*)dynTicketData->vendingPrice, printingData["amount"].toByteArray().data(), 7);
|
||||
strncpy((char*)dynTicketData->parkingEnd, printingData["parkingEnd"].toByteArray().data(), 7);
|
||||
@ -71,9 +81,11 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
||||
emit this->onPrintFinishedERR();
|
||||
}
|
||||
|
||||
if (!this->hw->prn_printDocument(1, dynTicketData)) {
|
||||
this->errorCode = "hwapi::prn_printDocument";
|
||||
this->errorDescription = "hwapi method 'hwapi::prn_printDocument' result is false";
|
||||
|
||||
// TODO: wird hier nur 'licensePlate' gedruckt?
|
||||
if (!this->hw->prn_sendDynamicPrnValues(dynTicketData->licensePlate)) {
|
||||
this->errorCode = "hwapi::prn_sendDynamicPrnValues";
|
||||
this->errorDescription = "hwapi method 'hwapi::prn_sendDynamicPrnValues' result is false";
|
||||
|
||||
qCritical() << "ERROR:";
|
||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||
@ -85,8 +97,28 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
||||
|
||||
|
||||
emit this->onPrintFinishedERR();
|
||||
return;
|
||||
}
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(onPrinterDataPrepared()));
|
||||
}
|
||||
|
||||
void ATBDeviceControllerPlugin::onPrinterDataPrepared()
|
||||
{
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
|
||||
qCritical() << " ... print template " << i;
|
||||
|
||||
if (!this->hw->prn_printTemplate(i)) {
|
||||
this->errorCode = "hwapi::prn_printTemplate";
|
||||
this->errorDescription = QString("hwapi method 'hwapi::prn_printTemplate(%1)' result is false").arg(i);
|
||||
emit this->onPrintFinishedERR();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************************************
|
||||
|
@ -103,6 +103,7 @@ private:
|
||||
|
||||
|
||||
private slots:
|
||||
void onPrinterDataPrepared();
|
||||
void onPrintFinishedOK();
|
||||
void onPrintFinishedERR();
|
||||
void onGotCoin();
|
||||
|
@ -17,6 +17,8 @@ static uint16_t datif_OutCmdpara5;
|
||||
static uint32_t datif_OutCmdpara6;
|
||||
static uint8_t cycl_running;
|
||||
|
||||
//static bool datif_DCdataValid;
|
||||
|
||||
T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
|
||||
@ -46,6 +48,8 @@ T_datif::T_datif(QWidget *parent) : QMainWindow(parent)
|
||||
dif_scanStep=0;
|
||||
selectedSlaveAddr=FIX_SLAVE_ADDR;
|
||||
cycl_running=0;
|
||||
//datif_DCdataValid=0;
|
||||
gpi_storeDcDataValid(0);
|
||||
}
|
||||
|
||||
void T_datif::resetChain(void)
|
||||
@ -1478,6 +1482,10 @@ char T_datif::loadRecDataFromFrame()
|
||||
|
||||
*/
|
||||
|
||||
if (RdDleng>40)
|
||||
//datif_DCdataValid=1; // das hier sind die wichtigsten Daten, deshalb hierrein!
|
||||
gpi_storeDcDataValid(1);
|
||||
|
||||
gpi_storeDynMachineConditions(RdDleng, receivedData);
|
||||
|
||||
prnResult=receivedData[52];
|
||||
|
25
src/hwChk.cpp
Executable file
25
src/hwChk.cpp
Executable file
@ -0,0 +1,25 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "hwChk.h"
|
||||
|
||||
|
||||
hwChk::hwChk(QWidget *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
// myDCIF = new T_prot();
|
||||
// h: T_prot *myDCIF;
|
||||
|
||||
//myDatif = new T_datif();
|
||||
HWaccess = new hwinf();
|
||||
|
||||
struct T_moduleCondition dcModCond;
|
||||
sys_getDeviceConditions(dcModCond);
|
||||
|
||||
|
||||
}
|
||||
|
||||
hwChk::~hwChk()
|
||||
{
|
||||
|
||||
}
|
||||
|
235
src/hwapi.cpp
235
src/hwapi.cpp
@ -24,7 +24,6 @@
|
||||
#include "shared_mem_buffer.h"
|
||||
#include <QDebug>
|
||||
#include <QSharedMemory>
|
||||
|
||||
#include "interfaces.h"
|
||||
|
||||
static uint32_t hwapi_lastStartAmount;
|
||||
@ -1637,20 +1636,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
|
||||
@ -3702,6 +3687,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
|
||||
{
|
||||
@ -3837,3 +3836,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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,3 +671,34 @@ uint8_t check4freeFDlongCmd(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static uint8_t Sdata_DeviceParameter[64];
|
||||
static uint8_t Sdata_DevParaLen;
|
||||
|
||||
uint8_t epi_store64BdevParameter(uint8_t length, uint8_t *buf)
|
||||
{
|
||||
// HWapi writes data to be stored
|
||||
uint8_t nn;
|
||||
for (nn=0; nn<length; nn++)
|
||||
Sdata_DeviceParameter[nn]=buf[nn];
|
||||
for (nn=length; nn<64; nn++)
|
||||
Sdata_DeviceParameter[nn]=0;
|
||||
|
||||
Sdata_DevParaLen=length;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t epi_restore64BdevParameter(uint8_t *length, uint8_t *buf)
|
||||
{
|
||||
|
||||
for (uint8_t nn=0; nn<Sdata_DevParaLen; nn++)
|
||||
buf[nn]=Sdata_DeviceParameter[nn];
|
||||
*length=Sdata_DevParaLen;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1172,17 +1172,26 @@ bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values) {
|
||||
|
||||
void gpi_storeWakeSources(uint8_t const *receivedData) {
|
||||
SharedMemBuffer::getData()->store.wakeSrc = 0;
|
||||
for (int nn=7; nn>=0; nn--) {
|
||||
for (int nn=5; nn>=0; nn--) {
|
||||
uint8_t const uctmp = receivedData[nn];
|
||||
SharedMemBuffer::getData()->store.wakeSrc |= uctmp;
|
||||
SharedMemBuffer::getData()->store.wakeSrc <<= 8;
|
||||
}
|
||||
SharedMemBuffer::getData()->store.wakeReason = receivedData[6];
|
||||
|
||||
}
|
||||
|
||||
uint64_t epi_getWakeSources(void) {
|
||||
return SharedMemBuffer::getDataConst()->store.wakeSrc;
|
||||
}
|
||||
|
||||
uint8_t epi_getWakeReason(void)
|
||||
{
|
||||
return SharedMemBuffer::getDataConst()->store.wakeReason;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gpi_storeExtendedTime(uint8_t leng, uint8_t const *data) {
|
||||
leng = std::min(leng, (uint8_t)(64));
|
||||
SharedMemBuffer::getData()->store.rbDevParamLen = leng;
|
||||
@ -1303,3 +1312,25 @@ uint32_t epi_getCashBoxContent(void) {
|
||||
uint16_t epi_getNrOfCoinsInCashBox(void) {
|
||||
return SharedMemBuffer::getDataConst()->store.nrOfCoins;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void gpi_storeDcDataValid(bool isVal)
|
||||
{
|
||||
SharedMemBuffer::getData()->store.dcDataValid = isVal;
|
||||
}
|
||||
|
||||
|
||||
bool gpi_areDcDataValid()
|
||||
{
|
||||
return SharedMemBuffer::getDataConst()->store.dcDataValid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user