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