messagetype namespace im small letters now

This commit is contained in:
Robin Müller 2020-06-08 12:25:20 +02:00
parent 4c41456ddf
commit 0ea249aac4
15 changed files with 43 additions and 37 deletions

View File

@ -10,7 +10,7 @@ class ActionMessage {
private: private:
ActionMessage(); ActionMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::ACTION; static const uint8_t MESSAGE_ID = messagetypes::ACTION;
static const Command_t EXECUTE_ACTION = MAKE_COMMAND_ID(1); static const Command_t EXECUTE_ACTION = MAKE_COMMAND_ID(1);
static const Command_t STEP_SUCCESS = MAKE_COMMAND_ID(2); static const Command_t STEP_SUCCESS = MAKE_COMMAND_ID(2);
static const Command_t STEP_FAILED = MAKE_COMMAND_ID(3); static const Command_t STEP_FAILED = MAKE_COMMAND_ID(3);

View File

@ -25,7 +25,7 @@ public:
/** /**
* These are the commands that can be sent to a DeviceHandlerBase * These are the commands that can be sent to a DeviceHandlerBase
*/ */
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::DEVICE_HANDLER_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::DEVICE_HANDLER_COMMAND;
static const Command_t CMD_RAW = MAKE_COMMAND_ID( 1 ); //!< Sends a raw command, setParameter is a ::store_id_t containing the raw packet to send static const Command_t CMD_RAW = MAKE_COMMAND_ID( 1 ); //!< Sends a raw command, setParameter is a ::store_id_t containing the raw packet to send
// static const Command_t CMD_DIRECT = MAKE_COMMAND_ID( 2 ); //!< Sends a direct command, setParameter is a ::DeviceCommandId_t, setParameter2 is a ::store_id_t containing the data needed for the command // static const Command_t CMD_DIRECT = MAKE_COMMAND_ID( 2 ); //!< Sends a direct command, setParameter is a ::DeviceCommandId_t, setParameter2 is a ::store_id_t containing the data needed for the command
static const Command_t CMD_SWITCH_ADDRESS = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier static const Command_t CMD_SWITCH_ADDRESS = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier

View File

@ -6,7 +6,7 @@
class HealthMessage { class HealthMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::HEALTH_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND;
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY! static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY!
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5); static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);

View File

@ -33,7 +33,7 @@ public:
// HousekeepingMessage(const HousekeepingMessage&) = delete; // HousekeepingMessage(const HousekeepingMessage&) = delete;
// HousekeepingMessage operator=(const HousekeepingMessage &) = delete; // HousekeepingMessage operator=(const HousekeepingMessage &) = delete;
static constexpr uint8_t MESSAGE_ID = MESSAGE_TYPE::HOUSEKEEPING; static constexpr uint8_t MESSAGE_ID = messagetypes::HOUSEKEEPING;
static constexpr Command_t ADD_HK_REPORT_STRUCT = static constexpr Command_t ADD_HK_REPORT_STRUCT =
MAKE_COMMAND_ID(1); MAKE_COMMAND_ID(1);
static constexpr Command_t ADD_DIAGNOSTICS_REPORT_STRUCT = static constexpr Command_t ADD_DIAGNOSTICS_REPORT_STRUCT =

View File

@ -1,9 +1,4 @@
/** #include "MissionMessageTypes.h"
* @file CommandMessage.cpp
* @brief This file defines the CommandMessage class.
* @date 20.06.2013
* @author baetz
*/
#include <framework/devicehandlers/DeviceHandlerMessage.h> #include <framework/devicehandlers/DeviceHandlerMessage.h>
#include <framework/health/HealthMessage.h> #include <framework/health/HealthMessage.h>
@ -15,7 +10,8 @@
#include <framework/tmstorage/TmStoreMessage.h> #include <framework/tmstorage/TmStoreMessage.h>
#include <framework/parameters/ParameterMessage.h> #include <framework/parameters/ParameterMessage.h>
namespace MESSAGE_TYPE { namespace messagetypes {
// Implemented in config.
void clearMissionMessage(CommandMessage* message); void clearMissionMessage(CommandMessage* message);
} }
@ -39,6 +35,10 @@ Command_t CommandMessage::getCommand() const {
return command; return command;
} }
uint8_t CommandMessage::getMessageType() const {
return getCommand() >> 8 & 0xff;
}
void CommandMessage::setCommand(Command_t command) { void CommandMessage::setCommand(Command_t command) {
memcpy(getData(), &command, sizeof(command)); memcpy(getData(), &command, sizeof(command));
} }
@ -66,36 +66,36 @@ void CommandMessage::setParameter2(uint32_t parameter2) {
} }
void CommandMessage::clearCommandMessage() { void CommandMessage::clearCommandMessage() {
switch((getCommand()>>8) & 0xff){ switch(getMessageType()){
case MESSAGE_TYPE::MODE_COMMAND: case messagetypes::MODE_COMMAND:
ModeMessage::clear(this); ModeMessage::clear(this);
break; break;
case MESSAGE_TYPE::HEALTH_COMMAND: case messagetypes::HEALTH_COMMAND:
HealthMessage::clear(this); HealthMessage::clear(this);
break; break;
case MESSAGE_TYPE::MODE_SEQUENCE: case messagetypes::MODE_SEQUENCE:
ModeSequenceMessage::clear(this); ModeSequenceMessage::clear(this);
break; break;
case MESSAGE_TYPE::ACTION: case messagetypes::ACTION:
ActionMessage::clear(this); ActionMessage::clear(this);
break; break;
case MESSAGE_TYPE::DEVICE_HANDLER_COMMAND: case messagetypes::DEVICE_HANDLER_COMMAND:
DeviceHandlerMessage::clear(this); DeviceHandlerMessage::clear(this);
break; break;
case MESSAGE_TYPE::MEMORY: case messagetypes::MEMORY:
MemoryMessage::clear(this); MemoryMessage::clear(this);
break; break;
case MESSAGE_TYPE::MONITORING: case messagetypes::MONITORING:
MonitoringMessage::clear(this); MonitoringMessage::clear(this);
break; break;
case MESSAGE_TYPE::TM_STORE: case messagetypes::TM_STORE:
TmStoreMessage::clear(this); TmStoreMessage::clear(this);
break; break;
case MESSAGE_TYPE::PARAMETER: case messagetypes::PARAMETER:
ParameterMessage::clear(this); ParameterMessage::clear(this);
break; break;
default: default:
MESSAGE_TYPE::clearMissionMessage(this); messagetypes::clearMissionMessage(this);
break; break;
} }
} }

