From e7723f669f1730bf52e73e08e6226b2da66b469a Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 5 Apr 2023 14:08:16 +0200 Subject: [PATCH] Added internal helpers for supporting dcUpdate: DownloadResult sendNextAddress(int bNum) const; DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const; DownloadResult sendStatus(int ret) const; DownloadResult dc_downloadBinary(QByteArray const &binary) const; bool startBootloader() const; bool stopBootloader() const; bool openSerial(int br, QString baudrate, QString comPort) const; bool closeSerial(QString comport) const; bool resetDeviceController() const; QByteArray loadBinaryDCFile(QString filename) const; bool downloadBinaryToDC(QString const &bFile) const; Redeclared returning "bool": dc_openSerial dc_closeSerial bl_checkDL. Added dc_updateDC(...). --- include/hwapi.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/include/hwapi.h b/include/hwapi.h index 04c1331..f904e5d 100644 --- a/include/hwapi.h +++ b/include/hwapi.h @@ -165,12 +165,23 @@ class hwapi : public QObject, Q_PLUGIN_METADATA(IID "Atb.Psa2020.software.HWapi/1.0" ) //FILE "HWapi.json") Q_INTERFACES(hwinf) + DownloadResult sendNextAddress(int bNum) const; + DownloadResult sendNextDataBlock(QByteArray const &b, int bNum) const; + DownloadResult sendStatus(int ret) const; + DownloadResult dc_downloadBinary(QByteArray const &binary) const; + + bool startBootloader() const; + bool stopBootloader() const; + bool openSerial(int br, QString baudrate, QString comPort) const; + bool closeSerial(QString comport) const; + bool resetDeviceController() const; + QByteArray loadBinaryDCFile(QString filename) const; + bool downloadBinaryToDC(QString const &bFile) const; public: explicit hwapi(QWidget *parent = nullptr); T_datif *myDatif; - // ------------------------------------------------------------------------------ // Level 0 commands, interface // open, close, change serial interface @@ -178,13 +189,13 @@ public: // start automatic READ requests // ------------------------------------------------------------------------------ - void dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const override; + bool dc_openSerial(int BaudNr, QString BaudStr, QString ComName, uint8_t connect) const override; // BaudNr: 0:1200 1:9600 2:19200 3:38400 4:57600 5:115200 // BaudStr: for exapmle "19200" // ComName: for example "COM48" // connect: 0, 1 - void dc_closeSerial(void) const override; + bool dc_closeSerial(void) const override; bool dc_isPortOpen(void) const override ; @@ -192,7 +203,8 @@ public: // select if READ-Requests are sent manually one by one or automatically // automatically request ALL digital and analog sensors, get time/date, get status information - + bool dc_updateDC(QString binFileName, QString baudrate, + QString comPort) const override; // ------------------------------------------------------------------------------ // Level 1, control device-controller (functions of µC) @@ -246,15 +258,6 @@ public: QString dc_getState(void) const override; - - - - - - - - - // neu, 25.8.21 QString dc_getTxt4RsDiagWin(void) const override; void dc_clrTxt4RsDiagWin(void) const override; @@ -975,7 +978,7 @@ public: void bl_rebootDC(void) const override; void bl_startBL(void) const override; - void bl_checkBL(void) const override; + bool bl_checkBL(void) const override; bool bl_isUp(void) const override; // return true is bl is up and running // also initializes "sendFile"