CSB improvements

This commit is contained in:
Robin Müller 2020-06-10 21:41:48 +02:00
parent 454524d213
commit 5dc2133c3a
2 changed files with 54 additions and 50 deletions

View File

@ -218,9 +218,9 @@ void CommandingServiceBase::handleRequestQueue() {
} }
void CommandingServiceBase::sendTmPacket(uint8_t subservice, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
const uint8_t* data, uint32_t dataLen, const uint8_t* headerData, const uint8_t* data, size_t dataLen, const uint8_t* headerData,
uint32_t headerSize) { size_t headerSize) {
TmPacketStored tmPacketStored(this->apid, this->service, subservice, TmPacketStored tmPacketStored(this->apid, this->service, subservice,
this->tmPacketCounter, data, dataLen, headerData, headerSize); this->tmPacketCounter, data, dataLen, headerData, headerSize);
ReturnValue_t result = tmPacketStored.sendPacket( ReturnValue_t result = tmPacketStored.sendPacket(
@ -228,14 +228,15 @@ void CommandingServiceBase::sendTmPacket(uint8_t subservice,
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }
return result;
} }
void CommandingServiceBase::sendTmPacket(uint8_t subservice, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
object_id_t objectId, const uint8_t *data, uint32_t dataLen) { object_id_t objectId, const uint8_t *data, size_t dataLen) {
uint8_t buffer[sizeof(object_id_t)]; uint8_t buffer[sizeof(object_id_t)];
uint8_t* pBuffer = buffer; uint8_t* pBuffer = buffer;
uint32_t size = 0; size_t size = 0;
SerializeAdapter<object_id_t>::serialize(&objectId, &pBuffer, &size, SerializeAdapter<object_id_t>::serialize(&objectId, &pBuffer, &size,
sizeof(object_id_t), true); sizeof(object_id_t), true);
TmPacketStored tmPacketStored(this->apid, this->service, subservice, TmPacketStored tmPacketStored(this->apid, this->service, subservice,
@ -245,11 +246,11 @@ void CommandingServiceBase::sendTmPacket(uint8_t subservice,
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }
return result;
} }
void CommandingServiceBase::sendTmPacket(uint8_t subservice, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
SerializeIF* content, SerializeIF* header) { SerializeIF* content, SerializeIF* header) {
TmPacketStored tmPacketStored(this->apid, this->service, subservice, TmPacketStored tmPacketStored(this->apid, this->service, subservice,
this->tmPacketCounter, content, header); this->tmPacketCounter, content, header);
@ -258,6 +259,7 @@ void CommandingServiceBase::sendTmPacket(uint8_t subservice,
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
this->tmPacketCounter++; this->tmPacketCounter++;
} }
return result;
} }

View File

