hk message continued
This commit is contained in:
parent
f9612afe06
commit
2d2316a0c7
@ -193,10 +193,10 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
// and now we set a HK message and send it the HK packet destination.
|
||||
CommandMessage hkMessage;
|
||||
if(isDiagnostics) {
|
||||
HousekeepingMessage::setHkDiagnosticsMessage(&hkMessage, sid, storeId);
|
||||
HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId);
|
||||
}
|
||||
else {
|
||||
HousekeepingMessage::setHkReportMessage(&hkMessage, sid, storeId);
|
||||
HousekeepingMessage::setHkReportReply(&hkMessage, sid, storeId);
|
||||
}
|
||||
|
||||
if(hkQueue == nullptr) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
HousekeepingMessage::~HousekeepingMessage() {}
|
||||
|
||||
void HousekeepingMessage::setHkReportMessage(CommandMessage* message, sid_t sid,
|
||||
void HousekeepingMessage::setHkReportReply(CommandMessage* message, sid_t sid,
|
||||
store_address_t storeId) {
|
||||
message->setCommand(HK_REPORT);
|
||||
message->setMessageSize(HK_MESSAGE_SIZE);
|
||||
@ -11,7 +11,7 @@ void HousekeepingMessage::setHkReportMessage(CommandMessage* message, sid_t sid,
|
||||
message->setParameter3(storeId.raw);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message,
|
||||
void HousekeepingMessage::setHkDiagnosticsReply(CommandMessage* message,
|
||||
sid_t sid, store_address_t storeId) {
|
||||
message->setCommand(DIAGNOSTICS_REPORT);
|
||||
message->setMessageSize(HK_MESSAGE_SIZE);
|
||||
@ -19,7 +19,7 @@ void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message,
|
||||
message->setParameter3(storeId.raw);
|
||||
}
|
||||
|
||||
sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message,
|
||||
sid_t HousekeepingMessage::getHkDataReply(const CommandMessage *message,
|
||||
store_address_t *storeIdToSet) {
|
||||
if(storeIdToSet != nullptr) {
|
||||
*storeIdToSet = message->getParameter3();
|
||||
@ -27,7 +27,7 @@ sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message,
|
||||
return getSid(message);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setToggleReportingMessage(CommandMessage *message,
|
||||
void HousekeepingMessage::setToggleReportingCommand(CommandMessage *message,
|
||||
sid_t sid, bool enableReporting, bool isDiagnostics) {
|
||||
if(isDiagnostics) {
|
||||
if(enableReporting) {
|
||||
@ -49,6 +49,52 @@ void HousekeepingMessage::setToggleReportingMessage(CommandMessage *message,
|
||||
setSid(message, sid);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setStructureReportingCommand(CommandMessage *command,
|
||||
sid_t sid, bool isDiagnostics) {
|
||||
if(isDiagnostics) {
|
||||
command->setCommand(REPORT_DIAGNOSTICS_REPORT_STRUCTURES);
|
||||
}
|
||||
else {
|
||||
command->setCommand(REPORT_HK_REPORT_STRUCTURES);
|
||||
}
|
||||
|
||||
setSid(command, sid);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setOneShotReportCommand(CommandMessage *command,
|
||||
sid_t sid, bool isDiagnostics) {
|
||||
if(isDiagnostics) {
|
||||
command->setCommand(GENERATE_ONE_DIAGNOSTICS_REPORT);
|
||||
}
|
||||
else {
|
||||
command->setCommand(GENERATE_ONE_PARAMETER_REPORT);
|
||||
}
|
||||
|
||||
setSid(command, sid);
|
||||
}
|
||||
|
||||
void HousekeepingMessage::setCollectionIntervalModificationCommand(
|
||||
CommandMessage *command, sid_t sid, float collectionInterval,
|
||||
bool isDiagnostics) {
|
||||
if(isDiagnostics) {
|
||||
command->setCommand(MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL);
|
||||
}
|
||||
else {
|
||||
command->setCommand(MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL);
|
||||
}
|
||||
command->setParameter3(collectionInterval);
|
||||
|
||||
setSid(command, sid);
|
||||
}
|
||||
|
||||
sid_t HousekeepingMessage::getCollectionIntervalModificationCommand(
|
||||
const CommandMessage* command, float* newCollectionInterval) {
|
||||
if(newCollectionInterval != nullptr) {
|
||||
*newCollectionInterval = command->getParameter3();
|
||||
}
|
||||
|
||||
return getSid(command);
|
||||
}
|
||||
|
||||
sid_t HousekeepingMessage::getSid(const CommandMessage* message) {
|
||||
sid_t sid;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_HK_HOUSEKEEPINGMESSAGE_H_
|
||||
#define FRAMEWORK_HK_HOUSEKEEPINGMESSAGE_H_
|
||||
#ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
|
||||
#define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_
|
||||
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../ipc/FwMessageTypes.h"
|
||||
@ -49,9 +49,8 @@ public:
|
||||
sizeof(sid_t) + sizeof(uint32_t);
|
||||
|
||||
/**
|
||||
* The HK message is initialized with a pointer to a message which holds
|
||||
* the message data, see CommandMessageIF and getInternalMessage().
|
||||
* @param message
|
||||
* Concrete instance is not used, instead this class operates on
|
||||
* command message instances.
|
||||
*/
|
||||
HousekeepingMessage() = delete;
|
||||
virtual ~HousekeepingMessage();
|
||||
@ -68,11 +67,6 @@ public:
|
||||
static constexpr Command_t DISABLE_PERIODIC_DIAGNOSTICS_GENERATION =
|
||||
MAKE_COMMAND_ID(8);
|
||||
|
||||
static constexpr Command_t REPORTING_TOGGLE_SUCCESS =
|
||||
MAKE_COMMAND_ID(128);
|
||||
static constexpr Command_t REPORTING_TOGGLE_FAILURE =
|
||||
MAKE_COMMAND_ID(129);
|
||||
|
||||
static constexpr Command_t REPORT_HK_REPORT_STRUCTURES = MAKE_COMMAND_ID(9);
|
||||
static constexpr Command_t REPORT_DIAGNOSTICS_REPORT_STRUCTURES =
|
||||
MAKE_COMMAND_ID(11);
|
||||
@ -88,33 +82,48 @@ public:
|
||||
static constexpr Command_t GENERATE_ONE_DIAGNOSTICS_REPORT =
|
||||
MAKE_COMMAND_ID(28);
|
||||
|
||||
static constexpr Command_t APPEND_PARAMETERS_TO_PARAMETER_REPORT_STRUCTURE =
|
||||
MAKE_COMMAND_ID(29);
|
||||
static constexpr Command_t APPEND_PARAMETERS_TO_DIAGNOSTICS_REPORT_STRUCTURE =
|
||||
MAKE_COMMAND_ID(30);
|
||||
|
||||
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);
|
||||
|
||||
static constexpr Command_t HK_REQUEST_SUCCESS =
|
||||
MAKE_COMMAND_ID(128);
|
||||
static constexpr Command_t HK_REQUEST_FAILURE =
|
||||
MAKE_COMMAND_ID(129);
|
||||
|
||||
static sid_t getSid(const CommandMessage* message);
|
||||
|
||||
static void setToggleReportingMessage(CommandMessage* message, sid_t sid,
|
||||
static void setToggleReportingCommand(CommandMessage* command, sid_t sid,
|
||||
bool enableReporting, bool isDiagnostics);
|
||||
static void setHkReportMessage(CommandMessage* message, sid_t sid,
|
||||
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,
|
||||
store_address_t storeId);
|
||||
static void setHkDiagnosticsMessage(CommandMessage* message, sid_t sid,
|
||||
static void setHkDiagnosticsReply(CommandMessage* reply, sid_t sid,
|
||||
store_address_t storeId);
|
||||
|
||||
//! Get the respective SID and store ID. Command ID can be used beforehand
|
||||
//! to distinguish between diagnostics and regular HK packets
|
||||
static sid_t getHkReportMessage(const CommandMessage* message,
|
||||
/**
|
||||
* @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,
|
||||
store_address_t * storeIdToSet);
|
||||
static sid_t getCollectionIntervalModificationCommand(
|
||||
const CommandMessage* command, float* newCollectionInterval);
|
||||
|
||||
private:
|
||||
static void setSid(CommandMessage* message, sid_t sid);
|
||||
};
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_HK_HOUSEKEEPINGMESSAGE_H_ */
|
||||
#endif /* FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user