Read dc-firmware-version: filter return value (null-character)
This commit is contained in:
		@@ -103,7 +103,7 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
 | 
			
		||||
    hw->vend_failed();
 | 
			
		||||
 | 
			
		||||
    // read sw-version and store it in persistentData, if changed
 | 
			
		||||
    QString dc_fw_version = hw->dc_getSWversion();
 | 
			
		||||
    QString dc_fw_version = hw->dc_getSWversion().remove(QChar('\0'));
 | 
			
		||||
    qCritical() << "ATBDeviceControllerPlugin: DC firmware version: " << dc_fw_version;
 | 
			
		||||
    this->persistentData->setDCFirmwareVersion(dc_fw_version);
 | 
			
		||||
    this->persistentData->serializeToFile();
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,11 @@ void DeviceControllerDiag::diagRequest()
 | 
			
		||||
    this->private_startDiag();
 | 
			
		||||
 | 
			
		||||
    // read dc-fw-version:
 | 
			
		||||
    QString dc_fw_version = hw->dc_getSWversion();
 | 
			
		||||
    /* note: dc_getSWVersion() returns always 32 characters (QString)...
 | 
			
		||||
     * if no version string could be read it will contain 32 null-characters:
 | 
			
		||||
     * "\u0000\u0000..."
 | 
			
		||||
     */
 | 
			
		||||
    QString dc_fw_version = hw->dc_getSWversion().remove(QChar('\0'));
 | 
			
		||||
    qCritical() << "ATBDeviceControllerPlugin: DC firmware version: " << dc_fw_version;
 | 
			
		||||
    this->pData->setDCFirmwareVersion(dc_fw_version);
 | 
			
		||||
    this->pData->serializeToFile();
 | 
			
		||||
 
 | 
			
		||||
@@ -125,6 +125,9 @@ QList<QString> PersistentData::uniqueKeys() const {
 | 
			
		||||
 | 
			
		||||
void PersistentData::setDCFirmwareVersion(const QString & fw_version)
 | 
			
		||||
{
 | 
			
		||||
    // there must be a version string!
 | 
			
		||||
    if (fw_version.size() < 1) return;
 | 
			
		||||
 | 
			
		||||
    if (this->hash["dc_fw_version"].toString() != fw_version) {
 | 
			
		||||
        this->isChangedFlag = true;
 | 
			
		||||
        this->hash.insert("dc_fw_version", fw_version);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user