Update for Assembly Base #38

Merged
meierj merged 13 commits from mueller/master into eive/develop 2022-03-08 07:53:07 +01:00
5 changed files with 12 additions and 7 deletions
Showing only changes of commit 3c53e2c259 - Show all commits

View File

@ -196,7 +196,7 @@ ReturnValue_t AssemblyBase::checkModeCommand(Mode_t mode, Submode_t submode,
} }
if ((mode != MODE_ON) && (mode != DeviceHandlerIF::MODE_NORMAL)) { if ((mode != MODE_ON) && (mode != DeviceHandlerIF::MODE_NORMAL)) {
return INVALID_MODE; return INVALID_MODE_RETVAL;
} }
if (internalState != STATE_NONE) { if (internalState != STATE_NONE) {

View File

@ -403,7 +403,7 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode, Submode_t s
return INVALID_SUBMODE; return INVALID_SUBMODE;
} }
default: default:
return HasModesIF::INVALID_MODE; return HasModesIF::INVALID_MODE_RETVAL;
} }
} }

View File

@ -13,7 +13,7 @@ class HasModesIF {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_MODES_IF; static const uint8_t INTERFACE_ID = CLASS_ID::HAS_MODES_IF;
static const ReturnValue_t INVALID_MODE = MAKE_RETURN_CODE(0x01); static const ReturnValue_t INVALID_MODE_RETVAL = MAKE_RETURN_CODE(0x01);
static const ReturnValue_t TRANS_NOT_ALLOWED = MAKE_RETURN_CODE(0x02); static const ReturnValue_t TRANS_NOT_ALLOWED = MAKE_RETURN_CODE(0x02);
static const ReturnValue_t IN_TRANSITION = MAKE_RETURN_CODE(0x03); static const ReturnValue_t IN_TRANSITION = MAKE_RETURN_CODE(0x03);
static const ReturnValue_t INVALID_SUBMODE = MAKE_RETURN_CODE(0x04); static const ReturnValue_t INVALID_SUBMODE = MAKE_RETURN_CODE(0x04);
@ -37,9 +37,13 @@ class HasModesIF {
//! The device is powered and ready to perform operations. In this mode, no commands are //! The device is powered and ready to perform operations. In this mode, no commands are
//! sent by the device handler itself, but direct commands van be commanded and will be //! sent by the device handler itself, but direct commands van be commanded and will be
//! interpreted //! interpreted
static const Mode_t MODE_ON = 1; static constexpr Mode_t MODE_ON = 1;
//! The device is powered off. The only command accepted in this mode is a mode change to on. //! The device is powered off. The only command accepted in this mode is a mode change to on.
static const Mode_t MODE_OFF = 0; static constexpr Mode_t MODE_OFF = 0;
static constexpr Mode_t INVALID_MODE = -1;
static constexpr Mode_t UNDEFINED_MODE = -2;
//! To avoid checks against magic number "0". //! To avoid checks against magic number "0".
static const Submode_t SUBMODE_NONE = 0; static const Submode_t SUBMODE_NONE = 0;

View File

@ -33,8 +33,9 @@ ReturnValue_t SubsystemBase::registerChild(object_id_t objectId) {
info.mode = MODE_OFF; info.mode = MODE_OFF;
} }
} else { } else {
// intentional to force an initial command during system startup
info.commandQueue = child->getCommandQueue(); info.commandQueue = child->getCommandQueue();
info.mode = -1; // intentional to force an initial command during system startup info.mode = HasModesIF::UNDEFINED_MODE;
} }
info.submode = SUBMODE_NONE; info.submode = SUBMODE_NONE;

View File

@ -125,7 +125,7 @@ ReturnValue_t TestAssembly::isModeCombinationValid(Mode_t mode, Submode_t submod
return INVALID_SUBMODE; return INVALID_SUBMODE;
} }
} }
return INVALID_MODE; return INVALID_MODE_RETVAL;
} }
ReturnValue_t TestAssembly::initialize() { ReturnValue_t TestAssembly::initialize() {