added hk receiver obj id to dhb ctor
This commit is contained in:
parent
1820b5f95c
commit
837fecf859
@ -1,5 +1,6 @@
|
|||||||
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
#include <framework/datapoollocal/LocalDataPoolManager.h>
|
||||||
#include <framework/datapoollocal/LocalDataSet.h>
|
#include <framework/datapoollocal/LocalDataSet.h>
|
||||||
|
#include <framework/housekeeping/AcceptsHkPacketsIF.h>
|
||||||
#include <framework/ipc/MutexFactory.h>
|
#include <framework/ipc/MutexFactory.h>
|
||||||
#include <framework/ipc/MutexHelper.h>
|
#include <framework/ipc/MutexHelper.h>
|
||||||
#include <framework/ipc/QueueFactory.h>
|
#include <framework/ipc/QueueFactory.h>
|
||||||
@ -7,7 +8,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
LocalDataPoolManager::LocalDataPoolManager(OwnsLocalDataPoolIF* owner,
|
LocalDataPoolManager::LocalDataPoolManager(OwnsLocalDataPoolIF* owner,
|
||||||
uint32_t replyQueueDepth, bool appendValidityBuffer):
|
MessageQueueIF* queueToUse, bool appendValidityBuffer):
|
||||||
appendValidityBuffer(appendValidityBuffer) {
|
appendValidityBuffer(appendValidityBuffer) {
|
||||||
if(owner == nullptr) {
|
if(owner == nullptr) {
|
||||||
sif::error << "HkManager: Invalid supplied owner!" << std::endl;
|
sif::error << "HkManager: Invalid supplied owner!" << std::endl;
|
||||||
@ -24,16 +25,44 @@ LocalDataPoolManager::LocalDataPoolManager(OwnsLocalDataPoolIF* owner,
|
|||||||
sif::error << "LocalDataPoolManager::LocalDataPoolManager: "
|
sif::error << "LocalDataPoolManager::LocalDataPoolManager: "
|
||||||
"Could not set IPC store." << std::endl;
|
"Could not set IPC store." << std::endl;
|
||||||
}
|
}
|
||||||
hkQueue = QueueFactory::instance()->createMessageQueue(replyQueueDepth,
|
hkQueue = queueToUse;
|
||||||
HousekeepingMessage::HK_MESSAGE_SIZE);
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse,
|
||||||
|
object_id_t hkDestination) {
|
||||||
|
if(queueToUse == nullptr) {
|
||||||
|
sif::error << "LocalDataPoolManager::initialize: Supplied queue "
|
||||||
|
"invalid!" << std::endl;
|
||||||
|
}
|
||||||
|
hkQueue = queueToUse;
|
||||||
|
|
||||||
|
if(hkDestination == objects::NO_OBJECT) {
|
||||||
|
return initializeHousekeepingPoolEntriesOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
AcceptsHkPacketsIF* hkReceiver =
|
||||||
|
objectManager->get<AcceptsHkPacketsIF>(hkDestination);
|
||||||
|
if(hkReceiver != nullptr) {
|
||||||
|
setHkPacketDestination(hkReceiver->getHkQueue());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sif::warning << "LocalDataPoolManager::initialize: Could not retrieve"
|
||||||
|
" queue ID from HK destination object ID. Make sure it exists"
|
||||||
|
" and the object impements AcceptsHkPacketsIF!" << std::endl;
|
||||||
|
}
|
||||||
|
return initializeHousekeepingPoolEntriesOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LocalDataPoolManager::setHkPacketDestination(
|
||||||
|
MessageQueueId_t hkDestination) {
|
||||||
|
this->hkDestination = hkDestination;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDataPoolManager::~LocalDataPoolManager() {}
|
LocalDataPoolManager::~LocalDataPoolManager() {}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
||||||
if(not mapInitialized) {
|
if(not mapInitialized) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result = owner->initializePoolEntries(localDpMap);
|
||||||
owner->initializePoolEntries(localDpMap);
|
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
mapInitialized = true;
|
mapInitialized = true;
|
||||||
}
|
}
|
||||||
@ -80,16 +109,12 @@ MutexIF* LocalDataPoolManager::getMutexHandle() {
|
|||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalDataPoolManager::setHkPacketDestination(
|
|
||||||
MessageQueueId_t destinationQueueId) {
|
|
||||||
this->currentHkPacketDestination = destinationQueueId;
|
|
||||||
}
|
|
||||||
|
|
||||||
const OwnsLocalDataPoolIF* LocalDataPoolManager::getOwner() const {
|
const OwnsLocalDataPoolIF* LocalDataPoolManager::getOwner() const {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid) {
|
ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||||
|
MessageQueueId_t sendTo) {
|
||||||
LocalDataSet* dataSetToSerialize = dynamic_cast<LocalDataSet*>(
|
LocalDataSet* dataSetToSerialize = dynamic_cast<LocalDataSet*>(
|
||||||
owner->getDataSetHandle(sid));
|
owner->getDataSetHandle(sid));
|
||||||
if(dataSetToSerialize == nullptr) {
|
if(dataSetToSerialize == nullptr) {
|
||||||
@ -108,14 +133,21 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid) {
|
|||||||
CommandMessage hkMessage;
|
CommandMessage hkMessage;
|
||||||
HousekeepingMessage::setHkReportMessage(&hkMessage, sid, storeId);
|
HousekeepingMessage::setHkReportMessage(&hkMessage, sid, storeId);
|
||||||
if(hkQueue == nullptr) {
|
if(hkQueue == nullptr) {
|
||||||
return QUEUE_NOT_SET;
|
return QUEUE_OR_DESTINATION_NOT_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentHkPacketDestination != MessageQueueIF::NO_QUEUE) {
|
if(sendTo != MessageQueueIF::NO_QUEUE) {
|
||||||
result = hkQueue->sendMessage(currentHkPacketDestination, &hkMessage);
|
result = hkQueue->sendMessage(sendTo, &hkMessage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = hkQueue->sendToDefault(&hkMessage);
|
if(hkDestination == MessageQueueIF::NO_QUEUE) {
|
||||||
|
sif::warning << "LocalDataPoolManager::generateHousekeepingPacket:"
|
||||||
|
" Destination is not set properly!" << std::endl;
|
||||||
|
return QUEUE_OR_DESTINATION_NOT_SET;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = hkQueue->sendMessage(hkDestination, &hkMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -149,6 +181,9 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocalDataPoolManager::setMinimalSamplingFrequency(float frequencySeconds) {
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
||||||
store_address_t *storeId, LocalDataSet* dataSet) {
|
store_address_t *storeId, LocalDataSet* dataSet) {
|
||||||
size_t hkSize = dataSet->getSerializedSize();
|
size_t hkSize = dataSet->getSerializedSize();
|
||||||
@ -177,4 +212,3 @@ ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,18 +44,45 @@ public:
|
|||||||
static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x0);
|
static constexpr ReturnValue_t POOL_ENTRY_NOT_FOUND = MAKE_RETURN_CODE(0x0);
|
||||||
static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x1);
|
static constexpr ReturnValue_t POOL_ENTRY_TYPE_CONFLICT = MAKE_RETURN_CODE(0x1);
|
||||||
|
|
||||||
static constexpr ReturnValue_t QUEUE_NOT_SET = MAKE_RETURN_CODE(0x2);
|
static constexpr ReturnValue_t QUEUE_OR_DESTINATION_NOT_SET = MAKE_RETURN_CODE(0x2);
|
||||||
//static constexpr ReturnValue_t SET_NOT_FOUND = MAKE_RETURN_CODE(0x3);
|
//static constexpr ReturnValue_t SET_NOT_FOUND = MAKE_RETURN_CODE(0x3);
|
||||||
|
|
||||||
LocalDataPoolManager(OwnsLocalDataPoolIF* owner,
|
/**
|
||||||
uint32_t replyQueueDepth = 20, bool appendValidityBuffer = true);
|
* This constructor is used by a class which wants to implement
|
||||||
|
* a personal local data pool. The queueToUse can be supplied if it
|
||||||
|
* is already known.
|
||||||
|
*
|
||||||
|
* initialize() has to be called in any case before using the object!
|
||||||
|
* @param owner
|
||||||
|
* @param queueToUse
|
||||||
|
* @param appendValidityBuffer
|
||||||
|
*/
|
||||||
|
LocalDataPoolManager(OwnsLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
|
||||||
|
bool appendValidityBuffer = true);
|
||||||
|
/**
|
||||||
|
* Initializes the map by calling the map initialization function of the
|
||||||
|
* owner abd assigns the queue to use.
|
||||||
|
* @param queueToUse
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ReturnValue_t initialize(MessageQueueIF* queueToUse,
|
||||||
|
object_id_t hkDestination);
|
||||||
|
/**
|
||||||
|
* This function is used to set the default HK packet destination.
|
||||||
|
* This destination will usually only be set once.
|
||||||
|
* @param hkDestination
|
||||||
|
*/
|
||||||
|
void setHkPacketDestination(MessageQueueId_t hkDestination);
|
||||||
|
|
||||||
virtual~ LocalDataPoolManager();
|
virtual~ LocalDataPoolManager();
|
||||||
|
|
||||||
/* Copying forbidden */
|
/**
|
||||||
LocalDataPoolManager(const LocalDataPoolManager &) = delete;
|
* Generate a housekeeping packet with a given SID.
|
||||||
LocalDataPoolManager operator=(const LocalDataPoolManager&) = delete;
|
* @param sid
|
||||||
|
* @return
|
||||||
ReturnValue_t generateHousekeepingPacket(sid_t sid);
|
*/
|
||||||
|
ReturnValue_t generateHousekeepingPacket(sid_t sid, MessageQueueId_t sendTo
|
||||||
|
= MessageQueueIF::NO_QUEUE);
|
||||||
ReturnValue_t generateSetStructurePacket(sid_t sid);
|
ReturnValue_t generateSetStructurePacket(sid_t sid);
|
||||||
|
|
||||||
ReturnValue_t handleHousekeepingMessage(CommandMessage* message);
|
ReturnValue_t handleHousekeepingMessage(CommandMessage* message);
|
||||||
@ -68,40 +95,43 @@ public:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t initializeHousekeepingPoolEntriesOnce();
|
ReturnValue_t initializeHousekeepingPoolEntriesOnce();
|
||||||
|
|
||||||
//! Set the queue for HK packets, which are sent unrequested.
|
|
||||||
void setHkPacketDestination(MessageQueueId_t destinationQueueId);
|
|
||||||
|
|
||||||
const OwnsLocalDataPoolIF* getOwner() const;
|
const OwnsLocalDataPoolIF* getOwner() const;
|
||||||
|
|
||||||
ReturnValue_t printPoolEntry(lp_id_t localPoolId);
|
ReturnValue_t printPoolEntry(lp_id_t localPoolId);
|
||||||
|
|
||||||
|
/* Copying forbidden */
|
||||||
|
LocalDataPoolManager(const LocalDataPoolManager &) = delete;
|
||||||
|
LocalDataPoolManager operator=(const LocalDataPoolManager&) = delete;
|
||||||
private:
|
private:
|
||||||
//! This is the map holding the actual data. Should only be initialized
|
/** This is the map holding the actual data. Should only be initialized
|
||||||
//! once !
|
* once ! */
|
||||||
bool mapInitialized = false;
|
bool mapInitialized = false;
|
||||||
//! This specifies whether a validity buffer is appended at the end
|
/** This specifies whether a validity buffer is appended at the end
|
||||||
//! of generated housekeeping packets.
|
* of generated housekeeping packets. */
|
||||||
bool appendValidityBuffer = true;
|
bool appendValidityBuffer = true;
|
||||||
|
|
||||||
LocalDataPool localDpMap;
|
LocalDataPool localDpMap;
|
||||||
|
|
||||||
//! Every housekeeping data manager has a mutex to protect access
|
/** Every housekeeping data manager has a mutex to protect access
|
||||||
//! to it's data pool.
|
* to it's data pool. */
|
||||||
MutexIF * mutex = nullptr;
|
MutexIF * mutex = nullptr;
|
||||||
|
/** The class which actually owns the manager (and its datapool). */
|
||||||
//! The class which actually owns the manager (and its datapool).
|
|
||||||
OwnsLocalDataPoolIF* owner = nullptr;
|
OwnsLocalDataPoolIF* owner = nullptr;
|
||||||
|
/**
|
||||||
//! Queue used for communication, for example commands.
|
* @brief Queue used for communication, for example commands.
|
||||||
//! Is also used to send messages.
|
* Is also used to send messages. Can be set either in the constructor
|
||||||
|
* or in the initialize() function.
|
||||||
|
*/
|
||||||
MessageQueueIF* hkQueue = nullptr;
|
MessageQueueIF* hkQueue = nullptr;
|
||||||
|
|
||||||
//! HK replies will always be a reply to the commander, but HK packet
|
/**
|
||||||
//! can be sent to another destination by specifying this message queue
|
* HK replies will always be a reply to the commander, but HK packet
|
||||||
//! ID, for example to a dedicated housekeeping service implementation.
|
* can be sent to another destination by specifying this message queue
|
||||||
MessageQueueId_t currentHkPacketDestination = MessageQueueIF::NO_QUEUE;
|
* ID, for example to a dedicated housekeeping service implementation.
|
||||||
|
*/
|
||||||
|
MessageQueueId_t hkDestination = MessageQueueIF::NO_QUEUE;
|
||||||
|
|
||||||
//! Global IPC store is used to store all packets.
|
/** Global IPC store is used to store all packets. */
|
||||||
StorageManagerIF* ipcStore = nullptr;
|
StorageManagerIF* ipcStore = nullptr;
|
||||||
/**
|
/**
|
||||||
* Get the pointer to the mutex. Can be used to lock the data pool
|
* Get the pointer to the mutex. Can be used to lock the data pool
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
/**
|
#ifndef FRAMEWORK_DEVICEHANDLERS_ACCEPTSDEVICERESPONSESIF_H_
|
||||||
* @file AcceptsDeviceResponsesIF.h
|
#define FRAMEWORK_DEVICEHANDLERS_ACCEPTSDEVICERESPONSESIF_H_
|
||||||
* @brief This file defines the AcceptsDeviceResponsesIF class.
|
|
||||||
* @date 15.05.2013
|
|
||||||
* @author baetz
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ACCEPTSDEVICERESPONSESIF_H_
|
|
||||||
#define ACCEPTSDEVICERESPONSESIF_H_
|
|
||||||
|
|
||||||
#include <framework/ipc/MessageQueueSenderIF.h>
|
#include <framework/ipc/MessageQueueSenderIF.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface is used by the device handler to send a device response
|
||||||
|
* to the queue ID, which is returned in the implemented abstract method.
|
||||||
|
*/
|
||||||
class AcceptsDeviceResponsesIF {
|
class AcceptsDeviceResponsesIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -19,4 +16,4 @@ public:
|
|||||||
virtual MessageQueueId_t getDeviceQueue() = 0;
|
virtual MessageQueueId_t getDeviceQueue() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ACCEPTSDEVICERESPONSESIF_H_ */
|
#endif /* FRAMEWORK_DEVICEHANDLERS_ACCEPTSDEVICERESPONSESIF_H_ */
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
|
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t deviceCommunication, CookieIF * cookie,
|
object_id_t deviceCommunication, CookieIF * cookie,
|
||||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
object_id_t hkDestination, uint32_t thermalStatePoolId,
|
||||||
uint32_t parent, FailureIsolationBase* customFdir, size_t cmdQueueSize) :
|
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||||
|
FailureIsolationBase* customFdir, size_t cmdQueueSize) :
|
||||||
DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
|
DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
|
||||||
setDeviceSwitch, thermalStatePoolId,
|
hkDestination, setDeviceSwitch, thermalStatePoolId,
|
||||||
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir),
|
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir),
|
||||||
cmdQueueSize),
|
cmdQueueSize),
|
||||||
parentId(parent), childHandlerFdir(setObjectId) {
|
parentId(parent), childHandlerFdir(setObjectId) {
|
||||||
|
@ -8,9 +8,9 @@ class ChildHandlerBase: public DeviceHandlerBase {
|
|||||||
public:
|
public:
|
||||||
ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||||
CookieIF * cookie, uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
CookieIF * cookie, uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
object_id_t hkDestination, uint32_t thermalStatePoolId,
|
||||||
uint32_t parent, FailureIsolationBase* customFdir = nullptr,
|
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||||
size_t cmdQueueSize = 20);
|
FailureIsolationBase* customFdir = nullptr, size_t cmdQueueSize = 20);
|
||||||
virtual ~ChildHandlerBase();
|
virtual ~ChildHandlerBase();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize();
|
||||||
|
@ -22,21 +22,21 @@ object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
|||||||
|
|
||||||
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
||||||
object_id_t deviceCommunication, CookieIF * comCookie,
|
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
uint8_t setDeviceSwitch, object_id_t hkDestination,
|
||||||
uint32_t thermalRequestPoolId, FailureIsolationBase* fdirInstance,
|
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||||
size_t cmdQueueSize) :
|
FailureIsolationBase* fdirInstance, 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),
|
||||||
healthHelper(this,setObjectId), modeHelper(this), parameterHelper(this),
|
healthHelper(this,setObjectId), modeHelper(this), parameterHelper(this),
|
||||||
actionHelper(this, nullptr), hkManager(this),
|
actionHelper(this, nullptr), hkManager(this, nullptr),
|
||||||
deviceThermalStatePoolId(thermalStatePoolId),
|
deviceThermalStatePoolId(thermalStatePoolId),
|
||||||
deviceThermalRequestPoolId(thermalRequestPoolId),
|
deviceThermalRequestPoolId(thermalRequestPoolId),
|
||||||
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
||||||
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
||||||
switchOffWasReported(false), childTransitionDelay(5000),
|
switchOffWasReported(false), hkDestination(hkDestination),
|
||||||
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(
|
childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
|
||||||
SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
|
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||||
insertInCommandMap(RAW_COMMAND_ID);
|
insertInCommandMap(RAW_COMMAND_ID);
|
||||||
@ -173,7 +173,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = hkManager.initializeHousekeepingPoolEntriesOnce();
|
result = hkManager.initialize(commandQueue, hkDestination);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -315,6 +315,12 @@ void DeviceHandlerBase::doStateMachine() {
|
|||||||
case _MODE_WAIT_OFF: {
|
case _MODE_WAIT_OFF: {
|
||||||
uint32_t currentUptime;
|
uint32_t currentUptime;
|
||||||
Clock::getUptime(¤tUptime);
|
Clock::getUptime(¤tUptime);
|
||||||
|
|
||||||
|
if(powerSwitcher == nullptr) {
|
||||||
|
setMode(MODE_OFF);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
|
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
|
||||||
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT,
|
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT,
|
||||||
0);
|
0);
|
||||||
@ -696,19 +702,23 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
|
|
||||||
if (info->delayCycles != 0) {
|
if (info->delayCycles != 0) {
|
||||||
|
|
||||||
if (info->periodic != 0) {
|
if (info->periodic != false) {
|
||||||
info->delayCycles = info->maxDelayCycles;
|
info->delayCycles = info->maxDelayCycles;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
info->delayCycles = 0;
|
info->delayCycles = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = interpretDeviceReply(foundId, receivedData);
|
result = interpretDeviceReply(foundId, receivedData);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
// Report failed interpretation to FDIR.
|
// Report failed interpretation to FDIR.
|
||||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
||||||
}
|
}
|
||||||
replyToReply(iter, result);
|
replyToReply(iter, result);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Other completion failure messages are created by timeout.
|
// Other completion failure messages are created by timeout.
|
||||||
// Powering down the device might take some time during which periodic
|
// Powering down the device might take some time during which periodic
|
||||||
// replies may still come in.
|
// replies may still come in.
|
||||||
@ -719,7 +729,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
||||||
uint8_t * *data, uint32_t * len) {
|
uint8_t** data, uint32_t * len) {
|
||||||
size_t lenTmp;
|
size_t lenTmp;
|
||||||
|
|
||||||
if (IPCStore == nullptr) {
|
if (IPCStore == nullptr) {
|
||||||
|
@ -107,6 +107,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||||
CookieIF * comCookie, uint8_t setDeviceSwitch,
|
CookieIF * comCookie, uint8_t setDeviceSwitch,
|
||||||
|
object_id_t hkDestination = objects::NO_OBJECT,
|
||||||
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||||
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
||||||
FailureIsolationBase* fdirInstance = nullptr,
|
FailureIsolationBase* fdirInstance = nullptr,
|
||||||
@ -652,11 +653,13 @@ protected:
|
|||||||
size_t replyLen = 0; //!< Expected size of the reply.
|
size_t replyLen = 0; //!< Expected size of the reply.
|
||||||
//! if this is !=0, the delayCycles will not be reset to 0 but to
|
//! if this is !=0, the delayCycles will not be reset to 0 but to
|
||||||
//! maxDelayCycles
|
//! maxDelayCycles
|
||||||
bool periodic;
|
bool periodic = false;
|
||||||
//! The dataset used to access housekeeping data related to the
|
//! The dataset used to access housekeeping data related to the
|
||||||
//! respective device reply. Will point to a dataset held by
|
//! respective device reply. Will point to a dataset held by
|
||||||
//! the child handler (if one is specified)
|
//! the child handler (if one is specified)
|
||||||
DataSetIF* dataSet;
|
DataSetIF* dataSet = nullptr;
|
||||||
|
float collectionInterval = 0.0;
|
||||||
|
uint32_t intervalCounter = 0;
|
||||||
//! The command that expects this reply.
|
//! The command that expects this reply.
|
||||||
DeviceCommandMap::iterator command;
|
DeviceCommandMap::iterator command;
|
||||||
};
|
};
|
||||||
@ -1035,18 +1038,19 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info about the #cookie
|
* @brief Info about the #cookie
|
||||||
*
|
|
||||||
* Used to track the state of the communication
|
* Used to track the state of the communication
|
||||||
*/
|
*/
|
||||||
CookieInfo cookieInfo;
|
CookieInfo cookieInfo;
|
||||||
|
|
||||||
/** the object used to set power switches*/
|
/** the object used to set power switches */
|
||||||
PowerSwitchIF *powerSwitcher = nullptr;
|
PowerSwitchIF *powerSwitcher = nullptr;
|
||||||
|
|
||||||
|
/** Cached for initialize() */
|
||||||
|
object_id_t hkDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for timing out mode transitions.
|
* @brief Used for timing out mode transitions.
|
||||||
*
|
|
||||||
* Set when setMode() is called.
|
* Set when setMode() is called.
|
||||||
*/
|
*/
|
||||||
uint32_t timeoutStart = 0;
|
uint32_t timeoutStart = 0;
|
||||||
@ -1057,11 +1061,12 @@ private:
|
|||||||
uint32_t childTransitionDelay;
|
uint32_t childTransitionDelay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mode the current transition originated from
|
* @brief The mode the current transition originated from
|
||||||
*
|
*
|
||||||
* This is private so the child can not change it and fuck up the timeouts
|
* This is private so the child can not change it and fuck up the timeouts
|
||||||
*
|
*
|
||||||
* IMPORTANT: This is not valid during _MODE_SHUT_DOWN and _MODE_START_UP!! (it is _MODE_POWER_DOWN during this modes)
|
* IMPORTANT: This is not valid during _MODE_SHUT_DOWN and _MODE_START_UP!!
|
||||||
|
* (it is _MODE_POWER_DOWN during this modes)
|
||||||
*
|
*
|
||||||
* is element of [MODE_ON, MODE_NORMAL, MODE_RAW]
|
* is element of [MODE_ON, MODE_NORMAL, MODE_RAW]
|
||||||
*/
|
*/
|
||||||
|
11
housekeeping/AcceptsHkPacketsIF.h
Normal file
11
housekeeping/AcceptsHkPacketsIF.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
|
||||||
|
#define FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
|
||||||
|
#include <framework/ipc/MessageQueueMessageIF.h>
|
||||||
|
|
||||||
|
class AcceptsHkPacketsIF {
|
||||||
|
public:
|
||||||
|
virtual~ AcceptsHkPacketsIF() {};
|
||||||
|
virtual MessageQueueId_t getHkQueue() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_ */
|
@ -89,7 +89,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getCommandQueue();
|
virtual MessageQueueId_t getCommandQueue();
|
||||||
|
|
||||||
virtual ReturnValue_t initialize();
|
virtual ReturnValue_t initialize() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of ExecutableObjectIF function
|
* Implementation of ExecutableObjectIF function
|
||||||
|
Loading…
Reference in New Issue
Block a user