Index: sources/device/DeviceModels.cpp =================================================================== diff -u -r59625af31d9009df82fa48310b54c0f247e829fc -rfcdb1dfa21f3d5c02e549089c19ab7d57b19040c --- sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 59625af31d9009df82fa48310b54c0f247e829fc) +++ sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision fcdb1dfa21f3d5c02e549089c19ab7d57b19040c) @@ -314,3 +314,33 @@ lOut: return _data.mAccepted; } + +/*! + * \brief MDeviceFinalizeSoftwareUpdateResponse::fromByteArray + * \details Checks the response and sets up the mode data. + * \param vExitCode - Passed script exit code + * \return true if passed. + */ +bool MDeviceFinalizeSoftwareUpdateResponse::fromByteArray(const QByteArray &vByteArray, int *vExitCode) +{ + // initialize data + int error = 0; + _data.mAccepted = false; + + // check if the vExitCode passed and it has a value other than zero + if ( vExitCode && *vExitCode ){ _data.mReason = Device::DeviceError::eDevice_FinalizeSoftwareUpdate_Error; error = *vExitCode; } + else _data.mReason = Device::DeviceError::eDevice_OK; + + // if vExitCode is not zero go to error since the data is no longer valid + if ( _data.mReason ) goto lError; // non-zero Exit code + + // Now everything is good to extract the data + _data.mAccepted = true; + _data.mMessage = QObject::tr("The Finalize Software Update Command Complete."); goto lOut ; // normal return + +lError: + _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; + +lOut: + return _data.mAccepted; +}