Index: sources/device/DeviceModels.cpp =================================================================== diff -u -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 -r0932b2beee9cc169291cbf69161f902f805237b1 --- sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) +++ sources/device/DeviceModels.cpp (.../DeviceModels.cpp) (revision 0932b2beee9cc169291cbf69161f902f805237b1) @@ -23,7 +23,7 @@ /*! * \brief MDeviceBluetoothPairedResetResponse::fromByteArray - * \details Checks the response and sets up the mode data. + * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code * \return true if passed. */ @@ -53,7 +53,7 @@ /*! * \brief MDeviceCryptSetupResponse::fromByteArray - * \details Checks the response and sets up the mode data. + * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code * \return true if passed. */ @@ -194,7 +194,7 @@ /*! * \brief MDeviceFactoryResetResponse::fromByteArray - * \details Checks the response and sets up the mode data. + * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code * \return true if passed. */ @@ -225,7 +225,7 @@ /*! * \brief MDeviceDecommissionResponse::fromByteArray - * \details Checks the response and sets up the mode data. + * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code * \return true if passed. */ @@ -254,8 +254,44 @@ } /*! + * \brief MDeviceWifiListResponse::fromByteArray + * \details Checks the response and sets up the model data. + * \param vExitCode - Passed script exit code + * \return true if passed. + */ +bool MDeviceWifiListResponse::fromByteArray(const QByteArray &vByteArray, int *vExitCode) +{ + //DEBUG + qDebug() << __FUNCTION__ << vByteArray; + + // 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_WifiList_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.mWifiList = vByteArray; + _data.mMessage = QObject::tr("The Wifi list scan Complete."); goto lOut ; // normal return + +lError: + _data.mMessage = Device::DeviceError::deviceErrorText(static_cast(_data.mReason), error) + "\n" + vByteArray; + +lOut: + + _data.mCompleted= true; + return _data.mAccepted; +} + +/*! * \brief MDeviceUSBMountResponse::fromByteArray - * \details Checks the response and sets up the mode data. + * \details Checks the response and sets up the model data. * \param vExitCode - Passed script exit code * \return true if passed. */