| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- // gfativaflash.h :
- //
- #if !defined(AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_)
- #define AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_
- #include <string>
- #include <QObject>
- #include <QList>
- #include <QStringList>
- //#include <QQmlListProperty>
- //#include <qqmlparserstatus.h>
- #include "tagnames.h"
- #ifdef __cplusplus
- /////////////////////////////////////////////////////////////////////////////
- // gfativaflash.h - Declarations:
- #define _MAX_SLAVE_COUNT 256
- #define _MB_BROADCAST_ADDRESS 0
- #define _MB_MAX_SLAVE_ID 247
- #define _IS_VALID_SLV_ID(id) (((id) >= 0) && ((id) < _MAX_SLAVE_COUNT))
- #define _IS_VALID_MB_ID(id) (((id) != _MB_BROADCAST_ADDRESS) && ((id) <= _MB_MAX_SLAVE_ID))
- /////////////////////////////////////////////////////////////////////////////
- class TivaFlash : public QObject
- {
- Q_OBJECT
- Q_PROPERTY(QString tivaFlashUtilPath READ tivaFlashUtilPath WRITE setTivaFlashUtilPath)
- Q_PROPERTY(QString itfName READ itfName WRITE setItfName)
- Q_PROPERTY(bool slvIdIsNodeAddr READ slvIdIsNodeAddr WRITE setSlvIdIsNodeAddr)
- Q_PROPERTY(int verbosity READ verbosity WRITE setVerbosity NOTIFY verbosityChanged)
- Q_PROPERTY(QString imgFile READ imgFile WRITE setImgFile)
- Q_PROPERTY(QStringList materialEeprom READ materialEeprom NOTIFY materialEepromChanged)
- Q_PROPERTY(QStringList serialEeprom READ serialEeprom NOTIFY serialEepromChanged)
- Q_PROPERTY(QStringList imgMaterialBoot READ imgMaterialBoot NOTIFY imgMaterialBootChanged)
- Q_PROPERTY(QStringList imgBuildBoot READ imgBuildBoot NOTIFY imgBuildBootChanged)
- Q_PROPERTY(QList<int> imgSizeBoot READ imgSizeBoot NOTIFY imgSizeBootChanged)
- Q_PROPERTY(QList<double> imgCRC32Boot READ imgCRC32Boot NOTIFY imgCRC32BootChanged)
- Q_PROPERTY(QStringList imgMaterialApp READ imgMaterialApp NOTIFY imgMaterialAppChanged)
- Q_PROPERTY(QStringList imgBuildApp READ imgBuildApp NOTIFY imgBuildAppChanged)
- Q_PROPERTY(QList<int> imgSizeApp READ imgSizeApp NOTIFY imgSizeAppChanged)
- Q_PROPERTY(QList<double> imgCRC32App READ imgCRC32App NOTIFY imgCRC32AppChanged)
- Q_PROPERTY(QString imgMaterialFile READ imgMaterialFile NOTIFY materialFileChanged)
- Q_PROPERTY(QString imgBuildFile READ imgBuildFile NOTIFY imgBuildFileChanged)
- Q_PROPERTY(int imgSizeFile READ imgSizeFile NOTIFY imgSizeFileChanged)
- Q_PROPERTY(double imgCRC32File READ imgCRC32File NOTIFY imgCRC32FileChanged)
- public:
- explicit TivaFlash(QObject *pParent = NULL);
- virtual ~TivaFlash(void);
- public:
- Q_INVOKABLE bool getMatSer(int nSlvID, int nMbID = 0);
- Q_INVOKABLE bool getTargetImgInfo(int nSlvID, int nMbID = 0);
- Q_INVOKABLE bool pingTarget(int nSlvID, int nMbID = 0);
- Q_INVOKABLE bool startBootloader(int nSlvID, int nMbID = 0);
- Q_INVOKABLE bool resetBootloader(int nSlvID, int nMbID = 0);
- Q_INVOKABLE bool validateImgFile(int nSlvID, int nMbID = 0);
- signals:
- void execOut(int slv, int ctx, QString msg) const;
- void verbosityChanged(int val) const;
- void materialEepromChanged(void) const;
- void serialEepromChanged(void) const;
- void imgSizeBootChanged(void) const;
- void imgCRC32BootChanged(void) const;
- void imgMaterialBootChanged(void) const;
- void imgBuildBootChanged(void) const;
- void imgSizeAppChanged(void) const;
- void imgCRC32AppChanged(void) const;
- void imgMaterialAppChanged(void) const;
- void imgBuildAppChanged(void) const;
- void materialFileChanged(const QString &val) const;
- void imgBuildFileChanged(const QString &val) const;
- void imgSizeFileChanged(int val) const;
- void imgCRC32FileChanged(double val) const;
- private:
- QString tivaFlashUtilPath(void) const;
- void setTivaFlashUtilPath(const QString &val);
- QString itfName(void) const;
- void setItfName(const QString &val);
- bool slvIdIsNodeAddr(void) const;
- void setSlvIdIsNodeAddr(bool val);
- int verbosity(void) const;
- void setVerbosity(int val);
- QString imgFile(void) const;
- void setImgFile(const QString &val);
- const QStringList& materialEeprom(void) const;
- void setMaterialEeprom(int nSlvID, const QString &val);
- const QStringList& serialEeprom(void) const;
- void setSerialEeprom(int nSlvID, const QString &val);
- const QList<int>& imgSizeBoot(void) const;
- void setImgSizeBoot(int nSlvID, int val);
- const QList<double>& imgCRC32Boot(void) const;
- void setImgCRC32Boot(int nSlvID, double val);
- const QStringList& imgMaterialBoot(void) const;
- void setImgMaterialBoot(int nSlvID, const QString &val);
- const QStringList& imgBuildBoot(void) const;
- void setImgBuildBoot(int nSlvID, const QString &val);
- const QList<int>& imgSizeApp(void) const;
- void setImgSizeApp(int nSlvID, int val);
- const QList<double>& imgCRC32App(void) const;
- void setImgCRC32App(int nSlvID, double val);
- const QStringList& imgMaterialApp(void) const;
- void setImgMaterialApp(int nSlvID, const QString &val);
- const QStringList& imgBuildApp(void) const;
- void setImgBuildApp(int nSlvID, const QString &val);
- int imgSizeFile(void) const;
- void setImgSizeFile(int val);
- double imgCRC32File(void) const;
- void setImgCRC32File(double val);
- const QString& imgMaterialFile(void) const;
- void setImgMaterialFile(const QString &val);
- const QString& imgBuildFile(void) const;
- void setImgBuildFile(const QString &val);
-
- private:
- bool execFlashUtil(int nSlvID, const char *pszOpt);
- void onCmdOutput(int nSlvID, const char *pszOut);
- std::string getSlavIDs(int nSlvID, int nMbID) const;
- int parseTaggedString(const char *pszIn, std::string &sOut) const;
- private:
- int m_nExitCode;
- std::string m_tivaFlashUtilPath;
- std::string m_itfName;
- bool m_slvIdIsNodeAddr;
- int m_verbosity;
- std::string m_imgFile;
- QStringList m_materialEeprom;
- QStringList m_serialEeprom;
- QList<int> m_imgSizeBoot;
- QList<double> m_imgCRC32Boot;
- QStringList m_imgMaterialBoot;
- QStringList m_imgBuildBoot;
- QList<int> m_imgSizeApp;
- QList<double> m_imgCRC32App;
- QStringList m_imgMaterialApp;
- QStringList m_imgBuildApp;
- int m_imgSizeFile;
- double m_imgCRC32File;
- QString m_imgMaterialFile;
- QString m_imgBuildFile;
- };
- /////////////////////////////////////////////////////////////////////////////
- #endif // __cplusplus
- #endif // !defined(AGD_GFATIVAFLASH_H__49F09E25_28B7_4178_B4B6_6DAFF98ABECD__INCLUDED_)
|