Added draft version for updating json-files
This commit is contained in:
parent
eaa6df0da7
commit
649f8ce0d0
@ -122,17 +122,17 @@ struct T_vaultRecord
|
|||||||
//16
|
//16
|
||||||
char label3buffer[4]; // mw >
|
char label3buffer[4]; // mw >
|
||||||
|
|
||||||
// Verkauf, Tür zu:
|
// Verkauf, Tür zu:
|
||||||
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
//88
|
//88
|
||||||
|
|
||||||
// Service, Tür offen:
|
// Service, Tür offen:
|
||||||
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
uint16_t resint3;
|
uint16_t resint3;
|
||||||
uint16_t resint4;
|
uint16_t resint4;
|
||||||
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
||||||
uint16_t resint5;
|
uint16_t resint5;
|
||||||
uint16_t resint6;
|
uint16_t resint6;
|
||||||
// 56
|
// 56
|
||||||
@ -265,6 +265,7 @@ class hwinf
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
|
||||||
|
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER};
|
||||||
|
|
||||||
virtual ~hwinf() {}
|
virtual ~hwinf() {}
|
||||||
|
|
||||||
@ -305,6 +306,10 @@ public:
|
|||||||
QString comPort) const = 0;
|
QString comPort) const = 0;
|
||||||
// download binary file down into device controller
|
// download binary file down into device controller
|
||||||
|
|
||||||
|
virtual bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||||
|
int templateNr,
|
||||||
|
QString const &fname) const = 0;
|
||||||
|
|
||||||
virtual void dc_autoRequest(bool on) const =0;
|
virtual void dc_autoRequest(bool on) const =0;
|
||||||
// on = true: select that all READ-Requests are sent automatically
|
// on = true: select that all READ-Requests are sent automatically
|
||||||
// on = false: select that all READ-Requests are sent manually one by one
|
// on = false: select that all READ-Requests are sent manually one by one
|
||||||
@ -320,7 +325,7 @@ public:
|
|||||||
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
||||||
// retval = nr of bytes received. If host buffer too small then
|
// retval = nr of bytes received. If host buffer too small then
|
||||||
// only plBufSiz bytes are copied to "payLoad"
|
// only plBufSiz bytes are copied to "payLoad"
|
||||||
// plBufSizz=size of host buffer
|
// plBufSizz=size of host buffer
|
||||||
|
|
||||||
virtual void dc_requTestResponse() const =0;
|
virtual void dc_requTestResponse() const =0;
|
||||||
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
||||||
@ -441,10 +446,10 @@ public:
|
|||||||
|
|
||||||
// Analog values:
|
// Analog values:
|
||||||
virtual uint32_t dc_getTemperature(void) const =0;
|
virtual uint32_t dc_getTemperature(void) const =0;
|
||||||
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
||||||
|
|
||||||
virtual QString dc_getTemperaturStr(void) const =0;
|
virtual QString dc_getTemperaturStr(void) const =0;
|
||||||
// as string like "-12,5°C"
|
// as string like "-12,5°C"
|
||||||
|
|
||||||
virtual uint32_t dc_getVoltage(void) const =0;
|
virtual uint32_t dc_getVoltage(void) const =0;
|
||||||
// as value in mV, 0...65,535V
|
// as value in mV, 0...65,535V
|
||||||
@ -599,7 +604,7 @@ public:
|
|||||||
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
||||||
// enable hardware in device controller:
|
// enable hardware in device controller:
|
||||||
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
||||||
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
||||||
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
||||||
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
||||||
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
||||||
@ -705,7 +710,7 @@ public:
|
|||||||
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
||||||
// byte2: density 0....(25)....50
|
// byte2: density 0....(25)....50
|
||||||
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
||||||
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
||||||
// not batched! don't use twice within 100ms
|
// not batched! don't use twice within 100ms
|
||||||
|
|
||||||
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
||||||
@ -1273,7 +1278,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Komplett-schreib Funktion, noch nicht getestet
|
// Komplett-schreib Funktion, noch nicht getestet
|
||||||
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
||||||
//virtual void bl_startSending(void) const=0;
|
//virtual void bl_startSending(void) const=0;
|
||||||
// call once after BL is working and file is loaded
|
// call once after BL is working and file is loaded
|
||||||
//virtual void bl_sendFile(void) const=0;
|
//virtual void bl_sendFile(void) const=0;
|
||||||
@ -1299,7 +1304,7 @@ public:
|
|||||||
buf[4]=GlobTime.Month;
|
buf[4]=GlobTime.Month;
|
||||||
buf[5]=GlobTime.Day;
|
buf[5]=GlobTime.Day;
|
||||||
buf[6]=GlobTime.DOW;
|
buf[6]=GlobTime.DOW;
|
||||||
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
||||||
uitmp=GlobTime.MinOfDay;
|
uitmp=GlobTime.MinOfDay;
|
||||||
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
33
main.cpp
33
main.cpp
@ -13,6 +13,12 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#ifdef PTU5
|
||||||
|
#define SERIAL_PORT "ttymxc2"
|
||||||
|
#else
|
||||||
|
#define SERIAL_PORT "ttyUSB0"
|
||||||
|
#endif
|
||||||
|
|
||||||
static void updateBinary(std::unique_ptr<hwinf> hw, // update d2dc*.bin
|
static void updateBinary(std::unique_ptr<hwinf> hw, // update d2dc*.bin
|
||||||
char const *fileToSendToDC,
|
char const *fileToSendToDC,
|
||||||
char const *baudrate,
|
char const *baudrate,
|
||||||
@ -25,16 +31,16 @@ static void updateBinary(std::unique_ptr<hwinf> hw, // update d2dc*.bin
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void updatePrinterConf(std::unique_ptr<hwinf> hw, // update printer-file
|
static void updatePrinterConf(std::unique_ptr<hwinf> hw, // update printer-file
|
||||||
char const *fileToSendToDC,
|
int nrOfTemplate,
|
||||||
char const *baudrate,
|
char const *fileToSendToDC) {
|
||||||
char const *serialInterface) {
|
|
||||||
for (int i=0; i < 1;++i) {
|
for (int i=0; i < 1;++i) {
|
||||||
hw->dc_updateDC(fileToSendToDC, baudrate, serialInterface);
|
hw->dc_updatePrinterTemplate(hwapi::FileTypeJson::PRINTER,
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
nrOfTemplate, fileToSendToDC);
|
||||||
}
|
}
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// argv[1]: file to send to dc
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
@ -55,24 +61,15 @@ int main(int argc, char *argv[]) {
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (fname.startsWith("dc") && fname.endsWith(".bin")) {
|
if (fname.startsWith("dc") && fname.endsWith(".bin")) {
|
||||||
#ifdef PTU5
|
|
||||||
std::thread t(updateBinary, std::move(hw),
|
std::thread t(updateBinary, std::move(hw),
|
||||||
fname.toStdString().c_str(), "115200", "ttymxc2");
|
fname.toStdString().c_str(), "115200", SERIAL_PORT);
|
||||||
#else
|
|
||||||
std::thread t(updateBinary, std::move(hw),
|
|
||||||
fname.toStdString().c_str(), "115200", "ttyUSB0");
|
|
||||||
#endif
|
|
||||||
ret = a.exec();
|
ret = a.exec();
|
||||||
t.join();
|
t.join();
|
||||||
} else
|
} else
|
||||||
if (fname.startsWith("DC") && fname.endsWith(".json")) {
|
if (fname.startsWith("DC2C_print") && fname.endsWith(".json")) {
|
||||||
#ifdef PTU5
|
|
||||||
std::thread t(updatePrinterConf, std::move(hw),
|
std::thread t(updatePrinterConf, std::move(hw),
|
||||||
fname.toStdString().c_str(), "115200", "ttymxc2");
|
fname.midRef(10, 2).toInt(),
|
||||||
#else
|
fname.toStdString().c_str());
|
||||||
std::thread t(updatePrinterConf, std::move(hw),
|
|
||||||
fname.toStdString().c_str(), "115200", "ttyUSB0");
|
|
||||||
#endif
|
|
||||||
ret = a.exec();
|
ret = a.exec();
|
||||||
t.join();
|
t.join();
|
||||||
}
|
}
|
||||||
|
@ -122,17 +122,17 @@ struct T_vaultRecord
|
|||||||
//16
|
//16
|
||||||
char label3buffer[4]; // mw >
|
char label3buffer[4]; // mw >
|
||||||
|
|
||||||
// Verkauf, Tür zu:
|
// Verkauf, Tür zu:
|
||||||
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint32_t VKcoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint32_t VKcoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
//88
|
//88
|
||||||
|
|
||||||
// Service, Tür offen:
|
// Service, Tür offen:
|
||||||
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
uint16_t ServCoinsInserted[16]; // nur für Wechsler, soviel wurde eingeworfen
|
||||||
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
uint16_t ServCoinsReturned[6]; // nur für Wechsler, Anzahl Münzen pro Typ, soviel wurde zurückgegeben
|
||||||
uint16_t resint3;
|
uint16_t resint3;
|
||||||
uint16_t resint4;
|
uint16_t resint4;
|
||||||
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
uint16_t currentTubeContent[6]; // nur für Wechsler, aktueller Füllstand
|
||||||
uint16_t resint5;
|
uint16_t resint5;
|
||||||
uint16_t resint6;
|
uint16_t resint6;
|
||||||
// 56
|
// 56
|
||||||
@ -306,6 +306,10 @@ public:
|
|||||||
QString comPort) const = 0;
|
QString comPort) const = 0;
|
||||||
// download binary file down into device controller
|
// download binary file down into device controller
|
||||||
|
|
||||||
|
virtual bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||||
|
int templateNr,
|
||||||
|
QString const &fname) const = 0;
|
||||||
|
|
||||||
virtual void dc_autoRequest(bool on) const =0;
|
virtual void dc_autoRequest(bool on) const =0;
|
||||||
// on = true: select that all READ-Requests are sent automatically
|
// on = true: select that all READ-Requests are sent automatically
|
||||||
// on = false: select that all READ-Requests are sent manually one by one
|
// on = false: select that all READ-Requests are sent manually one by one
|
||||||
@ -321,7 +325,7 @@ public:
|
|||||||
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
// get data back in "payLoad", max 64 byte, can be used for diagnosis
|
||||||
// retval = nr of bytes received. If host buffer too small then
|
// retval = nr of bytes received. If host buffer too small then
|
||||||
// only plBufSiz bytes are copied to "payLoad"
|
// only plBufSiz bytes are copied to "payLoad"
|
||||||
// plBufSizz=size of host buffer
|
// plBufSizz=size of host buffer
|
||||||
|
|
||||||
virtual void dc_requTestResponse() const =0;
|
virtual void dc_requTestResponse() const =0;
|
||||||
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
// tell DC2 to send a test-string, useful to see if cable and baudrate is OK
|
||||||
@ -442,10 +446,10 @@ public:
|
|||||||
|
|
||||||
// Analog values:
|
// Analog values:
|
||||||
virtual uint32_t dc_getTemperature(void) const =0;
|
virtual uint32_t dc_getTemperature(void) const =0;
|
||||||
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
// in Sax-Format 0...400 (0=-50,0°C 100=0,0°C 141=20,5°C 400=150,0°C)
|
||||||
|
|
||||||
virtual QString dc_getTemperaturStr(void) const =0;
|
virtual QString dc_getTemperaturStr(void) const =0;
|
||||||
// as string like "-12,5°C"
|
// as string like "-12,5°C"
|
||||||
|
|
||||||
virtual uint32_t dc_getVoltage(void) const =0;
|
virtual uint32_t dc_getVoltage(void) const =0;
|
||||||
// as value in mV, 0...65,535V
|
// as value in mV, 0...65,535V
|
||||||
@ -600,7 +604,7 @@ public:
|
|||||||
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
uint8_t kindOfModem, uint8_t kindOfCredit ) const =0;
|
||||||
// enable hardware in device controller:
|
// enable hardware in device controller:
|
||||||
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
// kindOfPrinter: 0:off 1: GPT4672 (only this one implemented)
|
||||||
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
// kindOfCoinChecker: 0:off 1:EMP820 2:EMP900 3: C²_changer
|
||||||
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
// kindOfMifareReader: 0:off 1: SL025 (only this one implemented)
|
||||||
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
// suppressSleep: 0:sleep allowed 1: sleep surpressed for special reason
|
||||||
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
// kindOfModem: 0:off 1: ATB_Sunlink_LTE (not yet implemented)
|
||||||
@ -706,7 +710,7 @@ public:
|
|||||||
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
// send 5 byte: byte 0,1: speed 5...250 mm/s
|
||||||
// byte2: density 0....(25)....50
|
// byte2: density 0....(25)....50
|
||||||
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
// byte3: alignment 'l', 'c', 'r' = left, center, right
|
||||||
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
// byte4: orientation 0, 90, 180 = 0°, 90°, 180° rotation (by now not supported!)
|
||||||
// not batched! don't use twice within 100ms
|
// not batched! don't use twice within 100ms
|
||||||
|
|
||||||
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
virtual void prn_movePaper(uint8_t wayInMm, uint8_t direction) const =0;
|
||||||
@ -1274,7 +1278,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Komplett-schreib Funktion, noch nicht getestet
|
// Komplett-schreib Funktion, noch nicht getestet
|
||||||
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
// Nachteil: keine Rückmeldung wie lang's noch dauert
|
||||||
//virtual void bl_startSending(void) const=0;
|
//virtual void bl_startSending(void) const=0;
|
||||||
// call once after BL is working and file is loaded
|
// call once after BL is working and file is loaded
|
||||||
//virtual void bl_sendFile(void) const=0;
|
//virtual void bl_sendFile(void) const=0;
|
||||||
@ -1300,7 +1304,7 @@ public:
|
|||||||
buf[4]=GlobTime.Month;
|
buf[4]=GlobTime.Month;
|
||||||
buf[5]=GlobTime.Day;
|
buf[5]=GlobTime.Day;
|
||||||
buf[6]=GlobTime.DOW;
|
buf[6]=GlobTime.DOW;
|
||||||
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
buf[7]=' '; // immer auf 32bit auffüllen sonst Speicherproblem beim Master!
|
||||||
uitmp=GlobTime.MinOfDay;
|
uitmp=GlobTime.MinOfDay;
|
||||||
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
buf[8]=swl_getOneByteFromUint(uitmp, 0);
|
||||||
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
buf[9]=swl_getOneByteFromUint(uitmp, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user