Bladeren bron

Release v1.0 mit QML-Plugin.

Rind 5 jaren geleden
bovenliggende
commit
bca13b463a
3 gewijzigde bestanden met toevoegingen van 71 en 65 verwijderingen
  1. 0 5
      main.c
  2. 71 58
      qmlplugin/libgfativaflashplugin/gfativaflash.cpp
  3. 0 2
      qmlplugin/libgfativaflashplugin/gfativaflash.h

+ 0 - 5
main.c

@@ -905,16 +905,11 @@ static void _OnUploadProgress(const char *pszFile, int nLine, LPGFA_BLM_DL_PROGR
 		switch(pdlpp->nCtx)
 		{
 		case GBDPS_Error:
-//#ifdef _DEBUG
-#if 0
-			TRACE1("Error: %s:%d: %s!\n", pszFile, nLine, GfaBlmStrError(pdlpp->nErrorCode));
-#else	//	_DEBUG
 			UNUSED(pszFile);
 			UNUSED(nLine);
 			TRACE1("Error: %s!\n", GfaBlmStrError(pdlpp->nErrorCode));
 			TTRACE1(GfaBlmStrError(pdlpp->nErrorCode));
 			TTRACE(PLUGIN_TAG_UPLOAD_ERROR, "%d", pdlpp->nErrorCode);
-#endif	//	_DEBUG
 			break;
 		case GBDPS_StartEraseFlash:
 			TRACE2("Start download of %u bytes to node 0x%02hhX @ address 0x%X.\n", pdlpp->nCbTotal, pdlpp->nNodeAddr, pdlpp->nFlashStartAddr);

+ 71 - 58
qmlplugin/libgfativaflashplugin/gfativaflash.cpp

@@ -6,26 +6,6 @@
 
 #define _TEST_VERBOSITY(v, n)					(((v) == -1) && ((n) <= 2)) || (((v) >= 0) && ((v) >= (n)))
 
-/////////////////////////////////////////////////////////////////////////////
-#if 0
-static std::string _formatString(const char *fmt, ...)
-{
-	int n;
-	std::string s;
-	char *p = NULL;
-	va_list ap;
-	va_start(ap, fmt);
-	n = ::vasprintf(&p, fmt, ap);
-	va_end(ap);
-	if(n >= 0)
-	{
-		s = p;
-		free(p);
-	}
-	return s;
-}
-#endif
-
 /////////////////////////////////////////////////////////////////////////////
 
 TivaFlash::TivaFlash(QObject *pParent) :	QObject(pParent),
@@ -105,44 +85,6 @@ void TivaFlash::onProcessStateChanged(QProcess::ProcessState newState)
 }
 
 /////////////////////////////////////////////////////////////////////////////
-#if 0
-bool TivaFlash::execFlashUtil(int nSlvID, const char *pszOpt)
-{
-	FILE* pd;
-	char buffer[256];
-	m_nExitCode = -1;
-	std::string strCmd = _formatString("\"%s\" %s --plugin-mode 2>&1", m_tivaFlashUtilPath.c_str(), pszOpt);
-
-	if((pd = popen(strCmd.c_str(), "r")))
-	{
-		while(fgets(buffer, sizeof buffer, pd))
-		{
-			onCmdOutput(nSlvID, buffer);
-		}
-
-		pclose(pd);
-	}
-
-	return m_nExitCode == 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-
-std::string TivaFlash::getSlavIDs(int nSlvID, int nMbID) const
-{
-	std::string ret;
-
-	if(m_slvIdIsNodeAddr)
-		ret = _formatString("--node-addr=%d", nSlvID);
-	else
-		ret = _formatString("--stat-num=%d", nSlvID);
-
-	if(_IS_VALID_MB_ID(nMbID))
-		ret += _formatString(" --mb-slave-id=%d", nMbID);
-
-	return ret;
-}
-#endif
 
 void TivaFlash::getSlavIDs(int nSlvID, int nMbID, QStringList &rargs) const
 {
@@ -419,6 +361,8 @@ void TivaFlash::onCmdOutput(int nSlvID, const char *pszOut)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// command methods
+// getMatSer
 
 bool TivaFlash::getMatSer(int nSlvID, int nMbID)
 {
@@ -441,6 +385,9 @@ bool TivaFlash::getMatSer(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// getTargetImgInfo
+
 bool TivaFlash::getTargetImgInfo(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -471,6 +418,9 @@ bool TivaFlash::getTargetImgInfo(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// getFileImgInfo
+
 bool TivaFlash::getFileImgInfo(void)
 {
 	if(m_bExecuting)
@@ -490,6 +440,9 @@ bool TivaFlash::getFileImgInfo(void)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// pingTarget
+
 bool TivaFlash::pingTarget(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -508,6 +461,9 @@ bool TivaFlash::pingTarget(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// startBootloader
+
 bool TivaFlash::startBootloader(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -526,6 +482,9 @@ bool TivaFlash::startBootloader(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// resetBootloader
+
 bool TivaFlash::resetBootloader(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -544,6 +503,9 @@ bool TivaFlash::resetBootloader(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// validateImgFile
+
 bool TivaFlash::validateImgFile(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -564,6 +526,9 @@ bool TivaFlash::validateImgFile(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// uploadImgFile
+
 bool TivaFlash::uploadImgFile(int nSlvID, int nMbID)
 {
 	if(m_bExecuting)
@@ -588,6 +553,9 @@ bool TivaFlash::uploadImgFile(int nSlvID, int nMbID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// reviveBootloader
+
 bool TivaFlash::reviveBootloader(int nSlvID)
 {
 	if(m_bExecuting)
@@ -606,6 +574,9 @@ bool TivaFlash::reviveBootloader(int nSlvID)
 	return true;
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// clearImgInfo
+
 bool TivaFlash::clearImgInfo(int nSlvID)
 {
 	if(m_bExecuting)
@@ -658,6 +629,8 @@ bool TivaFlash::clearImgInfo(int nSlvID)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// properties
+// tivaFlashUtilPath
 
 QString TivaFlash::tivaFlashUtilPath(void) const
 {
@@ -670,6 +643,7 @@ void TivaFlash::setTivaFlashUtilPath(const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// itfName
 
 QString TivaFlash::itfName(void) const
 {
@@ -682,6 +656,7 @@ void TivaFlash::setItfName(const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// slvIdIsNodeAddr
 
 bool TivaFlash::slvIdIsNodeAddr(void) const
 {
@@ -697,6 +672,7 @@ void TivaFlash::setSlvIdIsNodeAddr(bool val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// verbosity
 
 int TivaFlash::verbosity(void) const
 {
@@ -717,6 +693,7 @@ void TivaFlash::setVerbosity(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgFile
 
 QString TivaFlash::imgFile(void) const
 {
@@ -729,6 +706,7 @@ void TivaFlash::setImgFile(const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// executing
 
 bool TivaFlash::executing(void) const
 {
@@ -745,6 +723,7 @@ void TivaFlash::setExecuting(bool val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// xBaudRate
 
 int TivaFlash::xBaudRate(void) const
 {
@@ -760,6 +739,7 @@ void TivaFlash::setXBaudRate(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// appAddress
 
 int TivaFlash::appAddress(void) const
 {
@@ -775,6 +755,7 @@ void TivaFlash::setAppAddress(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// blockSize
 
 int TivaFlash::blockSize(void) const
 {
@@ -790,6 +771,7 @@ void TivaFlash::setBlockSize(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// pageEraseTime
 
 int TivaFlash::pageEraseTime(void) const
 {
@@ -805,6 +787,7 @@ void TivaFlash::setPageEraseTime(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// mbCtrlRegister
 
 int TivaFlash::mbCtrlRegister(void) const
 {
@@ -820,6 +803,7 @@ void TivaFlash::setMbCtrlRegister(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// forceAllParities
 
 bool TivaFlash::forceAllParities(void) const
 {
@@ -834,6 +818,9 @@ void TivaFlash::setForceAllParities(bool val)
 	}
 }
 
+/////////////////////////////////////////////////////////////////////////////
+// imgUploadStatus
+
 ImgUploadStatus* TivaFlash::imgUploadStatus(void)
 {
 	return &m_imgUpldProg;
@@ -842,6 +829,7 @@ ImgUploadStatus* TivaFlash::imgUploadStatus(void)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// materialEeprom
 
 const QStringList& TivaFlash::materialEeprom(void) const
 {
@@ -858,6 +846,7 @@ void TivaFlash::setMaterialEeprom(int nSlvID, const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// serialEeprom
 
 const QStringList& TivaFlash::serialEeprom(void) const
 {
@@ -876,6 +865,7 @@ void TivaFlash::setSerialEeprom(int nSlvID, const QString &val)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// imgSizeBoot
 
 const QList<int>& TivaFlash::imgSizeBoot(void) const
 {
@@ -892,6 +882,7 @@ void TivaFlash::setImgSizeBoot(int nSlvID, int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgCRC32Boot
 
 const QList<double>& TivaFlash::imgCRC32Boot(void) const
 {
@@ -908,6 +899,7 @@ void TivaFlash::setImgCRC32Boot(int nSlvID, double val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgMaterialBoot
 
 const QStringList& TivaFlash::imgMaterialBoot(void) const
 {
@@ -924,6 +916,7 @@ void TivaFlash::setImgMaterialBoot(int nSlvID, const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgBuildBoot
 
 const QStringList& TivaFlash::imgBuildBoot(void) const
 {
@@ -942,6 +935,7 @@ void TivaFlash::setImgBuildBoot(int nSlvID, const QString &val)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// imgSizeApp
 
 const QList<int>& TivaFlash::imgSizeApp(void) const
 {
@@ -958,6 +952,7 @@ void TivaFlash::setImgSizeApp(int nSlvID, int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgCRC32App
 
 const QList<double>& TivaFlash::imgCRC32App(void) const
 {
@@ -974,6 +969,7 @@ void TivaFlash::setImgCRC32App(int nSlvID, double val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgMaterialApp
 
 const QStringList& TivaFlash::imgMaterialApp(void) const
 {
@@ -990,6 +986,7 @@ void TivaFlash::setImgMaterialApp(int nSlvID, const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgBuildApp
 
 const QStringList& TivaFlash::imgBuildApp(void) const
 {
@@ -1008,6 +1005,7 @@ void TivaFlash::setImgBuildApp(int nSlvID, const QString &val)
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// imgSizeFile
 
 int TivaFlash::imgSizeFile(void) const
 {
@@ -1024,6 +1022,7 @@ void TivaFlash::setImgSizeFile(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgCRC32File
 
 double TivaFlash::imgCRC32File(void) const
 {
@@ -1040,6 +1039,7 @@ void TivaFlash::setImgCRC32File(double val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgMaterialFile
 
 const QString& TivaFlash::imgMaterialFile(void) const
 {
@@ -1056,6 +1056,7 @@ void TivaFlash::setImgMaterialFile(const QString &val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// imgBuildFile
 
 const QString& TivaFlash::imgBuildFile(void) const
 {
@@ -1101,6 +1102,10 @@ void ImgUploadStatus::clear(void)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// properties
+// ctx
 
 int ImgUploadStatus::ctx(void) const
 {
@@ -1117,6 +1122,7 @@ void ImgUploadStatus::setCtx(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// errorCode
 
 int ImgUploadStatus::errorCode(void) const
 {
@@ -1133,6 +1139,7 @@ void ImgUploadStatus::setErrorCode(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// cbBlock
 
 int ImgUploadStatus::cbBlock(void) const
 {
@@ -1149,6 +1156,7 @@ void ImgUploadStatus::setCbBlock(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// blockNr
 
 int ImgUploadStatus::blockNr(void) const
 {
@@ -1165,6 +1173,7 @@ void ImgUploadStatus::SetBlockNr(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// cbTotal
 
 int ImgUploadStatus::cbTotal(void) const
 {
@@ -1181,6 +1190,7 @@ void ImgUploadStatus::setCbTotal(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// cbSent
 
 int ImgUploadStatus::cbSent(void) const
 {
@@ -1197,6 +1207,7 @@ void ImgUploadStatus::setCbSent(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// percentSent
 
 int ImgUploadStatus::percentSent(void) const
 {
@@ -1213,6 +1224,7 @@ void ImgUploadStatus::setPercentSent(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// cntFlashPages
 
 int ImgUploadStatus::cntFlashPages(void) const
 {
@@ -1229,6 +1241,7 @@ void ImgUploadStatus::setCntFlashPages(int val)
 }
 
 /////////////////////////////////////////////////////////////////////////////
+// uploadInProgress
 
 bool ImgUploadStatus::uploadInProgress(void) const
 {

+ 0 - 2
qmlplugin/libgfativaflashplugin/gfativaflash.h

@@ -9,8 +9,6 @@
 #include <QList>
 #include <QStringList>
 #include <QProcess>
-//#include <QQmlListProperty>
-//#include <qqmlparserstatus.h>
 #include "tagnames.h"
 
 #ifdef __cplusplus