/*! * * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file DeviceView.cpp * \author (last) Behrouz NematiPour * \date (last) 11-Nov-2021 * \author (original) Behrouz NematiPour * \date (original) 03-Jun-2021 * */ #include "DeviceView.h" // Qt // Project #include "ApplicationController.h" #include "GuiController.h" #include "GuiGlobals.h" VIEW_DEF_CLASS(VDevice) void VDevice::initConnections() { DEVICE_VIEW_INIT_CONNECTIONS_LIST } // developer implementation section void VDevice::doInitBrightness() { // DEBUG : qDebug() << "HERE Request" << vValue; DeviceBrightnessRequestData data; data.mRead = true; emit didAttributeRequest(data); } void VDevice::brightnessRequest(const quint8 &vValue) { // DEBUG : qDebug() << "HERE Request" << vValue; DeviceBrightnessRequestData data; data.mBrightnessPercent = vValue; emit didAttributeRequest(data); } void VDevice::onAttributeResponse(const DeviceBrightnessResponseData &vData) { // DEBUG : qDebug() << "HERE Response" << vData.mBrightnessPercent; if ( vData.mAccepted ) { brightness(vData.mBrightnessPercent); status(""); } else { // this has to be called to let Gui to set to old value that device controller provided. emit brightnessChanged(vData.mBrightnessPercent); status(vData.mMessage); } accepted(vData.mAccepted); reason (vData.mReason ); // has to be the last one response(true); } void VDevice::doInitBluetoothPairedReset() { // DEBUG : qDebug() << "HERE Init"; DeviceBluetoothPairedResetRequestData data; emit didAttributeRequest(data); } void VDevice::bluetoothPairedResetRequest(const quint8 &) { // DEBUG : qDebug() << "HERE Request"; // Nothing to be done here. This property will not be assigned. } void VDevice::onAttributeResponse(const DeviceBluetoothPairedResetResponseData &vData) { // DEBUG : qDebug() << "HERE Response" << vData.mAccepted << vData.mReason << vData.mMessage; // this has to be called to let Gui to set to old value that device controller provided. status(vData.mMessage); accepted(vData.mAccepted); reason (vData.mReason ); // has to be the last one emit bluetoothPairedResetChanged(vData.mReason); response(true); } void VDevice::doInitBluetoothPairedQuery() { // DEBUG : qDebug() << "HERE Init"; DeviceBluetoothPairedQueryRequestData data; emit didAttributeRequest(data); } void VDevice::bluetoothPairedQueryRequest(const QStringList &) { // DEBUG : qDebug() << "HERE Request"; // Nothing to be done here. This property will not be assigned. } void VDevice::onAttributeResponse(const DeviceBluetoothPairedQueryResponseData &vData) { // DEBUG : qDebug() << "HERE Response" << vData.mAccepted << vData.mReason << vData.mMessage; // this has to be called to let Gui to set to old value that device controller provided. status(vData.mMessage); accepted(vData.mAccepted); reason (vData.mReason ); // has to be the last one emit bluetoothPairedQueryChanged(vData.mInfo); response(true); }