/*! * * 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 VAdjustmentAlarmVolume.cpp * \author (last) Behrouz NematiPour * \date (last) 07-Jun-2021 * \author (original) Behrouz NematiPour * \date (original) 07-Jun-2021 * */ #include "VAdjustmentAlarmVolume.h" // Project #include "GuiController.h" VIEW_DEF_CLASS_ADJUSTMENT(VAdjustmentAlarmVolume) /*! * \brief Connection Initializer * \details All the class signal/slot connections are defined here. */ void View::VAdjustmentAlarmVolume::initConnections() { ADJUST_VIEW_CONNECTION(AdjustHDAlarmVolumeRequestData ); ACTION_VIEW_CONNECTION(AdjustHDAlarmVolumeResponseData ); } void View::VAdjustmentAlarmVolume::onActionReceive(const AdjustHDAlarmVolumeResponseData &vData) { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); // TODO : Value // in the correct/standard design (like all the other MVCs) there should always be the FW preferred (or old value) for the requested value to change. // a line like : hdAlarmVolume( vData.volume ); // please give attention to the vData(received) instead of _data(private). // but is has not been provided !!! // at this moment the only thing that can be done is to use _data.volume(accepted)/_hdAlarmVolume(rejected) to revert back to the old private value the view has. // Please notice that it works but we are just predicting what the FW has and the GUI is totally agnostic about the FW current value, // so we get easily out of sync with FW. if (vData.mAccepted) { hdAlarmVolume( _data.volume ); status(""); } else { hdAlarmVolumeChanged(_hdAlarmVolume); // TODO : Rejection Reason (status) // Same thing which has been done for the alarmMapping has to be done for the Reason returning by each response. status(tr("The alarm volume change request has been rejected [%1]").arg(vData.mReason)); } // *** has to be the last to let the information to be set and then emit the signal *** // *** otherwise will use the previous values before being set. *** adjustment(true); } void View::VAdjustmentAlarmVolume::doAdjustment(quint8 vVolume) { _data.volume = vVolume; emit didAdjustment(_data); }