Index: sources/device/DeviceController.cpp =================================================================== diff -u -re60d099fd4fbada632a974b9fc95d4d2c9652b1a -rb7c9de054c6b7a1ca4bac9fbb0ec5d4ac06620a9 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision e60d099fd4fbada632a974b9fc95d4d2c9652b1a) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision b7c9de054c6b7a1ca4bac9fbb0ec5d4ac06620a9) @@ -497,7 +497,7 @@ * 3 - get no error when in onProcessBrightnessExitCode : MDeviceResponse.toString() * - in case 3 the specific model _data has to be filled prior to the toString to have it in the log. */ -void DeviceController::onProcessBrightnessExitCode(int vExitCode) +void DeviceController::onProcessBrightnessExitCode(int vExitCode, QProcess::ExitStatus) { _deviceBrightnessResponse._data.mBrightnessPercent = _deviceBrightnessRequest._data.mBrightness_old * 10; // set to old value in case of error if ( ! checkError(static_cast(vExitCode), _deviceBrightnessResponse, _deviceBrightnessResponse.toString()) ) { // has no error @@ -521,6 +521,37 @@ } } +void DeviceController::onAttributeRequest(const DeviceBluetoothPairedResetRequestData &) +{ + // ----- check that script exists. + QString script; + if ( checkError( DeviceError::checkScript(script, Bluetooth_Paired_Reset), _deviceBluetoothPairedResetResponse, script) ) + return; + + // ----- check if the process is not running + if ( _processBluetoothPairedReset.state() != QProcess::NotRunning ) { + checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceBluetoothPairedResetResponse); + return; + } + + // ----- run the process + TimedProcess *timedProcess = new TimedProcess(&_processBluetoothPairedReset, script, 2000); + timedProcess->start(); +} + +void DeviceController::onProcessBluetoothPairedResetExitCode(int vExitCode, QProcess::ExitStatus vStatus) +{ + DeviceBluetoothPairedResetResponseData data; + data.mAccepted = vStatus == QProcess::NormalExit; + data.mReason = vExitCode; + QString msg; + if (data.mAccepted) msg = tr("Removed previously paired devices."); + else msg = tr("Unsuccessful removal of previously paired devices."); + data.mMessage = msg; + didAttributeResponse(data); + LOG_DEBUG(msg); +} + /*! * \brief DeviceController::doScreenshot * \details emit the screenshot signal to run that in Device controller thread