added way to start DH immediately, bugfix in event manager
This commit is contained in:
parent
faeeca8707
commit
05814dc805
@ -1385,6 +1385,10 @@ ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
|
|||||||
pstIntervalMs = executingTask->getPeriodMs();
|
pstIntervalMs = executingTask->getPeriodMs();
|
||||||
}
|
}
|
||||||
this->hkManager.initializeAfterTaskCreation();
|
this->hkManager.initializeAfterTaskCreation();
|
||||||
|
|
||||||
|
if(setStartupImmediately) {
|
||||||
|
startTransition(MODE_ON, SUBMODE_NONE);
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1402,6 +1406,10 @@ object_id_t DeviceHandlerBase::getObjectId() const {
|
|||||||
return SystemObject::getObjectId();
|
return SystemObject::getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceHandlerBase::setStartUpImmediately() {
|
||||||
|
this->setStartupImmediately = true;
|
||||||
|
}
|
||||||
|
|
||||||
dur_millis_t DeviceHandlerBase::getPeriodicOperationFrequency() const {
|
dur_millis_t DeviceHandlerBase::getPeriodicOperationFrequency() const {
|
||||||
return pstIntervalMs;
|
return pstIntervalMs;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,16 @@ public:
|
|||||||
void setHkDestination(object_id_t hkDestination);
|
void setHkDestination(object_id_t hkDestination);
|
||||||
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId,
|
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId,
|
||||||
uint32_t thermalRequestPoolId);
|
uint32_t thermalRequestPoolId);
|
||||||
|
/**
|
||||||
|
* @brief Helper function to easy device handler development.
|
||||||
|
* This will instruct the transition to MODE_ON immediately
|
||||||
|
* (leading to doStartUp() being called for the transition to the ON mode),
|
||||||
|
* so external mode commanding is not necessary anymore.
|
||||||
|
*
|
||||||
|
* This has to be called before the task is started!
|
||||||
|
* (e.g. in the task factory)
|
||||||
|
*/
|
||||||
|
void setStartUpImmediately();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is the device handler base core component and is
|
* @brief This function is the device handler base core component and is
|
||||||
@ -149,6 +159,14 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Intialization steps performed after all tasks have been created.
|
||||||
|
* This function will be called by the executing task.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
virtual ~DeviceHandlerBase();
|
virtual ~DeviceHandlerBase();
|
||||||
|
|
||||||
@ -945,14 +963,17 @@ protected:
|
|||||||
|
|
||||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode);
|
uint32_t *msToReachTheMode);
|
||||||
virtual void startTransition(Mode_t mode, Submode_t submode);
|
|
||||||
virtual void setToExternalControl();
|
/* HasModesIF overrides */
|
||||||
virtual void announceMode(bool recursive);
|
virtual void startTransition(Mode_t mode, Submode_t submode) override;
|
||||||
|
virtual void setToExternalControl() override;
|
||||||
|
virtual void announceMode(bool recursive) override;
|
||||||
|
|
||||||
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
|
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites SystemObject::triggerEvent in order to inform FDIR"Helper" faster about executed events.
|
* Overwrites SystemObject::triggerEvent in order to inform FDIR"Helper"
|
||||||
|
* faster about executed events.
|
||||||
* This is a bit sneaky, but improves responsiveness of the device FDIR.
|
* This is a bit sneaky, but improves responsiveness of the device FDIR.
|
||||||
* @param event The event to be thrown
|
* @param event The event to be thrown
|
||||||
* @param parameter1 Optional parameter 1
|
* @param parameter1 Optional parameter 1
|
||||||
@ -1044,6 +1065,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
uint32_t timeoutStart = 0;
|
uint32_t timeoutStart = 0;
|
||||||
|
|
||||||
|
bool setStartupImmediately = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay for the current mode transition, used for time out
|
* Delay for the current mode transition, used for time out
|
||||||
*/
|
*/
|
||||||
@ -1162,7 +1185,6 @@ private:
|
|||||||
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data,
|
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data,
|
||||||
uint32_t *len);
|
uint32_t *len);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW NOTHING ELSE!!!
|
* @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW NOTHING ELSE!!!
|
||||||
*/
|
*/
|
||||||
@ -1173,28 +1195,14 @@ private:
|
|||||||
*/
|
*/
|
||||||
void callChildStatemachine();
|
void callChildStatemachine();
|
||||||
|
|
||||||
/**
|
|
||||||
* Switches the channel of the cookie used for the communication
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param newChannel the object Id of the channel to switch to
|
|
||||||
* @return
|
|
||||||
* - @c RETURN_OK when cookie was changed
|
|
||||||
* - @c RETURN_FAILED when cookies could not be changed,
|
|
||||||
* e.g. because the newChannel is not enabled
|
|
||||||
* - @c returnvalues of RMAPChannelIF::isActive()
|
|
||||||
*/
|
|
||||||
ReturnValue_t switchCookieChannel(object_id_t newChannelId);
|
|
||||||
|
|
||||||
ReturnValue_t handleDeviceHandlerMessage(CommandMessage *message);
|
ReturnValue_t handleDeviceHandlerMessage(CommandMessage *message);
|
||||||
|
|
||||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
|
||||||
virtual DataSetIF* getDataSetHandle(sid_t sid) override;
|
virtual DataSetIF* getDataSetHandle(sid_t sid) override;
|
||||||
|
|
||||||
void parseReply(const uint8_t* receivedData,
|
|
||||||
size_t receivedDataLen);
|
|
||||||
|
|
||||||
virtual dur_millis_t getPeriodicOperationFrequency() const override;
|
virtual dur_millis_t getPeriodicOperationFrequency() const override;
|
||||||
|
|
||||||
|
void parseReply(const uint8_t* receivedData,
|
||||||
|
size_t receivedDataLen);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERBASE_H_ */
|
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERBASE_H_ */
|
||||||
|
@ -247,6 +247,14 @@ bool DeviceHandlerFailureIsolation::isFdirInActionOrAreWeFaulty(
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (owner == nullptr) {
|
||||||
|
// Configuration error.
|
||||||
|
sif::error << "DeviceHandlerFailureIsolation::"
|
||||||
|
<< "isFdirInActionOrAreWeFaulty: Owner not set!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (owner->getHealth() == HasHealthIF::FAULTY
|
if (owner->getHealth() == HasHealthIF::FAULTY
|
||||||
|| owner->getHealth() == HasHealthIF::PERMANENT_FAULTY) {
|
|| owner->getHealth() == HasHealthIF::PERMANENT_FAULTY) {
|
||||||
//Ignore all events in case device is already faulty.
|
//Ignore all events in case device is already faulty.
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#ifndef EVENTMANAGERIF_H_
|
#ifndef EVENTMANAGERIF_H_
|
||||||
#define EVENTMANAGERIF_H_
|
#define EVENTMANAGERIF_H_
|
||||||
|
|
||||||
#include "eventmatching/eventmatching.h"
|
|
||||||
#include "EventMessage.h"
|
#include "EventMessage.h"
|
||||||
|
#include "eventmatching/eventmatching.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
|
#include "../ipc/MessageQueueIF.h"
|
||||||
|
|
||||||
class EventManagerIF {
|
class EventManagerIF {
|
||||||
public:
|
public:
|
||||||
@ -16,7 +17,8 @@ public:
|
|||||||
|
|
||||||
virtual MessageQueueId_t getEventReportQueue() = 0;
|
virtual MessageQueueId_t getEventReportQueue() = 0;
|
||||||
|
|
||||||
virtual ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false) = 0;
|
virtual ReturnValue_t registerListener(MessageQueueId_t listener,
|
||||||
|
bool forwardAllButSelected = false) = 0;
|
||||||
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener,
|
||||||
EventId_t event) = 0;
|
EventId_t event) = 0;
|
||||||
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener,
|
||||||
@ -31,18 +33,22 @@ public:
|
|||||||
bool reporterInverted = false) = 0;
|
bool reporterInverted = false) = 0;
|
||||||
|
|
||||||
static void triggerEvent(object_id_t reportingObject, Event event,
|
static void triggerEvent(object_id_t reportingObject, Event event,
|
||||||
uint32_t parameter1 = 0, uint32_t parameter2 = 0, MessageQueueId_t sentFrom = 0) {
|
uint32_t parameter1 = 0, uint32_t parameter2 = 0,
|
||||||
|
MessageQueueId_t sentFrom = 0) {
|
||||||
EventMessage message(event, reportingObject, parameter1, parameter2);
|
EventMessage message(event, reportingObject, parameter1, parameter2);
|
||||||
triggerEvent(&message, sentFrom);
|
triggerEvent(&message, sentFrom);
|
||||||
}
|
}
|
||||||
static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) {
|
|
||||||
static MessageQueueId_t eventmanagerQueue = 0;
|
static void triggerEvent(EventMessage* message,
|
||||||
if (eventmanagerQueue == 0) {
|
MessageQueueId_t sentFrom = 0) {
|
||||||
|
static MessageQueueId_t eventmanagerQueue = MessageQueueIF::NO_QUEUE;
|
||||||
|
if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) {
|
||||||
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
EventManagerIF *eventmanager = objectManager->get<EventManagerIF>(
|
||||||
objects::EVENT_MANAGER);
|
objects::EVENT_MANAGER);
|
||||||
if (eventmanager != NULL) {
|
if (eventmanager == nullptr) {
|
||||||
eventmanagerQueue = eventmanager->getEventReportQueue();
|
return;
|
||||||
}
|
}
|
||||||
|
eventmanagerQueue = eventmanager->getEventReportQueue();
|
||||||
}
|
}
|
||||||
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
MessageQueueSenderIF::sendMessage(eventmanagerQueue, message, sentFrom);
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ protected:
|
|||||||
uint32_t *msToReachTheMode) {
|
uint32_t *msToReachTheMode) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
virtual void startTransition(Mode_t mode, Submode_t submode) {
|
|
||||||
}
|
virtual void startTransition(Mode_t mode, Submode_t submode) {}
|
||||||
virtual void setToExternalControl() {
|
|
||||||
}
|
virtual void setToExternalControl() {}
|
||||||
virtual void announceMode(bool recursive) {
|
|
||||||
}
|
virtual void announceMode(bool recursive) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* HASMODESIF_H_ */
|
#endif /* HASMODESIF_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user