DHB ctor simplified
This commit is contained in:
parent
32ef807341
commit
5a351474d2
@ -67,6 +67,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t initialize(MessageQueueIF* queueToUse,
|
ReturnValue_t initialize(MessageQueueIF* queueToUse,
|
||||||
object_id_t hkDestination);
|
object_id_t hkDestination);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to set the default HK packet destination.
|
* This function is used to set the default HK packet destination.
|
||||||
* This destination will usually only be set once.
|
* This destination will usually only be set once.
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
||||||
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
|
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
|
||||||
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
|
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
|
||||||
|
object_id_t DeviceHandlerBase::defaultHkDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t deviceCommunication, CookieIF * comCookie,
|
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||||
FailureIsolationBase* fdirInstance,
|
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
|
||||||
size_t cmdQueueSize) :
|
|
||||||
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
||||||
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||||
deviceCommunicationId(deviceCommunication), comCookie(comCookie),
|
deviceCommunicationId(deviceCommunication), comCookie(comCookie),
|
||||||
@ -31,8 +31,8 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
|||||||
actionHelper(this, nullptr), hkManager(this, nullptr),
|
actionHelper(this, nullptr), hkManager(this, nullptr),
|
||||||
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
||||||
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
||||||
switchOffWasReported(false), hkDestination(hkDestination),
|
switchOffWasReported(false), childTransitionDelay(5000),
|
||||||
childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
|
transitionSourceMode(_MODE_POWER_DOWN),
|
||||||
transitionSourceSubMode(SUBMODE_NONE) {
|
transitionSourceSubMode(SUBMODE_NONE) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||||
@ -189,6 +189,10 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hkDestination == objects::NO_OBJECT) {
|
||||||
|
hkDestination = defaultHkDestination;
|
||||||
|
}
|
||||||
|
|
||||||
result = hkManager.initialize(commandQueue, hkDestination);
|
result = hkManager.initialize(commandQueue, hkDestination);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
|
@ -1048,6 +1048,7 @@ private:
|
|||||||
PowerSwitchIF *powerSwitcher = nullptr;
|
PowerSwitchIF *powerSwitcher = nullptr;
|
||||||
|
|
||||||
/** Cached for initialize() */
|
/** Cached for initialize() */
|
||||||
|
static object_id_t defaultHkDestination;
|
||||||
object_id_t hkDestination = objects::NO_OBJECT;
|
object_id_t hkDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ ReturnValue_t FailureIsolationBase::initialize() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (ownerId != 0) {
|
if (faultTreeParent != objects::NO_OBJECT) {
|
||||||
result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId);
|
result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -41,10 +41,15 @@ ReturnValue_t FailureIsolationBase::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (faultTreeParent != 0) {
|
if (faultTreeParent != objects::NO_OBJECT) {
|
||||||
ConfirmsFailuresIF* parentIF = objectManager->get<ConfirmsFailuresIF>(
|
ConfirmsFailuresIF* parentIF = objectManager->get<ConfirmsFailuresIF>(
|
||||||
faultTreeParent);
|
faultTreeParent);
|
||||||
if (parentIF == NULL) {
|
if (parentIF == nullptr) {
|
||||||
|
sif::error << "FailureIsolationBase::intialize: Parent object"
|
||||||
|
<< "invalid." << std::endl;
|
||||||
|
sif::error << "Make sure it implements ConfirmsFailuresIF."
|
||||||
|
<< std::endl;
|
||||||
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
|
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
|
||||||
|
@ -17,8 +17,11 @@ public:
|
|||||||
static const Event FDIR_CHANGED_STATE = MAKE_EVENT(1, SEVERITY::INFO); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState).
|
static const Event FDIR_CHANGED_STATE = MAKE_EVENT(1, SEVERITY::INFO); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState).
|
||||||
static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT(2, SEVERITY::MEDIUM); //!< FDIR tries to restart device. Par1: event that caused recovery.
|
static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT(2, SEVERITY::MEDIUM); //!< FDIR tries to restart device. Par1: event that caused recovery.
|
||||||
static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT(3, SEVERITY::MEDIUM); //!< FDIR turns off device. Par1: event that caused recovery.
|
static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT(3, SEVERITY::MEDIUM); //!< FDIR turns off device. Par1: event that caused recovery.
|
||||||
FailureIsolationBase(object_id_t owner, object_id_t parent = 0,
|
|
||||||
|
FailureIsolationBase(object_id_t owner,
|
||||||
|
object_id_t parent = objects::NO_OBJECT,
|
||||||
uint8_t messageDepth = 10, uint8_t parameterDomainBase = 0xF0);
|
uint8_t messageDepth = 10, uint8_t parameterDomainBase = 0xF0);
|
||||||
|
|
||||||
virtual ~FailureIsolationBase();
|
virtual ~FailureIsolationBase();
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize();
|
||||||
|
|
||||||
@ -26,7 +29,7 @@ public:
|
|||||||
* This is called by the DHB in performOperation()
|
* This is called by the DHB in performOperation()
|
||||||
*/
|
*/
|
||||||
void checkForFailures();
|
void checkForFailures();
|
||||||
MessageQueueId_t getEventReceptionQueue();
|
MessageQueueId_t getEventReceptionQueue() override;
|
||||||
virtual void triggerEvent(Event event, uint32_t parameter1 = 0,
|
virtual void triggerEvent(Event event, uint32_t parameter1 = 0,
|
||||||
uint32_t parameter2 = 0);
|
uint32_t parameter2 = 0);
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user