test implementation

This commit is contained in:
Gerhard Hoffmann 2023-04-13 16:22:46 +02:00
parent f114570a8c
commit ead91eaba0

View File

@ -31,11 +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
int nrOfTemplate, QVector<int> nrOfTemplate,
char const *fileToSendToDC) { QVector<QString> fileToSendToDC,
QString br, QString serial) {
for (int i=0; i < 1;++i) { for (int i=0; i < 1;++i) {
hw->dc_updatePrinterTemplate(hwapi::FileTypeJson::PRINTER, hw->dc_updatePrinterTemplate(hwapi::FileTypeJson::PRINTER,
nrOfTemplate, fileToSendToDC); nrOfTemplate, fileToSendToDC,
br, serial);
hw->dc_printTemplate(hwapi::FileTypeJson::PRINTER,
nrOfTemplate, br, serial);
} }
QCoreApplication::quit(); QCoreApplication::quit();
} }
@ -65,13 +70,18 @@ int main(int argc, char *argv[]) {
fname.toStdString().c_str(), "115200", SERIAL_PORT); fname.toStdString().c_str(), "115200", SERIAL_PORT);
ret = a.exec(); ret = a.exec();
t.join(); t.join();
} else } else {
if (fname.startsWith("DC2C_print") && fname.endsWith(".json")) { QVector<QString> fnames{"DC2C_print01.json",
std::thread t(updatePrinterConf, std::move(hw), "DC2C_print02.json",
fname.midRef(10, 2).toInt(), "DC2C_print03.json"};
fname.toStdString().c_str()); 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(); ret = a.exec();
t.join(); t.join();
//}
} }
return ret; return ret;