Index: sources/device/DeviceModels.cpp =================================================================== diff -u -r49b21798fb65ce44a04ae4e771ef7c3c1c119fa6 -r7fb3037f90ac302238f618243a137bee1653ca2b --- sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 49b21798fb65ce44a04ae4e771ef7c3c1c119fa6) +++ sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 7fb3037f90ac302238f618243a137bee1653ca2b) @@ -252,3 +252,33 @@ lOut: return _data.mAccepted; } + +/*! + * \brief MDeviceUSBMountResponse::fromByteArray + * \details Checks the response and sets up the mode data. + * \param vExitCode - Passed script exit code + * \return true if passed. + */ +bool MDeviceUSBMountResponse::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_USBMount_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 USB (un)mount Command Complete."); goto lOut ; // normal return + +lError: + _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; + +lOut: + return _data.mAccepted; +}