New reporting mode

This commit is contained in:
Robin Müller 2020-08-23 21:00:25 +02:00
parent 2f53a3fb1b
commit 2b63f1b3f3
4 changed files with 17 additions and 28 deletions

View File

@ -8,6 +8,8 @@
#include <array> #include <array>
#include <cmath> #include <cmath>
object_id_t LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner,
MessageQueueIF* queueToUse, bool appendValidityBuffer): MessageQueueIF* queueToUse, bool appendValidityBuffer):
appendValidityBuffer(appendValidityBuffer) { appendValidityBuffer(appendValidityBuffer) {
@ -31,29 +33,13 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner,
} }
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse, ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse,
object_id_t hkDestination, uint8_t nonDiagInvlFactor) { uint8_t nonDiagInvlFactor) {
if(queueToUse == nullptr) { if(queueToUse == nullptr) {
sif::error << "LocalDataPoolManager::initialize: Supplied queue " sif::error << "LocalDataPoolManager::initialize: Supplied queue "
"invalid!" << std::endl; "invalid!" << std::endl;
} }
hkQueue = queueToUse; 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. " << std::flush;
sif::warning << "Make sure it exists and the object impements "
"AcceptsHkPacketsIF!" << std::endl;
}
setNonDiagnosticIntervalFactor(nonDiagInvlFactor); setNonDiagnosticIntervalFactor(nonDiagInvlFactor);
diagnosticMinimumInterval = owner->getPeriodicOperationFrequency(); diagnosticMinimumInterval = owner->getPeriodicOperationFrequency();
regularMinimumInterval = diagnosticMinimumInterval * nonDiagnosticIntervalFactor; regularMinimumInterval = diagnosticMinimumInterval * nonDiagnosticIntervalFactor;
@ -228,7 +214,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
performPeriodicHkGeneration(receiver); performPeriodicHkGeneration(receiver);
break; break;
} }
case(ReportingType::ON_UPDATE): { case(ReportingType::UPDATE_SNAPSHOT): {
// check whether data has changed and send messages in case it has. // check whether data has changed and send messages in case it has.
break; break;
} }

View File

@ -15,8 +15,13 @@
#include <map> #include <map>
namespace Factory {
void setStaticFrameworkObjectIds();
}
class LocalDataSetBase; class LocalDataSetBase;
/** /**
* @brief This class is the managing instance for local data pool. * @brief This class is the managing instance for local data pool.
* @details * @details
@ -40,6 +45,7 @@ class LocalDataPoolManager {
template<typename T, uint16_t vecSize> template<typename T, uint16_t vecSize>
friend class LocalPoolVector; friend class LocalPoolVector;
friend class LocalPoolDataSetBase; friend class LocalPoolDataSetBase;
friend void (Factory::setStaticFrameworkObjectIds)();
public: public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER; static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
@ -71,7 +77,7 @@ public:
* @return * @return
*/ */
ReturnValue_t initialize(MessageQueueIF* queueToUse, ReturnValue_t initialize(MessageQueueIF* queueToUse,
object_id_t hkDestination, uint8_t nonDiagInvlFactor = 5); uint8_t nonDiagInvlFactor = 5);
/** /**
* Non-Diagnostics packets usually have a lower minimum sampling frequency * Non-Diagnostics packets usually have a lower minimum sampling frequency
@ -136,9 +142,10 @@ public:
enum class ReportingType: uint8_t { enum class ReportingType: uint8_t {
// Periodic generation of HK packets. // Periodic generation of HK packets.
PERIODIC, PERIODIC,
UPDATE_NOTIFICATION,
// Notification will be sent out as message. // Notification will be sent out as message.
// Data is accessed via shared data set or multiple local data sets. // Data is accessed via shared data set or multiple local data sets.
ON_UPDATE, UPDATE_SNAPSHOT,
}; };
/* Copying forbidden */ /* Copying forbidden */
@ -157,6 +164,9 @@ private:
dur_millis_t regularMinimumInterval = 0; dur_millis_t regularMinimumInterval = 0;
dur_millis_t diagnosticMinimumInterval = 0; dur_millis_t diagnosticMinimumInterval = 0;
/** Default receiver for periodic HK packets */
static object_id_t defaultHkDestination;
/** The data pool manager will keep an internal map of HK receivers. */ /** The data pool manager will keep an internal map of HK receivers. */
struct HkReceiver { struct HkReceiver {
/** Different member of this union will be used depending on the /** Different member of this union will be used depending on the

View File

@ -19,7 +19,6 @@
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,
@ -194,11 +193,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
return result; return result;
} }
if(hkDestination == objects::NO_OBJECT) { result = hkManager.initialize(commandQueue);
hkDestination = defaultHkDestination;
}
result = hkManager.initialize(commandQueue, hkDestination);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }

View File

@ -1043,8 +1043,6 @@ private:
/** the object used to set power switches */ /** the object used to set power switches */
PowerSwitchIF *powerSwitcher = nullptr; PowerSwitchIF *powerSwitcher = nullptr;
/** Cached for initialize() */
static object_id_t defaultHkDestination;
/** HK destination can also be set individually */ /** HK destination can also be set individually */
object_id_t hkDestination = objects::NO_OBJECT; object_id_t hkDestination = objects::NO_OBJECT;