added more messages

This commit is contained in:
Robin Müller 2021-05-27 12:50:48 +02:00
parent a2deac3441
commit 59e7f0caae
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 105 additions and 2 deletions

View File

@ -60,3 +60,73 @@ void GenericFileSystemMessage::setFailureReply(CommandMessage *message,
message->setParameter2(errorParam);
}
store_address_t GenericFileSystemMessage::getStoreId(const CommandMessage* message) {
store_address_t temp;
temp.raw = message->getParameter2();
return temp;
}
ReturnValue_t GenericFileSystemMessage::getFailureReply(
const CommandMessage *message, uint32_t* errorParam) {
if(errorParam != nullptr) {
*errorParam = message->getParameter2();
}
return message->getParameter();
}
void GenericFileSystemMessage::setFinishStopWriteCommand(CommandMessage *message,
store_address_t storeId) {
message->setCommand(CMD_FINISH_APPEND_TO_FILE);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setFinishStopWriteReply(CommandMessage *message,
store_address_t storeId) {
message->setCommand(REPLY_FINISH_APPEND);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setCopyCommand(CommandMessage* message,
store_address_t storeId) {
message->setCommand(CMD_COPY_FILE);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setWriteCommand(CommandMessage* message,
store_address_t storeId) {
message->setCommand(CMD_APPEND_TO_FILE);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setReadCommand(CommandMessage* message,
store_address_t storeId) {
message->setCommand(CMD_READ_FROM_FILE);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setFinishAppendReply(CommandMessage* message,
store_address_t storageID) {
message->setCommand(REPLY_FINISH_APPEND);
message->setParameter2(storageID.raw);
}
void GenericFileSystemMessage::setReadReply(CommandMessage* message,
bool readFinished, store_address_t storeId) {
message->setCommand(REPLY_READ_FROM_FILE);
message->setParameter(readFinished);
message->setParameter2(storeId.raw);
}
void GenericFileSystemMessage::setReadFinishedReply(CommandMessage *message,
store_address_t storeId) {
message->setCommand(REPLY_READ_FINISHED_STOP);
message->setParameter2(storeId.raw);
}
bool GenericFileSystemMessage::getReadReply(const CommandMessage *message,
store_address_t *storeId) {
if(storeId != nullptr) {
(*storeId).raw = message->getParameter2();
}
return message->getParameter();
}

View File

@ -52,6 +52,17 @@ public:
static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(128);
static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(129);
// These command IDs will remain until CFDP has been introduced and consolidated.
/** Append operation commands */
static const Command_t CMD_APPEND_TO_FILE = MAKE_COMMAND_ID(130);
static const Command_t CMD_FINISH_APPEND_TO_FILE = MAKE_COMMAND_ID(131);
static const Command_t REPLY_FINISH_APPEND = MAKE_COMMAND_ID(132);
static const Command_t CMD_READ_FROM_FILE = MAKE_COMMAND_ID(140);
static const Command_t REPLY_READ_FROM_FILE = MAKE_COMMAND_ID(141);
static const Command_t CMD_STOP_READ = MAKE_COMMAND_ID(142);
static const Command_t REPLY_READ_FINISHED_STOP = MAKE_COMMAND_ID(143);
static void setLockFileCommand(CommandMessage* message, store_address_t storeId);
static void setUnlockFileCommand(CommandMessage* message, store_address_t storeId);
@ -73,8 +84,30 @@ public:
static void setSuccessReply(CommandMessage* message);
static void setFailureReply(CommandMessage* message,
ReturnValue_t errorCode, uint32_t errorParam = 0);
static void setCopyCommand(CommandMessage* message, store_address_t storeId);
static void setWriteCommand(CommandMessage* message,
store_address_t storeId);
static void setFinishStopWriteCommand(CommandMessage* message,
store_address_t storeId);
static void setFinishStopWriteReply(CommandMessage* message,
store_address_t storeId);
static void setFinishAppendReply(CommandMessage* message,
store_address_t storeId);
static void setReadCommand(CommandMessage* message,
store_address_t storeId);
static void setReadFinishedReply(CommandMessage* message,
store_address_t storeId);
static void setReadReply(CommandMessage* message, bool readFinished,
store_address_t storeId);
static bool getReadReply(const CommandMessage* message,
store_address_t* storeId);
static store_address_t getStoreId(const CommandMessage* message);
static ReturnValue_t getFailureReply(const CommandMessage* message,
uint32_t* errorParam = nullptr);
};
#endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */