Adding methods for downloading DC2C_cash/conf/device.json

This commit is contained in:
Gerhard Hoffmann 2023-06-22 15:20:21 +02:00
parent e420f95eb0
commit f66ae498ce

View File

@ -33,10 +33,6 @@ class Update : public QObject {
bool m_init; bool m_init;
bool updateBinary(char const *fileToSendToDC);
bool updatePrinterConf(int templateIdx, QString fileToSendToDC);
bool updateConf(QString fileToSendToDC);
bool updateCashConf(QString fileToSendToDC);
bool finishUpdate(bool finish); bool finishUpdate(bool finish);
QStringList getLinesToWorkOn(); QStringList getLinesToWorkOn();
QStringList split(QString line, QChar sep = ','); QStringList split(QString line, QChar sep = ',');
@ -45,7 +41,7 @@ class Update : public QObject {
public: public:
enum class DownloadResult {OK, ERROR, TIMEOUT, NOP}; enum class DownloadResult {OK, ERROR, TIMEOUT, NOP};
enum class FileTypeJson {CONFIG=1, DEVICE, CASH, SERIAL, TIME, PRINTER}; enum class FileTypeJson {CONFIG=1, DEVICE=2, CASH=3, SERIAL=4, TIME=5, PRINTER=6};
static hwinf *loadDCPlugin(QDir const &plugInDir, QString const &fn); static hwinf *loadDCPlugin(QDir const &plugInDir, QString const &fn);
@ -61,6 +57,8 @@ public:
bool doUpdate(); bool doUpdate();
private: private:
static QString jsonType(enum FileTypeJson type);
DownloadResult sendStatus(int ret) const; DownloadResult sendStatus(int ret) const;
DownloadResult sendNextAddress(int bNum) const; DownloadResult sendNextAddress(int bNum) const;
DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const; DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const;
@ -74,7 +72,12 @@ private:
QByteArray loadBinaryDCFile(QString filename) const; QByteArray loadBinaryDCFile(QString filename) const;
bool downloadBinaryToDC(QString const &bFile) const; bool downloadBinaryToDC(QString const &bFile) const;
bool updateDC(QString bFile) const; bool updateDC(QString bFile) const;
bool updatePrinterTemplate(enum FileTypeJson type, int templateIdx, bool updatePrinterTemplate(int templateIdx, QString fname) const;
QString fname) const; bool updateBinary(char const *fileToSendToDC);
bool updateConfig(QString jsFileToSendToDC);
bool updateCashConf(QString jsFileToSendToDC);
bool updateDeviceConf(QString jsFileToSendToDC);
bool downloadJson(enum FileTypeJson type, int templateIdx,
QString jsFileToSendToDC) const;
}; };
#endif // UPDATE_H_INCLUDED #endif // UPDATE_H_INCLUDED