added new messages
This commit is contained in:
parent
9917f7126d
commit
72ca2bfa43
@ -1,6 +1,8 @@
|
||||
#ifndef FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
||||
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
|
||||
|
||||
#include "locPoolDefinitions.h"
|
||||
|
||||
#include "../datapool/PoolEntryIF.h"
|
||||
#include "../ipc/MessageQueueSenderIF.h"
|
||||
#include "../housekeeping/HousekeepingMessage.h"
|
||||
@ -10,10 +12,6 @@
|
||||
class LocalDataPoolManager;
|
||||
class LocalPoolDataSetBase;
|
||||
|
||||
/**
|
||||
* @brief Type definition for local pool entries.
|
||||
*/
|
||||
using lp_id_t = uint32_t;
|
||||
using LocalDataPool = std::map<lp_id_t, PoolEntryIF*>;
|
||||
using LocalDataPoolMapIter = LocalDataPool::iterator;
|
||||
|
||||
@ -78,6 +76,28 @@ public:
|
||||
*/
|
||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) = 0;
|
||||
|
||||
/**
|
||||
* @brief This function will be called by the manager if an update
|
||||
* notification is received.
|
||||
* @details
|
||||
* Can be overriden by the child class to handle changed datasets.
|
||||
* @param sid
|
||||
*/
|
||||
virtual void handleChangedDatasetOrVariable(sid_t sid) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function will be called by the manager if an update
|
||||
* notification is received.
|
||||
* @details
|
||||
* Can be overriden by the child class to handle changed pool IDs.
|
||||
* @param sid
|
||||
*/
|
||||
virtual void handleChangedPoolVariable(lp_id_t poolId) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* These function can be implemented by pool owner, as they are required
|
||||
* by the housekeeping message interface */
|
||||
virtual ReturnValue_t addDataSet(sid_t sid) {
|
||||
|
@ -91,7 +91,8 @@ public:
|
||||
ReturnValue_t initializeAfterTaskCreation(uint8_t nonDiagInvlFactor = 5);
|
||||
|
||||
/**
|
||||
* This should be called in the periodic handler of the owner.
|
||||
* @brief This should be called in the periodic handler of the owner.
|
||||
* @details
|
||||
* It performs all the periodic functionalities of the data pool manager,
|
||||
* for example generating periodic HK packets.
|
||||
* @return
|
||||
@ -99,12 +100,47 @@ public:
|
||||
ReturnValue_t performHkOperation();
|
||||
|
||||
/**
|
||||
* @brief Subscribe for the generation of periodic packets.
|
||||
* @details
|
||||
* This will most commonly be used to generate housekeeping packets
|
||||
* which are downlinked directly.
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
|
||||
float collectionInterval, bool isDiagnostics,
|
||||
object_id_t packetDestination = defaultHkDestination);
|
||||
|
||||
/**
|
||||
* @brief Subscribe for the generation of packets if the dataset
|
||||
* is marked as changed.
|
||||
* @param sid
|
||||
* @param isDiagnostics
|
||||
* @param packetDestination
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t subscribeForUpdatePackets(sid_t sid, bool isDiagnostics,
|
||||
object_id_t packetDestination = defaultHkDestination);
|
||||
|
||||
/**
|
||||
* @brief Subscribe for a notification message which will be sent
|
||||
* if a dataset has changed.
|
||||
* @param sid
|
||||
* @param targetQueueId
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t subscribeForUpdateMessages(sid_t sid,
|
||||
MessageQueueId_t targetQueueId);
|
||||
|
||||
/**
|
||||
* @brief Subscribe for an notification message which will be sent if a
|
||||
* pool variable has changed.
|
||||
* @param sid
|
||||
* @param targetQueueId
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t subscribeForUpdateMessages(lp_id_t localPoolId,
|
||||
MessageQueueId_t targetQueueId);
|
||||
|
||||
/**
|
||||
* Non-Diagnostics packets usually have a lower minimum sampling frequency
|
||||
* than diagnostic packets.
|
||||
@ -116,6 +152,19 @@ public:
|
||||
*/
|
||||
void setNonDiagnosticIntervalFactor(uint8_t nonDiagInvlFactor);
|
||||
|
||||
/**
|
||||
* @brief The manager is also able to handle housekeeping messages.
|
||||
* @details
|
||||
* This most commonly is used to handle messages for the housekeeping
|
||||
* interface, but the manager is also able to handle update notifications
|
||||
* and calls a special function which can be overriden by a child class
|
||||
* to handle data set or pool variable updates. This is relevant
|
||||
* for classes like controllers which have their own local datapool
|
||||
* but pull their data from other local datapools.
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t handleHousekeepingMessage(CommandMessage* message);
|
||||
|
||||
/**
|
||||
* Generate a housekeeping packet with a given SID.
|
||||
@ -126,16 +175,6 @@ public:
|
||||
LocalPoolDataSetBase* dataSet, bool forDownlink,
|
||||
MessageQueueId_t destination = MessageQueueIF::NO_QUEUE);
|
||||
|
||||
ReturnValue_t handleHousekeepingMessage(CommandMessage* message);
|
||||
|
||||
/**
|
||||
* This function is used to fill the local data pool map with pool
|
||||
* entries. It should only be called once by the pool owner.
|
||||
* @param localDataPoolMap
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t initializeHousekeepingPoolEntriesOnce();
|
||||
|
||||
HasLocalDataPoolIF* getOwner();
|
||||
|
||||
ReturnValue_t printPoolEntry(lp_id_t localPoolId);
|
||||
@ -255,6 +294,14 @@ private:
|
||||
template <class T> ReturnValue_t fetchPoolEntry(lp_id_t localPoolId,
|
||||
PoolEntry<T> **poolEntry);
|
||||
|
||||
/**
|
||||
* This function is used to fill the local data pool map with pool
|
||||
* entries. It should only be called once by the pool owner.
|
||||
* @param localDataPoolMap
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t initializeHousekeepingPoolEntriesOnce();
|
||||
|
||||
ReturnValue_t serializeHkPacketIntoStore(
|
||||
HousekeepingPacketDownlink& hkPacket,
|
||||
store_address_t& storeId, bool forDownlink, size_t* serializedSize);
|
||||
|
51
datapoollocal/locPoolDefinitions.h
Normal file
51
datapoollocal/locPoolDefinitions.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_
|
||||
#define FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include "../objectmanager/SystemObjectIF.h"
|
||||
#include "../objectmanager/frameworkObjects.h"
|
||||
|
||||
/**
|
||||
* @brief Type definition for local pool entries.
|
||||
*/
|
||||
using lp_id_t = uint32_t;
|
||||
|
||||
|
||||
union sid_t {
|
||||
static constexpr uint64_t INVALID_SID = -1;
|
||||
static constexpr uint32_t INVALID_SET_ID = -1;
|
||||
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
||||
sid_t(): raw(INVALID_SID) {}
|
||||
|
||||
sid_t(object_id_t objectId, uint32_t setId):
|
||||
objectId(objectId),
|
||||
ownerSetId(setId) {}
|
||||
|
||||
struct {
|
||||
object_id_t objectId ;
|
||||
/**
|
||||
* A generic 32 bit ID to identify unique HK packets for a single
|
||||
* object. For example, the DeviceCommandId_t is used for
|
||||
* DeviceHandlers
|
||||
*/
|
||||
uint32_t ownerSetId;
|
||||
};
|
||||
/**
|
||||
* Alternative access to the raw value. This is also the size of the type.
|
||||
*/
|
||||
uint64_t raw;
|
||||
|
||||
bool notSet() const {
|
||||
return raw == INVALID_SID;
|
||||
}
|
||||
|
||||
bool operator==(const sid_t& other) const {
|
||||
return raw == other.raw;
|
||||
}
|
||||
|
||||
bool operator!=(const sid_t& other) const {
|
||||
return not (raw == other.raw);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FSFW_DATAPOOLLOCAL_LOCPOOLDEFINITIONS_H_ */
|
@ -1,5 +1,6 @@
|
||||
#ifndef FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
|
||||
#define FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
|
||||
|
||||
#include "../ipc/MessageQueueMessageIF.h"
|
||||
|
||||
class AcceptsHkPacketsIF {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include "HousekeepingMessage.h"
|
||||
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include <cstring>
|
||||
|
||||
HousekeepingMessage::~HousekeepingMessage() {}
|
||||
@ -148,7 +149,7 @@ void HousekeepingMessage::clear(CommandMessage* message) {
|
||||
case(DIAGNOSTICS_REPORT):
|
||||
case(HK_DEFINITIONS_REPORT):
|
||||
case(DIAGNOSTICS_DEFINITION_REPORT):
|
||||
case(UPDATE_SNAPSHOT): {
|
||||
case(UPDATE_SNAPSHOT_SET): {
|
||||
store_address_t storeId;
|
||||
getHkDataReply(message, &storeId);
|
||||
StorageManagerIF *ipcStore = objectManager->get<StorageManagerIF>(
|
||||
@ -160,3 +161,55 @@ void HousekeepingMessage::clear(CommandMessage* message) {
|
||||
}
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setUpdateNotificationSetCommand(
|
||||
CommandMessage *command, sid_t sid) {
|
||||
command->setCommand(UPDATE_NOTIFICATION_SET);
|
||||
setSid(command, sid);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setUpdateNotificationVariableCommand(
|
||||
CommandMessage *command, lp_id_t localPoolId) {
|
||||
command->setCommand(UPDATE_NOTIFICATION_VARIABLE);
|
||||
command->setParameter(localPoolId);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setUpdateSnapshotSetCommand(CommandMessage *command,
|
||||
sid_t sid, store_address_t storeId) {
|
||||
command->setCommand(UPDATE_SNAPSHOT_VARIABLE);
|
||||
setSid(command, sid);
|
||||
command->setParameter3(storeId.raw);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setUpdateSnapshotVariableCommand(
|
||||
CommandMessage *command, lp_id_t localPoolId, store_address_t storeId) {
|
||||
command->setCommand(UPDATE_SNAPSHOT_VARIABLE);
|
||||
command->setParameter(localPoolId);
|
||||
command->setParameter3(storeId.raw);
|
||||
}
|
||||
|
||||
sid_t HousekeepingMessage::getUpdateNotificationSetCommand(
|
||||
const CommandMessage *command) {
|
||||
return getSid(command);
|
||||
}
|
||||
|
||||
lp_id_t HousekeepingMessage::getUpdateNotificationVariableCommand(
|
||||
const CommandMessage *command) {
|
||||
return command->getParameter();
|
||||
}
|
||||
|
||||
sid_t HousekeepingMessage::getUpdateSnapshotSetCommand(
|
||||
const CommandMessage *command, store_address_t *storeId) {
|
||||
if(storeId != nullptr) {
|
||||
*storeId = command->getParameter3();
|
||||
}
|
||||
return getSid(command);
|
||||
}
|
||||
|
||||
lp_id_t HousekeepingMessage::getUpdateSnapshotVariableCommand(
|
||||
const CommandMessage *command, store_address_t *storeId) {
|
||||
if(storeId != nullptr) {
|
||||
*storeId = command->getParameter3();
|
||||
}
|
||||
return command->getParameter();
|
||||
}
|
||||
|
@ -1,49 +1,12 @@
|
||||
#ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
|
||||
#define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
|
||||
|
||||
#include "../datapoollocal/locPoolDefinitions.h"
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../ipc/FwMessageTypes.h"
|
||||
#include "../objectmanager/frameworkObjects.h"
|
||||
#include "../objectmanager/SystemObjectIF.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
|
||||
union sid_t {
|
||||
static constexpr uint64_t INVALID_SID = -1;
|
||||
static constexpr uint32_t INVALID_SET_ID = -1;
|
||||
static constexpr uint32_t INVALID_OBJECT_ID = objects::NO_OBJECT;
|
||||
sid_t(): raw(INVALID_SID) {}
|
||||
|
||||
sid_t(object_id_t objectId, uint32_t setId):
|
||||
objectId(objectId),
|
||||
ownerSetId(setId) {}
|
||||
|
||||
struct {
|
||||
object_id_t objectId ;
|
||||
/**
|
||||
* A generic 32 bit ID to identify unique HK packets for a single
|
||||
* object. For example, the DeviceCommandId_t is used for
|
||||
* DeviceHandlers
|
||||
*/
|
||||
uint32_t ownerSetId;
|
||||
};
|
||||
/**
|
||||
* Alternative access to the raw value. This is also the size of the type.
|
||||
*/
|
||||
uint64_t raw;
|
||||
|
||||
bool notSet() const {
|
||||
return raw == INVALID_SID;
|
||||
}
|
||||
|
||||
bool operator==(const sid_t& other) const {
|
||||
return raw == other.raw;
|
||||
}
|
||||
|
||||
bool operator!=(const sid_t& other) const {
|
||||
return not (raw == other.raw);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Special command message type for housekeeping messages
|
||||
@ -101,14 +64,20 @@ public:
|
||||
static constexpr Command_t HK_REQUEST_FAILURE =
|
||||
MAKE_COMMAND_ID(129);
|
||||
|
||||
static constexpr Command_t UPDATE_NOTIFICATION = MAKE_COMMAND_ID(130);
|
||||
static constexpr Command_t UPDATE_SNAPSHOT = MAKE_COMMAND_ID(131);
|
||||
static constexpr Command_t UPDATE_NOTIFICATION_SET =
|
||||
MAKE_COMMAND_ID(130);
|
||||
static constexpr Command_t UPDATE_NOTIFICATION_VARIABLE =
|
||||
MAKE_COMMAND_ID(131);
|
||||
|
||||
static constexpr Command_t UPDATE_HK_REPORT = MAKE_COMMAND_ID(132);
|
||||
static constexpr Command_t UPDATE_SNAPSHOT_SET = MAKE_COMMAND_ID(132);
|
||||
static constexpr Command_t UPDATE_SNAPSHOT_VARIABLE = MAKE_COMMAND_ID(133);
|
||||
|
||||
//static constexpr Command_t UPDATE_HK_REPORT = MAKE_COMMAND_ID(134);
|
||||
|
||||
static sid_t getSid(const CommandMessage* message);
|
||||
|
||||
/** Setter functions */
|
||||
/* Housekeeping Interface Messages */
|
||||
|
||||
static void setToggleReportingCommand(CommandMessage* command, sid_t sid,
|
||||
bool enableReporting, bool isDiagnostics);
|
||||
static void setStructureReportingCommand(CommandMessage* command, sid_t sid,
|
||||
@ -148,6 +117,28 @@ public:
|
||||
static sid_t getCollectionIntervalModificationCommand(
|
||||
const CommandMessage* command, float* newCollectionInterval);
|
||||
|
||||
|
||||
/* Update Notification Messages */
|
||||
|
||||
static void setUpdateNotificationSetCommand(CommandMessage* command,
|
||||
sid_t sid);
|
||||
static void setUpdateNotificationVariableCommand(CommandMessage* command,
|
||||
lp_id_t localPoolId);
|
||||
|
||||
static void setUpdateSnapshotSetCommand(CommandMessage* command, sid_t sid,
|
||||
store_address_t storeId);
|
||||
static void setUpdateSnapshotVariableCommand(CommandMessage* command,
|
||||
lp_id_t localPoolId, store_address_t storeId);
|
||||
|
||||
sid_t getUpdateNotificationSetCommand(const CommandMessage* command);
|
||||
lp_id_t getUpdateNotificationVariableCommand(const CommandMessage* command);
|
||||
|
||||
sid_t getUpdateSnapshotSetCommand(const CommandMessage* command,
|
||||
store_address_t* storeId);
|
||||
lp_id_t getUpdateSnapshotVariableCommand(const CommandMessage* command,
|
||||
store_address_t* storeId);
|
||||
|
||||
/** Utility */
|
||||
static void clear(CommandMessage* message);
|
||||
private:
|
||||
static void setSid(CommandMessage* message, sid_t sid);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "../datapoollocal/LocalPoolDataSetBase.h"
|
||||
#include "PeriodicHousekeepingHelper.h"
|
||||
|
||||
#include "../datapoollocal/LocalPoolDataSetBase.h"
|
||||
#include <cmath>
|
||||
|
||||
PeriodicHousekeepingHelper::PeriodicHousekeepingHelper(
|
||||
|
Loading…
Reference in New Issue
Block a user