new register function
This commit is contained in:
parent
1e3c89b672
commit
7a392dc33a
@ -29,11 +29,10 @@ ReturnValue_t HealthDevice::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (parentQueue != 0) {
|
||||
if (parentQueue != MessageQueueIF::NO_QUEUE) {
|
||||
return healthHelper.initialize(parentQueue);
|
||||
} else {
|
||||
return healthHelper.initialize();
|
||||
}
|
||||
return healthHelper.initialize();
|
||||
}
|
||||
|
||||
MessageQueueId_t HealthDevice::getCommandQueue() const { return commandQueue->getId(); }
|
||||
|
@ -29,7 +29,7 @@ class HealthDevice : public SystemObject, public ExecutableObjectIF, public HasH
|
||||
protected:
|
||||
HealthState lastHealth;
|
||||
|
||||
MessageQueueId_t parentQueue;
|
||||
MessageQueueId_t parentQueue = MessageQueueIF::NO_QUEUE;
|
||||
MessageQueueIF* commandQueue;
|
||||
HealthHelper healthHelper;
|
||||
};
|
||||
|
@ -315,20 +315,7 @@ object_id_t SubsystemBase::getObjectId() const { return SystemObject::getObjectI
|
||||
void SubsystemBase::modeChanged() {}
|
||||
|
||||
ReturnValue_t SubsystemBase::registerChild(const ModeTreeChildIF& child) {
|
||||
ChildInfo info;
|
||||
|
||||
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;
|
||||
return registerChild(child.getObjectId(), child.getModeIF().getCommandQueue());
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user