add an adaption point which a user can use to convert a objectId of a shared power switch into a objectId of a device handler
This commit is contained in:
parent
7ae58f8125
commit
b665b2effe
@ -71,7 +71,7 @@ bool AssemblyBase::handleChildrenChangedHealth() {
|
||||
if (iter == childrenMap.end()) {
|
||||
return false;
|
||||
}
|
||||
HealthState healthState = healthHelper.healthTable->getHealth(iter->first);
|
||||
HealthState healthState = healthHelper.healthTable->getHealth(convertToDeviceObjectId(iter->first));
|
||||
if (healthState == HasHealthIF::NEEDS_RECOVERY) {
|
||||
triggerEvent(TRYING_RECOVERY, iter->first, 0);
|
||||
recoveryState = RECOVERY_STARTED;
|
||||
@ -170,7 +170,7 @@ ReturnValue_t AssemblyBase::checkChildrenStateOff() {
|
||||
|
||||
ReturnValue_t AssemblyBase::checkChildOff(uint32_t objectId) {
|
||||
ChildInfo childInfo = childrenMap.find(objectId)->second;
|
||||
if (healthHelper.healthTable->isCommandable(objectId)) {
|
||||
if (healthHelper.healthTable->isCommandable(convertToDeviceObjectId(objectId))) {
|
||||
if (childInfo.submode != SUBMODE_NONE) {
|
||||
return returnvalue::FAILED;
|
||||
} else {
|
||||
|
@ -78,9 +78,9 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
|
||||
submodeToCommand = targetSubmode;
|
||||
}
|
||||
|
||||
if (healthHelper.healthTable->hasHealth(object)) {
|
||||
if (healthHelper.healthTable->hasHealth(convertToDeviceObjectId(object))) {
|
||||
|
||||
switch (healthHelper.healthTable->getHealth(object)) {
|
||||
switch (healthHelper.healthTable->getHealth(convertToDeviceObjectId(object))) {
|
||||
case NEEDS_RECOVERY:
|
||||
case FAULTY:
|
||||
case PERMANENT_FAULTY:
|
||||
@ -353,3 +353,7 @@ ReturnValue_t SubsystemBase::registerChild(object_id_t childObjectId, MessageQue
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
object_id_t SubsystemBase::convertToDeviceObjectId(object_id_t id) {
|
||||
return id;
|
||||
}
|
@ -153,6 +153,12 @@ class SubsystemBase : public SystemObject,
|
||||
virtual void announceMode(bool recursive) override;
|
||||
|
||||
virtual void modeChanged();
|
||||
|
||||
/**
|
||||
* @brief Provides an adaptation point for the user to change an objectId into
|
||||
* a different objectId.
|
||||
*/
|
||||
virtual object_id_t convertToDeviceObjectId(object_id_t id);
|
||||
};
|
||||
|
||||
#endif /* FSFW_SUBSYSTEM_SUBSYSTEMBASE_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user