some form stuff

This commit is contained in:
Robin Müller 2020-10-06 16:01:35 +02:00
parent 6a077c583d
commit df1a730cdf
5 changed files with 24 additions and 21 deletions

View File

@ -3,8 +3,9 @@
#include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueSenderIF.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : ActionHelper::ActionHelper(HasActionsIF* setOwner,
owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) { MessageQueueIF* useThisQueue) :
owner(setOwner), queueToUse(useThisQueue) {
} }
ActionHelper::~ActionHelper() { ActionHelper::~ActionHelper() {
@ -33,13 +34,15 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result) { void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo,
ActionId_t commandId, ReturnValue_t result) {
CommandMessage reply; CommandMessage reply;
ActionMessage::setStepReply(&reply, commandId, step + STEP_OFFSET, result); ActionMessage::setStepReply(&reply, commandId, step + STEP_OFFSET, result);
queueToUse->sendMessage(reportTo, &reply); queueToUse->sendMessage(reportTo, &reply);
} }
void ActionHelper::finish(MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result) { void ActionHelper::finish(MessageQueueId_t reportTo, ActionId_t commandId,
ReturnValue_t result) {
CommandMessage reply; CommandMessage reply;
ActionMessage::setCompletionReply(&reply, commandId, result); ActionMessage::setCompletionReply(&reply, commandId, result);
queueToUse->sendMessage(reportTo, &reply); queueToUse->sendMessage(reportTo, &reply);
@ -49,8 +52,8 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) {
queueToUse = queue; queueToUse = queue;
} }
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, void ActionHelper::prepareExecution(MessageQueueId_t commandedBy,
store_address_t dataAddress) { ActionId_t actionId, store_address_t dataAddress) {
const uint8_t* dataPtr = NULL; const uint8_t* dataPtr = NULL;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);

View File

@ -94,7 +94,7 @@ protected:
//! setQueueToUse //! setQueueToUse
MessageQueueIF* queueToUse; MessageQueueIF* queueToUse;
//! Pointer to an IPC Store, initialized during construction or //! Pointer to an IPC Store, initialized during construction or
StorageManagerIF* ipcStore; StorageManagerIF* ipcStore = nullptr;
/** /**
* Internal function called by handleActionMessage * Internal function called by handleActionMessage

View File

@ -7,10 +7,10 @@
#include "../serialize/SerializeAdapter.h" #include "../serialize/SerializeAdapter.h"
#include "../serviceinterface/ServiceInterfaceStream.h" #include "../serviceinterface/ServiceInterfaceStream.h"
Service8FunctionManagement::Service8FunctionManagement(object_id_t object_id, Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId,
uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds): uint16_t commandTimeoutSeconds):
CommandingServiceBase(object_id, apid, serviceId, numParallelCommands, CommandingServiceBase(objectId, apid, serviceId, numParallelCommands,
commandTimeoutSeconds) {} commandTimeoutSeconds) {}
Service8FunctionManagement::~Service8FunctionManagement() {} Service8FunctionManagement::~Service8FunctionManagement() {}

View File

@ -15,15 +15,15 @@ store_address_t TmTcMessage::getStorageId() {
return temp_id; return temp_id;
} }
TmTcMessage::TmTcMessage(store_address_t store_id) { TmTcMessage::TmTcMessage(store_address_t storeId) {
this->messageSize += sizeof(store_address_t); this->messageSize += sizeof(store_address_t);
this->setStorageId(store_id); this->setStorageId(storeId);
} }
size_t TmTcMessage::getMinimumMessageSize() { size_t TmTcMessage::getMinimumMessageSize() {
return this->HEADER_SIZE + sizeof(store_address_t); return this->HEADER_SIZE + sizeof(store_address_t);
} }
void TmTcMessage::setStorageId(store_address_t store_id) { void TmTcMessage::setStorageId(store_address_t storeId) {
memcpy(this->getData(), &store_id, sizeof(store_address_t) ); memcpy(this->getData(), &storeId, sizeof(store_address_t) );
} }

View File

@ -1,5 +1,5 @@
#ifndef TMTCMESSAGE_H_ #ifndef FSFW_TMTCSERVICES_TMTCMESSAGE_H_
#define TMTCMESSAGE_H_ #define FSFW_TMTCSERVICES_TMTCMESSAGE_H_
#include "../ipc/MessageQueueMessage.h" #include "../ipc/MessageQueueMessage.h"
#include "../storagemanager/StorageManagerIF.h" #include "../storagemanager/StorageManagerIF.h"
@ -10,13 +10,13 @@
* a packet stored in one of the IPC stores (typically a special TM and * a packet stored in one of the IPC stores (typically a special TM and
* a special TC store). This makes passing commands very simple and * a special TC store). This makes passing commands very simple and
* efficient. * efficient.
* \ingroup message_queue * @ingroup message_queue
*/ */
class TmTcMessage : public MessageQueueMessage { class TmTcMessage : public MessageQueueMessage {
protected: protected:
/** /**
* @brief This call always returns the same fixed size of the message. * @brief This call always returns the same fixed size of the message.
* @return Returns HEADER_SIZE + \c sizeof(store_address_t). * @return Returns HEADER_SIZE + @c sizeof(store_address_t).
*/ */
size_t getMinimumMessageSize(); size_t getMinimumMessageSize();
public: public:
@ -29,7 +29,7 @@ public:
* into the message. * into the message.
* @param packet_id The packet id to put into the message. * @param packet_id The packet id to put into the message.
*/ */
TmTcMessage( store_address_t packet_id ); TmTcMessage( store_address_t packetId );
/** /**
* @brief The class's destructor is empty. * @brief The class's destructor is empty.
*/ */
@ -42,9 +42,9 @@ public:
/** /**
* @brief In some cases it might be useful to have a setter for packet id * @brief In some cases it might be useful to have a setter for packet id
* as well. * as well.
* @param packet_id The packet id to put into the message. * @param packetId The packet id to put into the message.
*/ */
void setStorageId( store_address_t packet_id ); void setStorageId( store_address_t packetId );
}; };
#endif /* TMTCMESSAGE_H_ */ #endif /* FSFW_TMTCSERVICES_TMTCMESSAGE_H_ */