fsfw/housekeeping/HousekeepingMessage.h

150 lines
5.4 KiB
C
Raw Normal View History

2020-09-14 18:01:48 +02:00
#ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
#define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
2020-10-14 00:50:24 +02:00
#include "../datapoollocal/locPoolDefinitions.h"
#include "../ipc/CommandMessage.h"
#include "../ipc/FwMessageTypes.h"
2020-09-19 15:58:34 +02:00
#include "../objectmanager/frameworkObjects.h"
#include "../storagemanager/StorageManagerIF.h"
2020-05-17 01:17:11 +02:00
2020-06-14 19:03:28 +02:00
/**
* @brief Special command message type for housekeeping messages
* @details
* This message is slightly larger than regular command messages to accomodate
* the uint64_t structure ID (SID).
*/
2020-06-24 02:00:26 +02:00
class HousekeepingMessage {
2020-05-17 01:17:11 +02:00
public:
2020-06-17 20:21:49 +02:00
static constexpr size_t HK_MESSAGE_SIZE = CommandMessageIF::HEADER_SIZE +
sizeof(sid_t) + sizeof(uint32_t);
2020-06-14 19:03:28 +02:00
2020-05-17 01:17:11 +02:00
/**
2020-09-14 18:01:48 +02:00
* Concrete instance is not used, instead this class operates on
* command message instances.
2020-05-17 01:17:11 +02:00
*/
2020-06-24 02:00:26 +02:00
HousekeepingMessage() = delete;
virtual ~HousekeepingMessage();
2020-05-17 01:17:11 +02:00
static constexpr uint8_t MESSAGE_ID = messagetypes::HOUSEKEEPING;
2020-09-19 01:17:43 +02:00
static constexpr Command_t ENABLE_PERIODIC_HK_REPORT_GENERATION =
2020-05-17 01:17:11 +02:00
MAKE_COMMAND_ID(5);
static constexpr Command_t DISABLE_PERIODIC_HK_REPORT_GENERATION =
MAKE_COMMAND_ID(6);
static constexpr Command_t ENABLE_PERIODIC_DIAGNOSTICS_GENERATION =
MAKE_COMMAND_ID(7);
static constexpr Command_t DISABLE_PERIODIC_DIAGNOSTICS_GENERATION =
MAKE_COMMAND_ID(8);
static constexpr Command_t REPORT_HK_REPORT_STRUCTURES = MAKE_COMMAND_ID(9);
static constexpr Command_t REPORT_DIAGNOSTICS_REPORT_STRUCTURES =
MAKE_COMMAND_ID(11);
static constexpr Command_t HK_DEFINITIONS_REPORT = MAKE_COMMAND_ID(10);
static constexpr Command_t DIAGNOSTICS_DEFINITION_REPORT = MAKE_COMMAND_ID(12);
static constexpr Command_t HK_REPORT = MAKE_COMMAND_ID(25);
static constexpr Command_t DIAGNOSTICS_REPORT = MAKE_COMMAND_ID(26);
static constexpr Command_t GENERATE_ONE_PARAMETER_REPORT =
MAKE_COMMAND_ID(27);
static constexpr Command_t GENERATE_ONE_DIAGNOSTICS_REPORT =
MAKE_COMMAND_ID(28);
static constexpr Command_t MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL =
MAKE_COMMAND_ID(31);
static constexpr Command_t MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL =
MAKE_COMMAND_ID(32);
2020-09-14 18:01:48 +02:00
static constexpr Command_t HK_REQUEST_SUCCESS =
MAKE_COMMAND_ID(128);
static constexpr Command_t HK_REQUEST_FAILURE =
MAKE_COMMAND_ID(129);
2020-10-14 00:50:24 +02:00
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_SNAPSHOT_SET = MAKE_COMMAND_ID(132);
static constexpr Command_t UPDATE_SNAPSHOT_VARIABLE = MAKE_COMMAND_ID(133);
2020-09-28 22:48:10 +02:00
2020-10-14 00:50:24 +02:00
//static constexpr Command_t UPDATE_HK_REPORT = MAKE_COMMAND_ID(134);
2020-09-28 22:51:02 +02:00
2020-06-24 02:00:26 +02:00
static sid_t getSid(const CommandMessage* message);
2020-10-14 00:50:24 +02:00
/* Housekeeping Interface Messages */
2020-09-14 18:01:48 +02:00
static void setToggleReportingCommand(CommandMessage* command, sid_t sid,
2020-09-11 14:06:08 +02:00
bool enableReporting, bool isDiagnostics);
2020-09-14 18:01:48 +02:00
static void setStructureReportingCommand(CommandMessage* command, sid_t sid,
bool isDiagnostics);
static void setOneShotReportCommand(CommandMessage* command, sid_t sid,
bool isDiagnostics);
static void setCollectionIntervalModificationCommand(
CommandMessage* command, sid_t sid, float collectionInterval,
bool isDiagnostics);
static void setHkReportReply(CommandMessage* reply, sid_t sid,
2020-06-24 02:00:26 +02:00
store_address_t storeId);
2020-09-14 18:01:48 +02:00
static void setHkDiagnosticsReply(CommandMessage* reply, sid_t sid,
2020-06-24 02:00:26 +02:00
store_address_t storeId);
2020-09-19 17:08:08 +02:00
static void setHkRequestSuccessReply(CommandMessage* reply, sid_t sid);
static void setHkRequestFailureReply(CommandMessage* reply, sid_t sid,
ReturnValue_t error);
2020-09-26 15:27:06 +02:00
static void setHkStuctureReportReply(CommandMessage* reply,
sid_t sid, store_address_t storeId);
static void setDiagnosticsStuctureReportReply(CommandMessage* reply,
sid_t sid, store_address_t storeId);
2020-09-19 17:08:08 +02:00
static sid_t getHkRequestFailureReply(const CommandMessage* reply,
ReturnValue_t* error);
2020-09-14 18:01:48 +02:00
/**
* @brief Generic getter function for housekeeping data replies
* @details
* Command ID can be used beforehand to distinguish between diagnostics and
* regular HK packets. This getter function should be used for the
* command IDs 10, 12, 25 and 26.
*/
static sid_t getHkDataReply(const CommandMessage* message,
2020-06-24 02:00:26 +02:00
store_address_t * storeIdToSet);
2020-09-14 18:01:48 +02:00
static sid_t getCollectionIntervalModificationCommand(
const CommandMessage* command, float* newCollectionInterval);
2020-10-14 00:50:24 +02:00
/* 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);
2020-10-14 19:52:06 +02:00
static sid_t getUpdateNotificationSetCommand(const CommandMessage* command);
static lp_id_t getUpdateNotificationVariableCommand(
const CommandMessage* command);
2020-10-14 00:50:24 +02:00
2020-10-14 19:52:06 +02:00
static sid_t getUpdateSnapshotSetCommand(const CommandMessage* command,
2020-10-14 00:50:24 +02:00
store_address_t* storeId);
2020-10-14 19:52:06 +02:00
static lp_id_t getUpdateSnapshotVariableCommand(const CommandMessage* command,
2020-10-14 00:50:24 +02:00
store_address_t* storeId);
/** Utility */
2020-09-28 22:46:18 +02:00
static void clear(CommandMessage* message);
private:
2020-06-24 02:00:26 +02:00
static void setSid(CommandMessage* message, sid_t sid);
2020-05-17 01:17:11 +02:00
};
2020-09-14 18:01:48 +02:00
#endif /* FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ */