new register function
This commit is contained in:
parent
1e3c89b672
commit
7a392dc33a
@ -29,11 +29,10 @@ ReturnValue_t HealthDevice::initialize() {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (parentQueue != 0) {
|
if (parentQueue != MessageQueueIF::NO_QUEUE) {
|
||||||
return healthHelper.initialize(parentQueue);
|
return healthHelper.initialize(parentQueue);
|
||||||
} else {
|
|
||||||
return healthHelper.initialize();
|
|
||||||
}
|
}
|
||||||
|
return healthHelper.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t HealthDevice::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t HealthDevice::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
|
@ -29,7 +29,7 @@ class HealthDevice : public SystemObject, public ExecutableObjectIF, public HasH
|
|||||||
protected:
|
protected:
|
||||||
HealthState lastHealth;
|
HealthState lastHealth;
|
||||||
|
|
||||||
MessageQueueId_t parentQueue;
|
MessageQueueId_t parentQueue = MessageQueueIF::NO_QUEUE;
|
||||||
MessageQueueIF* commandQueue;
|
MessageQueueIF* commandQueue;
|
||||||
HealthHelper healthHelper;
|
HealthHelper healthHelper;
|
||||||
};
|
};
|
||||||
|
@ -315,20 +315,7 @@ object_id_t SubsystemBase::getObjectId() const { return SystemObject::getObjectI
|
|||||||
void SubsystemBase::modeChanged() {}
|
void SubsystemBase::modeChanged() {}
|
||||||
|
|
||||||
ReturnValue_t SubsystemBase::registerChild(const ModeTreeChildIF& child) {
|
ReturnValue_t SubsystemBase::registerChild(const ModeTreeChildIF& child) {
|
||||||
ChildInfo info;
|
return registerChild(child.getObjectId(), child.getModeIF().getCommandQueue());
|
||||||
|
|
||||||
const HasModesIF& modeChild = child.getModeIF();
|
|
||||||
// intentional to force an initial command during system startup
|
|
||||||
info.commandQueue = modeChild.getCommandQueue();
|
|
||||||
info.mode = HasModesIF::MODE_UNDEFINED;
|
|
||||||
info.submode = SUBMODE_NONE;
|
|
||||||
info.healthChanged = false;
|
|
||||||
|
|
||||||
auto resultPair = childrenMap.emplace(child.getObjectId(), info);
|
|
||||||
if (not resultPair.second) {
|
|
||||||
return COULD_NOT_INSERT_CHILD;
|
|
||||||
}
|
|
||||||
return returnvalue::OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const HasHealthIF* SubsystemBase::getOptHealthIF() const { return this; }
|
const HasHealthIF* SubsystemBase::getOptHealthIF() const { return this; }
|
||||||
@ -336,3 +323,19 @@ const HasHealthIF* SubsystemBase::getOptHealthIF() const { return this; }
|
|||||||
const HasModesIF& SubsystemBase::getModeIF() const { return *this; }
|
const HasModesIF& SubsystemBase::getModeIF() const { return *this; }
|
||||||
|
|
||||||
ModeTreeChildIF& SubsystemBase::getModeTreeChildIF() { return *this; }
|
ModeTreeChildIF& SubsystemBase::getModeTreeChildIF() { return *this; }
|
||||||
|
|
||||||
|
ReturnValue_t SubsystemBase::registerChild(object_id_t childObjectId, MessageQueueId_t childQueue) {
|
||||||
|
ChildInfo info;
|
||||||
|
|
||||||
|
// intentional to force an initial command during system startup
|
||||||
|
info.commandQueue = childQueue;
|
||||||
|
info.mode = HasModesIF::MODE_UNDEFINED;
|
||||||
|
info.submode = SUBMODE_NONE;
|
||||||
|
info.healthChanged = false;
|
||||||
|
|
||||||
|
auto resultPair = childrenMap.emplace(childObjectId, info);
|
||||||
|
if (not resultPair.second) {
|
||||||
|
return COULD_NOT_INSERT_CHILD;
|
||||||
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
@ -61,6 +61,8 @@ class SubsystemBase : public SystemObject,
|
|||||||
* COULD_NOT_INSERT_CHILD If the Child could not be added to the ChildrenMap
|
* COULD_NOT_INSERT_CHILD If the Child could not be added to the ChildrenMap
|
||||||
*/
|
*/
|
||||||
ReturnValue_t registerChild(const ModeTreeChildIF &child) override;
|
ReturnValue_t registerChild(const ModeTreeChildIF &child) override;
|
||||||
|
// TODO: Add this to HasModeTreeChildrenIF.
|
||||||
|
ReturnValue_t registerChild(object_id_t childObjectId, MessageQueueId_t childQueue);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user