/*! * * Copyright (c) 2021-2025 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.h * \author (last) Behrouz NematiPour * \date (last) 10-Sep-2023 * \author (original) Behrouz NematiPour * \date (original) 03-Jun-2021 * */ #pragma once // Qt #include // Project #include "main.h" // Doxygen : do not remove #include "VView.h" #include "DeviceGlobals.h" #include "DeviceModels.h" // define // namespace namespace View { /*! * \brief The VDevice class * \details The device view to interact with the UI. * */ class VDevice : public QObject { Q_OBJECT TRIGGER ( bool , response , true) PROPERTY ( bool , accepted , 0) TRIGGER ( quint32 , reason , 0) PROPERTY ( QString , status , "") PROPERTY ( QString , osVersion , "") ATTRIBUTE ( quint8 , brightness , 0, Brightness ) ATTRIBUTE ( quint8 , bluetoothPairedReset, 0, BluetoothPairedReset ) ATTRIBUTE ( QStringList , bluetoothPairedQuery, {}, BluetoothPairedQuery ) ATTRIBUTE ( QString , cryptSetup , "", CryptSetup ) PROPERTY ( bool , cryptSetupEnabled , true ) ATTRIBUTE ( Qt::CheckState, rootSSHAccess , Qt::Unchecked , RootSSHAccess ) ATTRIBUTE ( QString , factoryReset , "", FactoryReset ) PROPERTY ( bool , factoryResetEnabled , true ) ATTRIBUTE ( QString , decommission , "", Decommission ) PROPERTY ( bool , decommissionEnabled , true ) VIEW_DEC_CLASS(VDevice) private slots: void onPOSTOSVersionData (const QString &vOSVersion); private: bool isCompleteResponse(Model::MDeviceResponseBase::Data vData) { // Either the script exited successfully or the script failed and the reason is provided // There are situations that the script is using the attribute response to update the UI // but it is not the final/completed response return vData.mAccepted || (!vData.mAccepted && vData.mReason != 0 ); } }; }