fsfw/src/fsfw/devicehandlers/DeviceHandlerMessage.h

71 lines
3.2 KiB
C
Raw Normal View History

2020-10-12 18:18:41 +02:00
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_
2020-08-13 20:53:35 +02:00
#include "../action/ActionMessage.h"
#include "../ipc/CommandMessage.h"
#include "../objectmanager/SystemObjectIF.h"
#include "../storagemanager/StorageManagerIF.h"
2020-10-12 18:18:41 +02:00
// SHOULDDO: rework the static constructors to name the type of command
// they are building, maybe even hide setting the commandID.
/**
2020-10-12 18:18:41 +02:00
* @brief The DeviceHandlerMessage is used to send commands to classes
* implementing DeviceHandlerIF
*/
class DeviceHandlerMessage {
2022-02-02 10:29:30 +01:00
public:
/**
* Instantiation forbidden. Instead, use static functions to operate
* on messages.
*/
DeviceHandlerMessage() = delete;
virtual ~DeviceHandlerMessage() {}
2022-02-02 10:29:30 +01:00
/**
* These are the commands that can be sent to a DeviceHandlerBase
*/
static const uint8_t MESSAGE_ID = messagetypes::DEVICE_HANDLER_COMMAND;
//! Sends a raw command, setParameter is a storeId containing the
//! raw packet to send
static const Command_t CMD_RAW = MAKE_COMMAND_ID(1);
//! Requests a IO-Board switch, setParameter() is the IO-Board identifier
static const Command_t CMD_SWITCH_ADDRESS = MAKE_COMMAND_ID(3);
//! (De)Activates the monitoring of all raw traffic in DeviceHandlers,
//! setParameter is 0 to deactivate, 1 to activate
static const Command_t CMD_WIRETAPPING = MAKE_COMMAND_ID(4);
2020-10-12 18:18:41 +02:00
2022-02-02 10:29:30 +01:00
//! Signals that a direct command was sent
static const Command_t REPLY_DIRECT_COMMAND_SENT = ActionMessage::STEP_SUCCESS;
//! Contains a raw command sent to the Device
static const Command_t REPLY_RAW_COMMAND = MAKE_COMMAND_ID(0x11);
//! Contains a raw reply from the Device, getParameter() is the ObjcetId
//! of the sender, getParameter2() is a ::store_id_t containing the
//! raw packet received
static const Command_t REPLY_RAW_REPLY = MAKE_COMMAND_ID(0x12);
static const Command_t REPLY_DIRECT_COMMAND_DATA = ActionMessage::DATA_REPLY;
2022-02-02 10:29:30 +01:00
static store_address_t getStoreAddress(const CommandMessage* message);
static uint32_t getDeviceCommandId(const CommandMessage* message);
static object_id_t getDeviceObjectId(const CommandMessage* message);
static object_id_t getIoBoardObjectId(const CommandMessage* message);
static uint8_t getWiretappingMode(const CommandMessage* message);
2022-02-02 10:29:30 +01:00
static void setDeviceHandlerDirectCommandReply(CommandMessage* message,
object_id_t deviceObjectid,
store_address_t commandParametersStoreId);
2022-02-02 10:29:30 +01:00
static void setDeviceHandlerRawCommandMessage(CommandMessage* message,
store_address_t rawPacketStoreId);
2022-02-02 10:29:30 +01:00
static void setDeviceHandlerRawReplyMessage(CommandMessage* message, object_id_t deviceObjectid,
store_address_t rawPacketStoreId, bool isCommand);
2022-02-02 10:29:30 +01:00
static void setDeviceHandlerWiretappingMessage(CommandMessage* message, uint8_t wiretappingMode);
static void setDeviceHandlerSwitchIoBoardMessage(CommandMessage* message,
object_id_t ioBoardIdentifier);
2022-02-02 10:29:30 +01:00
static void clear(CommandMessage* message);
};
2020-10-12 18:18:41 +02:00
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_ */