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

View File

@ -15,8 +15,13 @@
#include <map>
namespace Factory {
void setStaticFrameworkObjectIds();
}
class LocalDataSetBase;
/**
* @brief This class is the managing instance for local data pool.
* @details
@ -40,6 +45,7 @@ class LocalDataPoolManager {
template<typename T, uint16_t vecSize>
friend class LocalPoolVector;
friend class LocalPoolDataSetBase;
friend void (Factory::setStaticFrameworkObjectIds)();
public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::HOUSEKEEPING_MANAGER;
@ -71,7 +77,7 @@ public:
* @return
*/
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
@ -136,9 +142,10 @@ public:
enum class ReportingType: uint8_t {
// Periodic generation of HK packets.
PERIODIC,
UPDATE_NOTIFICATION,
// Notification will be sent out as message.
// Data is accessed via shared data set or multiple local data sets.
ON_UPDATE,
UPDATE_SNAPSHOT,
};
/* Copying forbidden */
@ -157,6 +164,9 @@ private:
dur_millis_t regularMinimumInterval = 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. */
struct HkReceiver {
/** 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::rawDataReceiverId = 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,
object_id_t deviceCommunication, CookieIF * comCookie,
@ -194,11 +193,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
return result;
}
if(hkDestination == objects::NO_OBJECT) {
hkDestination = defaultHkDestination;
}
result = hkManager.initialize(commandQueue, hkDestination);
result = hkManager.initialize(commandQueue);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}

View File

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