Merge commit 'ff5e3f15a47f165005e691a88cbe1fa44a84fe0d'
Use a defualt parameter for printer functions to decide if serial device has to be opened or not.
This commit is contained in:
commit
04dfc407c0
@ -148,12 +148,12 @@ public:
|
||||
QVector<int> templateIdx,
|
||||
QVector<QString> fnames,
|
||||
QString br,
|
||||
QString serial) const override;
|
||||
QString serial = QString()) const override;
|
||||
|
||||
bool dc_printTemplate(enum FileTypeJson type,
|
||||
QVector<int> templateIdx,
|
||||
QString br,
|
||||
QString serial) const override;
|
||||
QString serial = QString()) const override;
|
||||
// ------------------------------------------------------------------------------
|
||||
// Level 1, control device-controller (functions of µC)
|
||||
// check serial connection to deviceController
|
||||
|
@ -310,12 +310,12 @@ public:
|
||||
QVector<int> templateIdx,
|
||||
QVector<QString> fnames,
|
||||
QString br,
|
||||
QString serial) const = 0;
|
||||
QString serial = QString()) const = 0;
|
||||
|
||||
virtual bool dc_printTemplate(enum FileTypeJson type,
|
||||
QVector<int> templateIdx,
|
||||
QString br,
|
||||
QString serial) const = 0;
|
||||
QString serial = QString()) const = 0;
|
||||
|
||||
virtual void dc_autoRequest(bool on) const =0;
|
||||
// on = true: select that all READ-Requests are sent automatically
|
||||
|
@ -438,16 +438,20 @@ bool hwapi::dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||
|
||||
qDebug() << "updating: " << fnames << br << serial << "...";
|
||||
|
||||
if (!serial.isNull()) {
|
||||
if (!openSerial(baudrateMap.value(br), br, serial)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int nTry = 50;
|
||||
while (!sys_ready4sending()) { // wait max. 5 seconds
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
if (--nTry <= 0) {
|
||||
qCritical() << "sys not ready for sending";
|
||||
if (!serial.isNull()) {
|
||||
closeSerial(serial);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -471,7 +475,9 @@ bool hwapi::dc_updatePrinterTemplate(enum FileTypeJson type,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!serial.isNull()) {
|
||||
closeSerial(serial);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -496,16 +502,20 @@ bool hwapi::dc_printTemplate(enum FileTypeJson type,
|
||||
|
||||
qDebug() << "printing: " << templateIdx << br << serial << "...";
|
||||
|
||||
if (!serial.isNull()) {
|
||||
if (!openSerial(baudrateMap.value(br), br, serial)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int nTry = 50;
|
||||
while (!sys_ready4sending()) { // wait max. 5 seconds
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
if (--nTry <= 0) {
|
||||
qCritical() << "sys not ready for sending";
|
||||
if (!serial.isNull()) {
|
||||
closeSerial(serial);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -520,7 +530,9 @@ bool hwapi::dc_printTemplate(enum FileTypeJson type,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!serial.isNull()) {
|
||||
closeSerial(serial);
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user