Revert "DH IF and DH message form improved"
This reverts commit adf528fce9
.
This commit is contained in:
parent
2344efb3ac
commit
7c3f99ed2d
@ -1,19 +1,12 @@
|
||||
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_
|
||||
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_
|
||||
|
||||
#include "DeviceHandlerMessage.h"
|
||||
#ifndef DEVICEHANDLERIF_H_
|
||||
#define DEVICEHANDLERIF_H_
|
||||
|
||||
#include "../action/HasActionsIF.h"
|
||||
#include "DeviceHandlerMessage.h"
|
||||
#include "../events/Event.h"
|
||||
#include "../modes/HasModesIF.h"
|
||||
#include "../ipc/MessageQueueSenderIF.h"
|
||||
|
||||
/**
|
||||
* This is used to uniquely identify commands that are sent to a device
|
||||
* The values are defined in the device-specific implementations
|
||||
*/
|
||||
using DeviceCommandId_t = uint32_t;
|
||||
|
||||
/**
|
||||
* @brief This is the Interface used to communicate with a device handler.
|
||||
* @details Includes all expected return values, events and modes.
|
||||
@ -22,7 +15,6 @@ using DeviceCommandId_t = uint32_t;
|
||||
class DeviceHandlerIF {
|
||||
public:
|
||||
|
||||
|
||||
static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20;
|
||||
static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10;
|
||||
|
||||
@ -55,8 +47,6 @@ public:
|
||||
//! This is a transitional state which can not be commanded.
|
||||
//! The device handler performs all actions and commands to get the device
|
||||
//! shut down. When the device is off, the mode changes to @c MODE_OFF.
|
||||
//! It is possible to set the mode to _MODE_SHUT_DOWN to use the to off
|
||||
//! transition if available.
|
||||
static const Mode_t _MODE_SHUT_DOWN = TRANSITION_MODE_CHILD_ACTION_MASK | 6;
|
||||
//! It is possible to set the mode to _MODE_TO_ON to use the to on
|
||||
//! transition if available.
|
||||
@ -106,7 +96,7 @@ public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;
|
||||
|
||||
// Standard codes used when building commands.
|
||||
static const ReturnValue_t NO_COMMAND_DATA = MAKE_RETURN_CODE(0xA0); //!< If no command data was given when expected.
|
||||
static const ReturnValue_t NO_COMMAND_DATA = MAKE_RETURN_CODE(0xA0); //!< If the command size is 0. Checked in DHB
|
||||
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA1); //!< Command ID not in commandMap. Checked in DHB
|
||||
static const ReturnValue_t COMMAND_ALREADY_SENT = MAKE_RETURN_CODE(0xA2); //!< Command was already executed. Checked in DHB
|
||||
static const ReturnValue_t COMMAND_WAS_NOT_SENT = MAKE_RETURN_CODE(0xA3);
|
||||
@ -160,4 +150,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_ */
|
||||
#endif /* DEVICEHANDLERIF_H_ */
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "DeviceHandlerMessage.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
DeviceHandlerMessage::DeviceHandlerMessage() {
|
||||
}
|
||||
|
||||
store_address_t DeviceHandlerMessage::getStoreAddress(
|
||||
const CommandMessage* message) {
|
||||
return store_address_t(message->getParameter2());
|
||||
@ -21,6 +25,14 @@ uint8_t DeviceHandlerMessage::getWiretappingMode(
|
||||
return message->getParameter();
|
||||
}
|
||||
|
||||
//void DeviceHandlerMessage::setDeviceHandlerDirectCommandMessage(
|
||||
// CommandMessage* message, DeviceCommandId_t deviceCommand,
|
||||
// store_address_t commandParametersStoreId) {
|
||||
// message->setCommand(CMD_DIRECT);
|
||||
// message->setParameter(deviceCommand);
|
||||
// message->setParameter2(commandParametersStoreId.raw);
|
||||
//}
|
||||
|
||||
void DeviceHandlerMessage::setDeviceHandlerRawCommandMessage(
|
||||
CommandMessage* message, store_address_t rawPacketStoreId) {
|
||||
message->setCommand(CMD_RAW);
|
||||
@ -35,7 +47,7 @@ void DeviceHandlerMessage::setDeviceHandlerWiretappingMessage(
|
||||
|
||||
void DeviceHandlerMessage::setDeviceHandlerSwitchIoBoardMessage(
|
||||
CommandMessage* message, uint32_t ioBoardIdentifier) {
|
||||
message->setCommand(CMD_SWITCH_ADDRESS);
|
||||
message->setCommand(CMD_SWITCH_IOBOARD);
|
||||
message->setParameter(ioBoardIdentifier);
|
||||
}
|
||||
|
||||
@ -67,17 +79,18 @@ void DeviceHandlerMessage::setDeviceHandlerDirectCommandReply(
|
||||
void DeviceHandlerMessage::clear(CommandMessage* message) {
|
||||
switch (message->getCommand()) {
|
||||
case CMD_RAW:
|
||||
// case CMD_DIRECT:
|
||||
case REPLY_RAW_COMMAND:
|
||||
case REPLY_RAW_REPLY:
|
||||
case REPLY_DIRECT_COMMAND_DATA: {
|
||||
StorageManagerIF *ipcStore = objectManager->get<StorageManagerIF>(
|
||||
objects::IPC_STORE);
|
||||
if (ipcStore != nullptr) {
|
||||
if (ipcStore != NULL) {
|
||||
ipcStore->deleteData(getStoreAddress(message));
|
||||
}
|
||||
}
|
||||
/* NO BREAK falls through*/
|
||||
case CMD_SWITCH_ADDRESS:
|
||||
case CMD_SWITCH_IOBOARD:
|
||||
case CMD_WIRETAPPING:
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
message->setParameter(0);
|
||||
|
@ -1,56 +1,69 @@
|
||||
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_
|
||||
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_
|
||||
#ifndef DEVICEHANDLERMESSAGE_H_
|
||||
#define DEVICEHANDLERMESSAGE_H_
|
||||
|
||||
#include "../action/ActionMessage.h"
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../objectmanager/SystemObjectIF.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
// SHOULDDO: rework the static constructors to name the type of command
|
||||
// they are building, maybe even hide setting the commandID.
|
||||
|
||||
//SHOULDDO: rework the static constructors to name the type of command they are building, maybe even hide setting the commandID.
|
||||
|
||||
/**
|
||||
* @brief The DeviceHandlerMessage is used to send commands to classes
|
||||
* implementing DeviceHandlerIF
|
||||
* This is used to uniquely identify commands that are sent to a device
|
||||
*
|
||||
* The values are defined in the device-specific implementations
|
||||
*/
|
||||
typedef uint32_t DeviceCommandId_t;
|
||||
|
||||
/**
|
||||
* The DeviceHandlerMessage is used to send Commands to a DeviceHandlerIF
|
||||
*/
|
||||
class DeviceHandlerMessage {
|
||||
private:
|
||||
DeviceHandlerMessage();
|
||||
public:
|
||||
/**
|
||||
* Instantiation forbidden. Instead, use static functions to operate
|
||||
* on messages.
|
||||
*/
|
||||
DeviceHandlerMessage() = delete;
|
||||
virtual ~DeviceHandlerMessage() {}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
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_SWITCH_IOBOARD = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier
|
||||
static const Command_t CMD_WIRETAPPING = MAKE_COMMAND_ID( 4 ); //!< (De)Activates the monitoring of all raw traffic in DeviceHandlers, setParameter is 0 to deactivate, 1 to activate
|
||||
|
||||
//! 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_SWITCHED_IOBOARD = MAKE_COMMAND_ID(1 );//!< Reply to a @c CMD_SWITCH_IOBOARD, indicates switch was successful, getParameter() contains the board switched to (0: nominal, 1: redundant)
|
||||
static const Command_t REPLY_CANT_SWITCH_IOBOARD = MAKE_COMMAND_ID( 2); //!< Reply to a @c CMD_SWITCH_IOBOARD, indicating the switch could not be performed, getParameter() contains the error message
|
||||
static const Command_t REPLY_WIRETAPPING = MAKE_COMMAND_ID( 3); //!< Reply to a @c CMD_WIRETAPPING, getParameter() is the current state, 1 enabled, 0 disabled
|
||||
|
||||
static const Command_t REPLY_COMMAND_WAS_SENT = MAKE_COMMAND_ID(4 );//!< Reply to a @c CMD_RAW or @c CMD_DIRECT, indicates the command was successfully sent to the device, getParameter() contains the ::DeviceCommandId_t
|
||||
static const Command_t REPLY_COMMAND_NOT_SUPPORTED = MAKE_COMMAND_ID(5 );//!< Reply to a @c CMD_DIRECT, the requested ::DeviceCommand_t is not supported, getParameter() contains the requested ::DeviceCommand_t, getParameter2() contains the ::DeviceCommandId_t
|
||||
static const Command_t REPLY_COMMAND_WAS_NOT_SENT = MAKE_COMMAND_ID(6 );//!< Reply to a @c CMD_RAW or @c CMD_DIRECT, indicates the command was not sent, getParameter contains the RMAP Return code (@see rmap.h), getParameter2() contains the ::DeviceCommandId_t
|
||||
|
||||
static const Command_t REPLY_COMMAND_ALREADY_SENT = MAKE_COMMAND_ID(7 );//!< Reply to a @c CMD_DIRECT, the requested ::DeviceCommand_t has already been sent to the device and not ye been answered
|
||||
static const Command_t REPLY_WRONG_MODE_FOR_CMD = MAKE_COMMAND_ID(8 );//!< Reply to a @c CMD_RAW or @c CMD_DIRECT, indicates that the requested command can not be sent in the curent mode, getParameter() contains the DeviceHandlerCommand_t
|
||||
static const Command_t REPLY_NO_DATA = MAKE_COMMAND_ID(9 ); //!< Reply to a CMD_RAW or @c CMD_DIRECT, indicates that the ::store_id_t was invalid, getParameter() contains the ::DeviceCommandId_t, getPrameter2() contains the error code
|
||||
*/
|
||||
static const Command_t REPLY_DIRECT_COMMAND_SENT = ActionMessage::STEP_SUCCESS; //!< Signals that a direct command was sent
|
||||
static const Command_t REPLY_RAW_COMMAND = MAKE_COMMAND_ID(0x11 ); //!< Contains a raw command sent to the Device
|
||||
static const Command_t REPLY_RAW_REPLY = MAKE_COMMAND_ID( 0x12); //!< 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_DIRECT_COMMAND_DATA = ActionMessage::DATA_REPLY;
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~DeviceHandlerMessage() {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// static void setDeviceHandlerDirectCommandMessage(CommandMessage* message,
|
||||
// DeviceCommandId_t deviceCommand,
|
||||
// store_address_t commandParametersStoreId);
|
||||
|
||||
static void setDeviceHandlerDirectCommandReply(CommandMessage* message,
|
||||
object_id_t deviceObjectid,
|
||||
store_address_t commandParametersStoreId);
|
||||
@ -62,6 +75,11 @@ public:
|
||||
object_id_t deviceObjectid, store_address_t rawPacketStoreId,
|
||||
bool isCommand);
|
||||
|
||||
// static void setDeviceHandlerMessage(CommandMessage* message,
|
||||
// Command_t command, DeviceCommandId_t deviceCommand,
|
||||
// store_address_t commandParametersStoreId);
|
||||
// static void setDeviceHandlerMessage(CommandMessage* message,
|
||||
// Command_t command, store_address_t rawPacketStoreId);
|
||||
static void setDeviceHandlerWiretappingMessage(CommandMessage* message,
|
||||
uint8_t wiretappingMode);
|
||||
static void setDeviceHandlerSwitchIoBoardMessage(CommandMessage* message,
|
||||
@ -70,4 +88,4 @@ public:
|
||||
static void clear(CommandMessage* message);
|
||||
};
|
||||
|
||||
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERMESSAGE_H_ */
|
||||
#endif /* DEVICEHANDLERMESSAGE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user