View File

@ -19,7 +19,7 @@ public:
static const ReturnValue_t UNKNOW_COMMAND = MAKE_RETURN_CODE(0x01); static const ReturnValue_t UNKNOW_COMMAND = MAKE_RETURN_CODE(0x01);
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::COMMAND; static const uint8_t MESSAGE_ID = messagetypes::COMMAND;
//! Used internally, will be ignored //! Used internally, will be ignored
static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 ); static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 );
static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 3 ); static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 3 );
@ -66,6 +66,7 @@ public:
*/ */
Command_t getCommand() const; Command_t getCommand() const;
uint8_t getMessageType() const;
/** /**
* Set the DeviceHandlerCOmmand_t of the message * Set the DeviceHandlerCOmmand_t of the message
* *

View File

@ -1,9 +1,9 @@
#ifndef FRAMEWORK_IPC_FWMESSAGETYPES_H_ #ifndef FRAMEWORK_IPC_FWMESSAGETYPES_H_
#define FRAMEWORK_IPC_FWMESSAGETYPES_H_ #define FRAMEWORK_IPC_FWMESSAGETYPES_H_
namespace MESSAGE_TYPE { namespace messagetypes {
//Remember to add new Message Types to the clearCommandMessage function! //Remember to add new Message Types to the clearCommandMessage function!
enum FW_MESSAGE_TYPE { enum FsfwMessageTypes {
COMMAND = 0, COMMAND = 0,
MODE_COMMAND, MODE_COMMAND,
HEALTH_COMMAND, HEALTH_COMMAND,

View File

@ -17,24 +17,29 @@ public:
* (till messageSize) to the debug output. * (till messageSize) to the debug output.
*/ */
virtual void print() = 0; virtual void print() = 0;
/**
* @brief Get read-only pointer to the raw buffer.
* @return
*/
virtual const uint8_t* getBuffer() const = 0; virtual const uint8_t* getBuffer() const = 0;
/** /**
* @brief This method is used to get the complete data of the message. * @brief This method is used to get the complete data of the message.
*/ */
virtual uint8_t* getBuffer() = 0; virtual uint8_t* getBuffer() = 0;
/** /**
* @brief This method is used to set the sender's message queue id * @brief This method is used to set the sender's message queue id
* information prior to sending the message. * information prior to sending the message.
* @param setId The message queue id that identifies the sending message queue. * @param setId
* The message queue id that identifies the sending message queue.
*/ */
virtual void setSender(MessageQueueId_t setId) = 0; virtual void setSender(MessageQueueId_t setId) = 0;
/** /**
* @brief This helper function is used by the MessageQueue class to * @brief This helper function is used by the MessageQueue class to
* check the size of an incoming message. * check the size of an incoming message.
* @details
* The method must be overwritten by child classes if size checks shall
* be more strict.
* @return The default implementation returns HEADER_SIZE.
*/ */
virtual size_t getMinimumMessageSize() = 0; virtual size_t getMinimumMessageSize() = 0;
}; };

View File

