Added some debug output.
Send only one DC_print-template. Tested again downloading dc-firmware and printer-templates.
This commit is contained in:
parent
8d325c20eb
commit
18e4811d57
52
main.cpp
52
main.cpp
@ -25,6 +25,9 @@ static void updateBinary(std::unique_ptr<hwinf> hw, // update d2dc*.bin
|
||||
char const *baudrate,
|
||||
char const *serialInterface) {
|
||||
for (int i=0; i < 1;++i) {
|
||||
qDebug() << "file to send to DC ..." << fileToSendToDC;
|
||||
qDebug() << "baudrate ............." << baudrate;
|
||||
qDebug() << "serial interface ....." << serialInterface;
|
||||
hw->dc_updateDC(fileToSendToDC, baudrate, serialInterface);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||
}
|
||||
@ -35,13 +38,14 @@ static void updatePrinterConf(std::unique_ptr<hwinf> hw, // update printer-file
|
||||
QVector<int> nrOfTemplate,
|
||||
QVector<QString> fileToSendToDC,
|
||||
QString br, QString serial) {
|
||||
for (int i=0; i < 1;++i) {
|
||||
//hw->dc_updatePrinterTemplate(hwapi::FileTypeJson::PRINTER,
|
||||
// nrOfTemplate, fileToSendToDC,
|
||||
// br, serial);
|
||||
// for (int i = 0; i < 1; ++i) {
|
||||
if (nrOfTemplate.size() == 1 && fileToSendToDC.size() == 1) {
|
||||
hw->dc_updatePrinterTemplate(hwapi::FileTypeJson::PRINTER,
|
||||
nrOfTemplate, fileToSendToDC,
|
||||
br, serial);
|
||||
|
||||
hw->dc_printTemplate(hwapi::FileTypeJson::PRINTER,
|
||||
nrOfTemplate, br, serial);
|
||||
// hw->dc_printTemplate(hwapi::FileTypeJson::PRINTER,
|
||||
// nrOfTemplate, br, serial);
|
||||
}
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
@ -56,7 +60,7 @@ int main(int argc, char *argv[]) {
|
||||
//setDebugLevel(QtMsgType::QtDebugMsg);
|
||||
}
|
||||
|
||||
if (argc > 2) {
|
||||
if (argc != 2) {
|
||||
qCritical() << "Usage: " << argv[0] << "<file to send to dc>";
|
||||
return -1;
|
||||
}
|
||||
@ -72,17 +76,29 @@ int main(int argc, char *argv[]) {
|
||||
ret = a.exec();
|
||||
t.join();
|
||||
} else {
|
||||
QVector<QString> fnames{"DC2C_print01.json",
|
||||
"DC2C_print02.json",
|
||||
"DC2C_print03.json"};
|
||||
QVector<int> templateIdx{1,2,3};
|
||||
//if (fname.startsWith("DC2C_print") && fname.endsWith(".json")) {
|
||||
//int const nrOfTemplate = fname.midRef(10, 2).toInt();
|
||||
std::thread t(updatePrinterConf, std::move(hw), templateIdx, fnames,
|
||||
"115200", SERIAL_PORT);
|
||||
ret = a.exec();
|
||||
t.join();
|
||||
//}
|
||||
if (fname.startsWith("DC2C_print") && fname.endsWith(".json")) {
|
||||
qDebug() << "downloading" << fname << "to dc...";
|
||||
|
||||
QVector<QString> fnames;
|
||||
QVector<int> templateIdx;
|
||||
|
||||
int const nrOfTemplate = fname.midRef(10, 2).toInt();
|
||||
if (nrOfTemplate <= 0 && nrOfTemplate > 32) {
|
||||
qCritical() << "wrong template number" << nrOfTemplate;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fnames.append(fname);
|
||||
templateIdx.append(nrOfTemplate);
|
||||
|
||||
std::thread t(updatePrinterConf, std::move(hw),
|
||||
templateIdx,
|
||||
fnames,
|
||||
"115200", SERIAL_PORT);
|
||||
|
||||
ret = a.exec();
|
||||
t.join();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user