@ -125,7 +125,7 @@ protected:
* - @c CSB or implementation specific return codes * - @c CSB or implementation specific return codes
*/ */
virtual ReturnValue_t getMessageQueueAndObject(uint8_t subservice, virtual ReturnValue_t getMessageQueueAndObject(uint8_t subservice,
const uint8_t *tcData, uint32_t tcDataLen, MessageQueueId_t *id, const uint8_t *tcData, size_t tcDataLen, MessageQueueId_t *id,
object_id_t *objectId) = 0; object_id_t *objectId) = 0;
/** /**
@ -133,18 +133,16 @@ protected:
* the command is prepared by using an implementation specific CommandMessage type * the command is prepared by using an implementation specific CommandMessage type
* which is sent to the target object. * which is sent to the target object.
* It contains all necessary information for the device to execute telecommands. * It contains all necessary information for the device to execute telecommands.
* @param message[out] message to be sent to the object * @param message
* @param subservice[in] Subservice of the current communication * @param subservice
* @param tcData Additional data of the command * @param tcData
* @param tcDataLen Length of the additional data * @param tcDataLen
* @param state[out] Setable state of the communication * @param state
* @param objectId Target object ID * @param objectId Target object ID
* @return - @c RETURN_OK on success * @return
* - @c EXECUTION_COMPLETE if exectuin is finished
* - any other return code will be part of (1,4) start failure
*/ */
virtual ReturnValue_t prepareCommand(CommandMessage *message, virtual ReturnValue_t prepareCommand(CommandMessage *message,
uint8_t subservice, const uint8_t *tcData, uint32_t tcDataLen, uint8_t subservice, const uint8_t *tcData, size_t tcDataLen,
uint32_t *state, object_id_t objectId) = 0; uint32_t *state, object_id_t objectId) = 0;
/** /**
@ -152,10 +150,10 @@ protected:
* and the respective PUS Commanding Service once the execution has started. * and the respective PUS Commanding Service once the execution has started.
* The PUS Commanding Service receives replies from the target device and forwards them by calling this function. * The PUS Commanding Service receives replies from the target device and forwards them by calling this function.
* There are different translations of these replies to specify how the Command Service proceeds. * There are different translations of these replies to specify how the Command Service proceeds.
* @param reply Command Message which contains information about the command * @param reply[out] Command Message which contains information about the command
* @param previousCommand Command_t of last command * @param previousCommand [out]
* @param state state of the communication * @param state
* @param optionalNextCommand[out] An optional next command which can be set in this function * @param optionalNextCommand
* @param objectId Source object ID * @param objectId Source object ID
* @param isStep Flag value to mark steps of command execution * @param isStep Flag value to mark steps of command execution
* @return - @c RETURN_OK, @c EXECUTION_COMPLETE or @c NO_STEP_MESSAGE to generate TC verification success * @return - @c RETURN_OK, @c EXECUTION_COMPLETE or @c NO_STEP_MESSAGE to generate TC verification success
@ -215,34 +213,38 @@ protected:
PeriodicTaskIF* executingTask; PeriodicTaskIF* executingTask;
/** /**
* Send TM data from pointer to data. If a header is supplied it is added before data * @brief Send TM data from pointer to data.
* If a header is supplied it is added before data
* @param subservice Number of subservice * @param subservice Number of subservice
* @param data Pointer to the data in the Packet * @param data Pointer to the data in the Packet
* @param dataLen Lenght of data in the Packet * @param dataLen Lenght of data in the Packet
* @param headerData HeaderData will be placed before data * @param headerData HeaderData will be placed before data
* @param headerSize Size of HeaderData * @param headerSize Size of HeaderData
*/ */
void sendTmPacket(uint8_t subservice, const uint8_t *data, uint32_t dataLen, ReturnValue_t sendTmPacket(uint8_t subservice, const uint8_t *data,
const uint8_t* headerData = NULL, uint32_t headerSize = 0); size_t dataLen, const uint8_t* headerData = nullptr,
size_t headerSize = 0);
/** /**
* To send TM packets of objects that still need to be serialized and consist of an object ID with appended data * @brief To send TM packets of objects that still need to be serialized
* and consist of an object ID with appended data.
* @param subservice Number of subservice * @param subservice Number of subservice
* @param objectId ObjectId is placed before data * @param objectId ObjectId is placed before data
* @param data Data to append to the packet * @param data Data to append to the packet
* @param dataLen Length of Data * @param dataLen Length of Data
*/ */
void sendTmPacket(uint8_t subservice, object_id_t objectId, ReturnValue_t sendTmPacket(uint8_t subservice, object_id_t objectId,
const uint8_t *data, uint32_t dataLen); const uint8_t *data, size_t dataLen);
/** /**
* To send packets has data which is in form of a SerializeIF or Adapters implementing it * @brief To send packets which are contained inside a class implementing
* SerializeIF.
* @param subservice Number of subservice * @param subservice Number of subservice
* @param content This is a pointer to the serialized packet * @param content This is a pointer to the serialized packet
* @param header Serialize IF header which will be placed before content * @param header Serialize IF header which will be placed before content
*/ */
void sendTmPacket(uint8_t subservice, SerializeIF* content, ReturnValue_t sendTmPacket(uint8_t subservice, SerializeIF* content,
SerializeIF* header = NULL); SerializeIF* header = nullptr);
virtual void handleUnrequestedReply(CommandMessage *reply); virtual void handleUnrequestedReply(CommandMessage *reply);