@ -16,7 +16,7 @@ class FileSystemMessage {
private: private:
FileSystemMessage(); //A private ctor inhibits instantiation FileSystemMessage(); //A private ctor inhibits instantiation
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::FILE_SYSTEM_MESSAGE; static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE;
static const Command_t CREATE_FILE = MAKE_COMMAND_ID( 0x01 ); static const Command_t CREATE_FILE = MAKE_COMMAND_ID( 0x01 );
static const Command_t DELETE_FILE = MAKE_COMMAND_ID( 0x02 ); static const Command_t DELETE_FILE = MAKE_COMMAND_ID( 0x02 );
static const Command_t WRITE_TO_FILE = MAKE_COMMAND_ID( 0x80 ); static const Command_t WRITE_TO_FILE = MAKE_COMMAND_ID( 0x80 );

View File

@ -9,7 +9,7 @@ class MemoryMessage {
private: private:
MemoryMessage(); //A private ctor inhibits instantiation MemoryMessage(); //A private ctor inhibits instantiation
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MEMORY; static const uint8_t MESSAGE_ID = messagetypes::MEMORY;
static const Command_t CMD_MEMORY_LOAD = MAKE_COMMAND_ID( 0x01 ); static const Command_t CMD_MEMORY_LOAD = MAKE_COMMAND_ID( 0x01 );
static const Command_t CMD_MEMORY_DUMP = MAKE_COMMAND_ID( 0x02 ); static const Command_t CMD_MEMORY_DUMP = MAKE_COMMAND_ID( 0x02 );
static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 ); static const Command_t CMD_MEMORY_CHECK = MAKE_COMMAND_ID( 0x03 );

View File

@ -17,7 +17,7 @@ class ModeMessage {
private: private:
ModeMessage(); ModeMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MODE_COMMAND; static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND;
static const Command_t CMD_MODE_COMMAND = MAKE_COMMAND_ID(0x01);//!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!! static const Command_t CMD_MODE_COMMAND = MAKE_COMMAND_ID(0x01);//!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!!
static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(0xF1);//!> Command to set the specified Mode, regardless of external control flag, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!! static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(0xF1);//!> Command to set the specified Mode, regardless of external control flag, replies are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies, as this will break the subsystem mode machine!!
static const Command_t REPLY_MODE_REPLY = MAKE_COMMAND_ID(0x02);//!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ static const Command_t REPLY_MODE_REPLY = MAKE_COMMAND_ID(0x02);//!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ

View File

@ -6,7 +6,7 @@
class MonitoringMessage: public CommandMessage { class MonitoringMessage: public CommandMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MONITORING; static const uint8_t MESSAGE_ID = messagetypes::MONITORING;
//Object id could be useful, but we better manage that on service level (register potential reporters). //Object id could be useful, but we better manage that on service level (register potential reporters).
static const Command_t LIMIT_VIOLATION_REPORT = MAKE_COMMAND_ID(10); static const Command_t LIMIT_VIOLATION_REPORT = MAKE_COMMAND_ID(10);
virtual ~MonitoringMessage(); virtual ~MonitoringMessage();

View File

@ -9,7 +9,7 @@ class ParameterMessage {
private: private:
ParameterMessage(); ParameterMessage();
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::PARAMETER; static const uint8_t MESSAGE_ID = messagetypes::PARAMETER;
static const Command_t CMD_PARAMETER_LOAD = MAKE_COMMAND_ID( 0x01 ); static const Command_t CMD_PARAMETER_LOAD = MAKE_COMMAND_ID( 0x01 );
static const Command_t CMD_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x02 ); static const Command_t CMD_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x02 );
static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 ); static const Command_t REPLY_PARAMETER_DUMP = MAKE_COMMAND_ID( 0x03 );

View File

@ -7,7 +7,7 @@
class ModeSequenceMessage { class ModeSequenceMessage {
public: public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::MODE_SEQUENCE; static const uint8_t MESSAGE_ID = messagetypes::MODE_SEQUENCE;
static const Command_t ADD_SEQUENCE = MAKE_COMMAND_ID(0x01); static const Command_t ADD_SEQUENCE = MAKE_COMMAND_ID(0x01);
static const Command_t ADD_TABLE = MAKE_COMMAND_ID(0x02); static const Command_t ADD_TABLE = MAKE_COMMAND_ID(0x02);

View File

@ -41,7 +41,7 @@ public:
static store_address_t getStoreId(const CommandMessage* cmd); static store_address_t getStoreId(const CommandMessage* cmd);
virtual ~TmStoreMessage(); virtual ~TmStoreMessage();
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::TM_STORE; static const uint8_t MESSAGE_ID = messagetypes::TM_STORE;
static const Command_t ENABLE_STORING = MAKE_COMMAND_ID(1); static const Command_t ENABLE_STORING = MAKE_COMMAND_ID(1);
static const Command_t DELETE_STORE_CONTENT = MAKE_COMMAND_ID(2); static const Command_t DELETE_STORE_CONTENT = MAKE_COMMAND_ID(2);
static const Command_t DOWNLINK_STORE_CONTENT = MAKE_COMMAND_ID(3); static const Command_t DOWNLINK_STORE_CONTENT = MAKE_COMMAND_ID(3);