Compare commits
No commits in common. "ef48301dad80ebce3db4764613bb7f183ef69485" and "37f0012ce9092b4152481264747500d91f5c160e" have entirely different histories.
ef48301dad
...
37f0012ce9
@ -144,10 +144,6 @@ public:
|
|||||||
bool dc_updateDC(QString binFileName, QString baudrate,
|
bool dc_updateDC(QString binFileName, QString baudrate,
|
||||||
QString comPort) const override;
|
QString comPort) const override;
|
||||||
|
|
||||||
bool dc_updatePrinterTemplate(enum FileTypeJson type,
|
|
||||||
int templateNr,
|
|
||||||
QString const &fname) const override;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Level 1, control device-controller (functions of µC)
|
// Level 1, control device-controller (functions of µC)
|
||||||
// check serial connection to deviceController
|
// check serial connection to deviceController
|
||||||
|
@ -306,10 +306,6 @@ 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
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
#include "tslib.h"
|
#include "tslib.h"
|
||||||
#include "hwapi.h"
|
#include "hwapi.h"
|
||||||
|
|
||||||
@ -406,40 +404,6 @@ bool hwapi::dc_updateDC(QString bFile, QString br, QString serial) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
//
|
|
||||||
// LEVEL 3: hwapi::dc_updatePrinterTemplate
|
|
||||||
//
|
|
||||||
/******************************************************************************/
|
|
||||||
bool hwapi::dc_updatePrinterTemplate(enum FileTypeJson type,
|
|
||||||
int nrOfTemplate,
|
|
||||||
QString const &fname) const {
|
|
||||||
if ((type == FileTypeJson::PRINTER) &&
|
|
||||||
(nrOfTemplate >= 0 && nrOfTemplate <= 32)) {
|
|
||||||
|
|
||||||
int nTry = 50;
|
|
||||||
while (!sys_ready4sending()) { // wait max. 5 seconds
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
||||||
if (--nTry <= 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QFile file(fname);
|
|
||||||
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
|
||||||
QByteArray ba = file.readAll();
|
|
||||||
if (ba.size() <= 800) { // max. size is 800 bytes
|
|
||||||
if (sys_sendJsonFileToDc((uint8_t)(type),
|
|
||||||
nrOfTemplate,
|
|
||||||
(uint8_t *)ba.data())) {
|
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Level 1, control device-controller (functions of µC)
|
// Level 1, control device-controller (functions of µC)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user