add mode setters

This commit is contained in:
Robin Müller 2023-11-09 17:18:33 +01:00
parent 35be7da353
commit bf7fac071c
2 changed files with 12 additions and 3 deletions

View File

@ -34,13 +34,20 @@ ReturnValue_t FreshDeviceHandlerBase::performOperation(uint8_t opCode) {
void FreshDeviceHandlerBase::startTransition(Mode_t mode_, Submode_t submode_) {
triggerEvent(CHANGING_MODE, mode_, submode_);
mode = mode_;
submode = submode_;
// Complete mode transition immediately by default.
setMode(mode_, submode_);
}
void FreshDeviceHandlerBase::setMode(Mode_t newMode, Submode_t newSubmode) {
mode = newMode;
submode = newSubmode;
modeHelper.modeChanged(mode, submode);
modeChanged(mode, submode);
announceMode(false);
}
void FreshDeviceHandlerBase::setMode(Mode_t newMode) { setMode(newMode, submode); }
void FreshDeviceHandlerBase::getMode(Mode_t* mode_, Submode_t* submode_) {
*mode_ = this->mode;
*submode_ = this->submode;
@ -174,4 +181,4 @@ ReturnValue_t FreshDeviceHandlerBase::getParameter(uint8_t domainId, uint8_t uni
return result;
}
return INVALID_DOMAIN_ID;
}
}

View File

@ -89,6 +89,8 @@ class FreshDeviceHandlerBase : public SystemObject,
* new mode.
*/
void startTransition(Mode_t mode, Submode_t submode) override;
virtual void setMode(Mode_t newMode, Submode_t newSubmode);
virtual void setMode(Mode_t newMode);
void getMode(Mode_t* mode, Submode_t* submode) override;
void setToExternalControl() override;
void announceMode(bool recursive) override;