fsfw/pus/servicepackets/Service8Packets.h

122 lines
3.5 KiB
C
Raw Normal View History

2020-07-10 14:16:55 +02:00
#ifndef FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
#define FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
#include <framework/action/ActionMessage.h>
#include <framework/objectmanager/SystemObjectIF.h>
#include <framework/serialize/SerialBufferAdapter.h>
#include <framework/serialize/SerializeElement.h>
#include <framework/serialize/SerialLinkedListAdapter.h>
#include <framework/serialize/SerialFixedArrayListAdapter.h>
/**
2020-07-10 14:29:17 +02:00
* @brief Subservice 128
* @ingroup spacepackets
2020-07-10 14:16:55 +02:00
*/
class DirectCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128
public:
2020-07-10 14:29:17 +02:00
DirectCommand(const uint8_t* tcData, size_t size) {
SerializeAdapter::deSerialize(&objectId, &tcData, &size,
2020-07-10 14:16:55 +02:00
SerializeIF::Endianness::BIG);
2020-07-10 14:29:17 +02:00
SerializeAdapter::deSerialize(&actionId, &tcData, &size,
2020-07-10 14:16:55 +02:00
SerializeIF::Endianness::BIG);
2020-07-10 14:29:17 +02:00
parameterBuffer = tcData;
parametersSize = size;
2020-07-10 14:16:55 +02:00
}
2020-07-10 14:29:17 +02:00
2020-07-10 14:16:55 +02:00
ActionId_t getActionId() const {
return actionId;
}
object_id_t getObjectId() const {
return objectId;
}
const uint8_t* getParameters() {
return parameterBuffer;
}
uint32_t getParametersSize() const {
return parametersSize;
}
private:
DirectCommand(const DirectCommand &command);
object_id_t objectId;
ActionId_t actionId;
uint32_t parametersSize; //!< [EXPORT] : [IGNORE]
const uint8_t * parameterBuffer; //!< [EXPORT] : [MAXSIZE] 65535 Bytes
};
/**
2020-07-10 14:29:17 +02:00
* @brief Subservice 130
* Data reply (subservice 130) consists of
* 1. Target Object ID
* 2. Action ID
* 3. Data
* @ingroup spacepackets
2020-07-10 14:16:55 +02:00
*/
class DataReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 130
public:
typedef uint16_t typeOfMaxDataSize;
static const uint16_t MAX_DATA_LENGTH = sizeof(typeOfMaxDataSize);
DataReply(object_id_t objectId_, ActionId_t actionId_,
const uint8_t * replyDataBuffer_ = NULL, uint16_t replyDataSize_ = 0):
objectId(objectId_), actionId(actionId_), replyData(replyDataBuffer_,replyDataSize_){
setLinks();
}
private:
DataReply(const DataReply &reply);
void setLinks() {
setStart(&objectId);
objectId.setNext(&actionId);
actionId.setNext(&replyData);
}
SerializeElement<object_id_t> objectId;
SerializeElement<ActionId_t> actionId;
SerializeElement<SerialBufferAdapter<uint16_t>> replyData;
};
/**
2020-07-10 14:29:17 +02:00
* @brief Subservice 132
* @details
* Not used yet. Telecommand Verification takes care of this.
* @ingroup spacepackets
2020-07-10 14:16:55 +02:00
*/
class DirectReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 132
public:
typedef uint16_t typeOfMaxDataSize;
static const uint16_t MAX_DATA_LENGTH = sizeof(typeOfMaxDataSize);
DirectReply(object_id_t objectId_, ActionId_t actionId_, ReturnValue_t returnCode_,
bool isStep_ = false, uint8_t step_ = 0):
isStep(isStep_), objectId(objectId_), actionId(actionId_),
returnCode(returnCode_),step(step_) {
setLinks();
}
private:
void setLinks() {
setStart(&objectId);
objectId.setNext(&actionId);
actionId.setNext(&returnCode);
if(isStep) {
returnCode.setNext(&step);
}
}
2020-07-10 14:29:17 +02:00
2020-07-10 14:16:55 +02:00
bool isStep; //!< [EXPORT] : [IGNORE]
SerializeElement<object_id_t> objectId; //!< [EXPORT] : [IGNORE]
SerializeElement<ActionId_t> actionId; //!< [EXPORT] : [IGNORE]
SerializeElement<ReturnValue_t> returnCode; //!< [EXPORT] : [IGNORE]
SerializeElement<uint8_t> step; //!< [EXPORT] : [OPTIONAL] [IGNORE]
};
#endif /* FRAMEWORK_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ */