trying to fuse header / inc
This commit is contained in:
166
src/fsfw/pus/servicepackets/Service1Packets.h
Normal file
166
src/fsfw/pus/servicepackets/Service1Packets.h
Normal file
@ -0,0 +1,166 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_
|
||||
|
||||
/**
|
||||
* @defgroup spacepackets PUS Packet Definitions
|
||||
* This group contains all implemented TM or TM packages that are sent to
|
||||
* or sent by the OBC.They are exported later to display
|
||||
* packet structures in Mission Information Base (MIB).
|
||||
*/
|
||||
|
||||
#include "../../serialize/SerializeAdapter.h"
|
||||
#include "../../tmtcservices/VerificationCodes.h"
|
||||
|
||||
/**
|
||||
* @brief FailureReport class to serialize a failure report
|
||||
* @brief Subservice 1, 3, 5, 7
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class FailureReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5, 7
|
||||
public:
|
||||
FailureReport(uint8_t failureSubtype_, uint16_t packetId_,
|
||||
uint16_t packetSequenceControl_, uint8_t stepNumber_,
|
||||
ReturnValue_t errorCode_, uint32_t errorParameter1_,
|
||||
uint32_t errorParameter2_) :
|
||||
packetId(packetId_), packetSequenceControl(packetSequenceControl_),
|
||||
stepNumber(stepNumber_), errorCode(errorCode_),
|
||||
errorParameter1(errorParameter1_), errorParameter2(errorParameter2_),
|
||||
failureSubtype(failureSubtype_) {}
|
||||
|
||||
/**
|
||||
* This function is called by the FSFW when calling the tm packet send
|
||||
* function and supplying the SerializeIF* as parameter
|
||||
* @param buffer Object content is serialized into the buffer
|
||||
* @param size
|
||||
* @param max_size
|
||||
* @param bigEndian
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||
size_t maxSize, SerializeIF::Endianness streamEndianness
|
||||
) const override {
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&packetId, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(&packetSequenceControl, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if (failureSubtype == tc_verification::PROGRESS_FAILURE) {
|
||||
result = SerializeAdapter::serialize(&stepNumber, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
result = SerializeAdapter::serialize(&errorCode, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(&errorParameter1, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = SerializeAdapter::serialize(&errorParameter2, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
virtual size_t getSerializedSize() const {
|
||||
size_t size = 0;
|
||||
size += SerializeAdapter::getSerializedSize(&packetId);
|
||||
size += sizeof(packetSequenceControl);
|
||||
if(failureSubtype==tc_verification::PROGRESS_FAILURE){
|
||||
size += SerializeAdapter::getSerializedSize(&stepNumber);
|
||||
}
|
||||
size += SerializeAdapter::getSerializedSize(&errorCode);
|
||||
size += SerializeAdapter::getSerializedSize(&errorParameter1);
|
||||
size += SerializeAdapter::getSerializedSize(&errorParameter2);
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialization is not allowed for a report.
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param bigEndian
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
SerializeIF::Endianness streamEndianness) override {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
private:
|
||||
uint16_t packetId; //!< [EXPORT] : [COMMENT] Packet ID of respective Telecommand
|
||||
uint16_t packetSequenceControl; //!< [EXPORT] : [COMMENT] Packet SSC of respective Telecommand
|
||||
uint8_t stepNumber; //!< [EXPORT] : [OPTIONAL][SUBSERVICE] 6
|
||||
ReturnValue_t errorCode; //!< [EXPORT] : [COMMENT] Error code which can be looked up in generated error code file
|
||||
uint32_t errorParameter1;
|
||||
uint32_t errorParameter2;
|
||||
const uint8_t failureSubtype; //!< [EXPORT] : [IGNORE]
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Subservices 2, 4, 6, 8
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class SuccessReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6, 8
|
||||
public:
|
||||
SuccessReport(uint8_t subtype_, uint16_t packetId_,
|
||||
uint16_t packetSequenceControl_,uint8_t stepNumber_) :
|
||||
packetId(packetId_), packetSequenceControl(packetSequenceControl_),
|
||||
stepNumber(stepNumber_), subtype(subtype_) {}
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||
size_t maxSize, SerializeIF::Endianness streamEndianness
|
||||
) const override {
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&packetId, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(&packetSequenceControl, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if (subtype == tc_verification::PROGRESS_SUCCESS) {
|
||||
result = SerializeAdapter::serialize(&stepNumber, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual size_t getSerializedSize() const override {
|
||||
size_t size = 0;
|
||||
size += SerializeAdapter::getSerializedSize(&packetId);
|
||||
size += sizeof(packetSequenceControl);
|
||||
if(subtype == tc_verification::PROGRESS_SUCCESS){
|
||||
size += SerializeAdapter::getSerializedSize(&stepNumber);
|
||||
}
|
||||
return size;
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
SerializeIF::Endianness streamEndianness) override {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
private:
|
||||
uint16_t packetId; //!< [EXPORT] : [COMMENT] Packet ID of respective Telecommand
|
||||
uint16_t packetSequenceControl; //!< [EXPORT] : [COMMENT] Packet SSC of respective Telecommand
|
||||
uint8_t stepNumber; //!< [EXPORT] : [OPTIONAL][SUBSERVICE] 6
|
||||
const uint8_t subtype; //!< [EXPORT] : [IGNORE]
|
||||
};
|
||||
|
||||
#endif /* MISSION_PUS_SERVICEPACKETS_SERVICE1PACKETS_H_ */
|
63
src/fsfw/pus/servicepackets/Service200Packets.h
Normal file
63
src/fsfw/pus/servicepackets/Service200Packets.h
Normal file
@ -0,0 +1,63 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_
|
||||
|
||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||
#include "../../modes/ModeMessage.h"
|
||||
#include "../../serialize/SerializeIF.h"
|
||||
|
||||
/**
|
||||
* @brief Subservice 1, 2, 3, 4, 5
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class ModePacket : public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 1, 2, 6
|
||||
public:
|
||||
|
||||
ModePacket() {
|
||||
setLinks();
|
||||
}
|
||||
|
||||
ModePacket(object_id_t objectId, Mode_t mode, Submode_t submode) :
|
||||
objectId(objectId), mode(mode), submode(submode) {
|
||||
setLinks();
|
||||
}
|
||||
|
||||
Mode_t getMode() {
|
||||
return mode.entry;
|
||||
}
|
||||
|
||||
Submode_t getSubmode() {
|
||||
return submode.entry;
|
||||
}
|
||||
|
||||
// Forbid copying, pointers are used.
|
||||
ModePacket(const ModePacket&) = delete;
|
||||
ModePacket& operator=(const ModePacket&) = delete;
|
||||
private:
|
||||
|
||||
void setLinks() {
|
||||
setStart(&objectId);
|
||||
objectId.setNext(&mode);
|
||||
mode.setNext(&submode);
|
||||
}
|
||||
SerializeElement<object_id_t> objectId; //!< [EXPORT] : [COMMENT] Target or source object
|
||||
SerializeElement<Mode_t> mode; //!< [EXPORT] : [COMMENT] 0: MODE_OFF, 1: MODE_ON, 2: MODE_NORMAL, 3: MODE_RAW
|
||||
SerializeElement<Submode_t> submode; //!< [EXPORT] : [COMMENT] Usually 0, device specific submode possible
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Subservice 7
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class CantReachModePacket: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 7
|
||||
public:
|
||||
CantReachModePacket(object_id_t objectId, ReturnValue_t reason):
|
||||
objectId(objectId), reason(reason) {
|
||||
setStart(&this->objectId);
|
||||
this->objectId.setNext(&this->reason);
|
||||
}
|
||||
|
||||
SerializeElement<object_id_t> objectId; //!< [EXPORT] : [COMMENT] Reply source object
|
||||
SerializeElement<ReturnValue_t> reason; //!< [EXPORT] : [COMMENT] Reason the mode could not be reached
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE200PACKETS_H_ */
|
48
src/fsfw/pus/servicepackets/Service201Packets.h
Normal file
48
src/fsfw/pus/servicepackets/Service201Packets.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE201PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE201PACKETS_H_
|
||||
|
||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||
#include "../../serialize/SerializeIF.h"
|
||||
#include "../../health/HasHealthIF.h"
|
||||
|
||||
class HealthSetCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 1
|
||||
public:
|
||||
|
||||
HealthSetCommand() {
|
||||
setLinks();
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState getHealth() {
|
||||
return static_cast<HasHealthIF::HealthState>(health.entry);
|
||||
}
|
||||
private:
|
||||
void setLinks() {
|
||||
setStart(&objectId);
|
||||
objectId.setNext(&health);
|
||||
}
|
||||
SerializeElement<uint32_t> objectId; //!< [EXPORT] : [COMMENT] Target object Id
|
||||
SerializeElement<uint8_t> health; //!< [EXPORT] : [COMMENT] Health to set
|
||||
};
|
||||
|
||||
|
||||
class HealthSetReply: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 2
|
||||
public:
|
||||
HealthSetReply(uint8_t health_, uint8_t oldHealth_):
|
||||
health(health_), oldHealth(oldHealth_)
|
||||
{
|
||||
setLinks();
|
||||
}
|
||||
|
||||
private:
|
||||
HealthSetReply(const HealthSetReply &reply);
|
||||
void setLinks() {
|
||||
setStart(&objectId);
|
||||
objectId.setNext(&health);
|
||||
health.setNext(&oldHealth);
|
||||
}
|
||||
SerializeElement<uint32_t> objectId; //!< [EXPORT] : [COMMENT] Source object ID
|
||||
SerializeElement<uint8_t> health; //!< [EXPORT] : [COMMENT] New Health
|
||||
SerializeElement<uint8_t> oldHealth; //!< [EXPORT] : [COMMENT] Old Health
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE201PACKETS_H_ */
|
141
src/fsfw/pus/servicepackets/Service20Packets.h
Normal file
141
src/fsfw/pus/servicepackets/Service20Packets.h
Normal file
@ -0,0 +1,141 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_
|
||||
|
||||
#include <FSFWConfig.h>
|
||||
#include <fsfw/parameters/HasParametersIF.h>
|
||||
#include <fsfw/serialize/SerialBufferAdapter.h>
|
||||
#include <fsfw/serialize/SerializeElement.h>
|
||||
#include <fsfw/serialize/SerialLinkedListAdapter.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
/**
|
||||
* @brief This class encapsulates the packets sent to the PUS service 20 or sent by the
|
||||
* PUS service 20
|
||||
* @details
|
||||
* This command can be used to handle both load and dump commands as well.
|
||||
* @author
|
||||
*/
|
||||
class ParameterCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128, 129, 130
|
||||
public:
|
||||
|
||||
/**
|
||||
* This constructor is used for load replies. The data is expected in the correct formast
|
||||
* in the store pointer.
|
||||
* @param storePointer
|
||||
* @param parameterDataLen
|
||||
*/
|
||||
ParameterCommand(uint8_t* storePointer, size_t parameterDataLen):
|
||||
parameterBuffer(storePointer, parameterDataLen) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
if(parameterDataLen == 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "ParameterCommand: Parameter data length is 0" << std::endl;
|
||||
#else
|
||||
sif::printWarning("ParameterCommand: Parameter data length is 0!\n");
|
||||
#endif
|
||||
}
|
||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||
setLoadLinks();
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is used for dump replies. It is assumed the 4 byte parameter
|
||||
* information field is located inside the parameter buffer.
|
||||
* @param objectId
|
||||
* @param parameterId
|
||||
* @param parameterBuffer
|
||||
* @param parameterBufferSize
|
||||
*/
|
||||
ParameterCommand(object_id_t objectId, ParameterId_t parameterId,
|
||||
const uint8_t* parameterBuffer, size_t parameterBufferSize):
|
||||
objectId(objectId), parameterId(parameterId),
|
||||
parameterBuffer(parameterBuffer, parameterBufferSize) {
|
||||
setDumpReplyLinks();
|
||||
}
|
||||
|
||||
ParameterId_t getParameterId() const {
|
||||
return parameterId.entry;
|
||||
}
|
||||
|
||||
const uint8_t* getParameterBuffer() {
|
||||
return parameterBuffer.entry.getConstBuffer();
|
||||
}
|
||||
|
||||
size_t getParameterBufferLen() const {
|
||||
return parameterBuffer.getSerializedSize();
|
||||
}
|
||||
|
||||
uint8_t getDomainId() const {
|
||||
return (parameterId.entry >> 24) & 0xff;
|
||||
}
|
||||
|
||||
uint8_t getUniqueId() const {
|
||||
return (parameterId.entry >> 16) & 0xff;
|
||||
}
|
||||
|
||||
uint16_t getLinearIndex() const {
|
||||
return parameterId.entry & 0xffff;
|
||||
}
|
||||
|
||||
uint8_t getPtc() const {
|
||||
return ccsdsType.entry >> 8 & 0xff;
|
||||
}
|
||||
|
||||
uint8_t getPfc() const {
|
||||
return ccsdsType.entry & 0xff;
|
||||
}
|
||||
|
||||
uint8_t getRows() const {
|
||||
return rows.entry;
|
||||
}
|
||||
|
||||
uint8_t getColumns() const {
|
||||
return columns.entry;
|
||||
}
|
||||
|
||||
private:
|
||||
void setLoadLinks() {
|
||||
setStart(&objectId);
|
||||
objectId.setNext(¶meterId);
|
||||
parameterId.setNext(&ccsdsType);
|
||||
ccsdsType.setNext(&rows);
|
||||
rows.setNext(&columns);
|
||||
columns.setNext(¶meterBuffer);
|
||||
}
|
||||
|
||||
void setDumpReplyLinks() {
|
||||
/* For a dump reply, the parameter information is contained in the parameter buffer
|
||||
with the actual parameters */
|
||||
setStart(&objectId);
|
||||
objectId.setNext(¶meterId);
|
||||
parameterId.setNext(¶meterBuffer);
|
||||
}
|
||||
|
||||
void setDumpRequestLinks() {
|
||||
setStart(&objectId);
|
||||
objectId.setNext(¶meterId);
|
||||
}
|
||||
|
||||
SerializeElement<object_id_t> objectId = 0;
|
||||
SerializeElement<ParameterId_t> parameterId = 0;
|
||||
//! [EXPORT] : [COMMENT] Type consisting of one byte PTC and one byte PFC.
|
||||
SerializeElement<uint16_t> ccsdsType = 0;
|
||||
SerializeElement<uint8_t> rows = 0;
|
||||
SerializeElement<uint8_t> columns = 0;
|
||||
SerializeElement<SerialBufferAdapter<uint8_t>> parameterBuffer;
|
||||
};
|
||||
|
||||
class ParameterLoadCommand: public ParameterCommand {
|
||||
public:
|
||||
ParameterLoadCommand(uint8_t* parameterPacket, size_t parameterDataLen):
|
||||
ParameterCommand(parameterPacket, parameterDataLen) {}
|
||||
};
|
||||
|
||||
class ParameterDumpReply: public ParameterCommand {
|
||||
public:
|
||||
ParameterDumpReply(object_id_t objectId, ParameterId_t parameterId,
|
||||
const uint8_t* parameterBuffer, size_t parameterBufferSize):
|
||||
ParameterCommand(objectId, parameterId, parameterBuffer, parameterBufferSize) {}
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE20PACKETS_H_ */
|
76
src/fsfw/pus/servicepackets/Service2Packets.h
Normal file
76
src/fsfw/pus/servicepackets/Service2Packets.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_
|
||||
|
||||
#include "../../action/ActionMessage.h"
|
||||
#include "../../objectmanager/SystemObjectIF.h"
|
||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
/**
|
||||
* @brief Subservice 128
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class RawCommand { //!< [EXPORT] : [SUBSERVICE] 128
|
||||
public:
|
||||
RawCommand(const uint8_t* buffer, size_t size) {
|
||||
// Deserialize Adapter to get correct endianness
|
||||
SerializeAdapter::deSerialize(&objectId, &buffer, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
commandBuffer = buffer;
|
||||
// size is decremented by AutoSerializeAdapter,
|
||||
// remaining size is data size
|
||||
dataSize = size;
|
||||
}
|
||||
object_id_t getObjectId() const {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
const uint8_t* getCommand() {
|
||||
return commandBuffer;
|
||||
}
|
||||
|
||||
size_t getCommandSize() const {
|
||||
return dataSize;
|
||||
}
|
||||
private:
|
||||
object_id_t objectId = 0;
|
||||
const uint8_t* commandBuffer = nullptr; //!< [EXPORT] : [MAXSIZE] 256 Bytes
|
||||
size_t dataSize = 0; //!< [EXPORT] : [IGNORE]
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservice 129: Command packet to set wiretapping mode
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class WiretappingToggle: public SerialLinkedListAdapter<SerializeIF>{ //!< [EXPORT] : [SUBSERVICE] 129
|
||||
public:
|
||||
static const size_t WIRETAPPING_COMMAND_SIZE = 5;
|
||||
WiretappingToggle(){
|
||||
setStart(&objectId);
|
||||
objectId.setNext(&wiretappingMode);
|
||||
}
|
||||
|
||||
uint8_t getWiretappingMode() const {
|
||||
return wiretappingMode.entry;
|
||||
}
|
||||
private:
|
||||
SerializeElement<object_id_t> objectId;
|
||||
SerializeElement<uint8_t> wiretappingMode; //!< [EXPORT] : [INPUT] Mode 0: OFF, Mode 1: RAW
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservices 130 and 131: TM packets
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class WiretappingPacket { //!< [EXPORT] : [SUBSERVICE] 130, 131
|
||||
public:
|
||||
object_id_t objectId; //!< [EXPORT] : [COMMENT] Object ID of source object
|
||||
const uint8_t* data; //!< [EXPORT] : [MAXSIZE] Raw Command Max. Size
|
||||
WiretappingPacket(object_id_t objectId, const uint8_t* buffer):
|
||||
objectId(objectId), data(buffer) {
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE2PACKETS_H_ */
|
21
src/fsfw/pus/servicepackets/Service3Packets.h
Normal file
21
src/fsfw/pus/servicepackets/Service3Packets.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE3PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE3PACKETS_H_
|
||||
|
||||
#include <fsfw/housekeeping/HousekeepingMessage.h>
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* @brief Subservices 25 and 26: TM packets
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class HkPacket { //!< [EXPORT] : [SUBSERVICE] 25, 26
|
||||
public:
|
||||
sid_t sid; //!< [EXPORT] : [COMMENT] Structure ID (SID) of housekeeping data.
|
||||
const uint8_t* hkData; //!< [EXPORT] : [MAXSIZE] Deduced size
|
||||
size_t hkSize; //!< [EXPORT] : [IGNORE]
|
||||
|
||||
HkPacket(sid_t sid, const uint8_t* data, size_t size):
|
||||
sid(sid), hkData(data), hkSize(size) {}
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE3PACKETS_H_ */
|
76
src/fsfw/pus/servicepackets/Service5Packets.h
Normal file
76
src/fsfw/pus/servicepackets/Service5Packets.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_
|
||||
|
||||
#include "../../serialize/SerializeAdapter.h"
|
||||
#include "../../tmtcservices/VerificationCodes.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservice 1, 2, 3, 4
|
||||
* Structure of Event Report.
|
||||
* It consists of:
|
||||
* 1. Report ID(RID). This is the Event ID in the FSFW
|
||||
* 2. Object ID of the reporter (e.g. subsystem)
|
||||
* 2. Parameter 1
|
||||
* 3. Parameter 2
|
||||
*
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class EventReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 2, 3, 4
|
||||
public:
|
||||
|
||||
EventReport(EventId_t reportId_, object_id_t objectId_, uint32_t parameter1_,
|
||||
uint32_t parameter2_):
|
||||
reportId(reportId_),objectId(objectId_), parameter1(parameter1_),
|
||||
parameter2(parameter2_) {}
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size,
|
||||
size_t maxSize,
|
||||
SerializeIF::Endianness streamEndianness) const override
|
||||
{
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&reportId, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(&objectId, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(¶meter1, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = SerializeAdapter::serialize(¶meter2, buffer, size,
|
||||
maxSize, streamEndianness);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual size_t getSerializedSize() const override {
|
||||
uint32_t size = 0;
|
||||
size += SerializeAdapter::getSerializedSize(&reportId);
|
||||
size += SerializeAdapter::getSerializedSize(&objectId);
|
||||
size += SerializeAdapter::getSerializedSize(¶meter1);
|
||||
size += SerializeAdapter::getSerializedSize(¶meter2);
|
||||
return size;
|
||||
|
||||
}
|
||||
|
||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
SerializeIF::Endianness streamEndianness) override {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
private:
|
||||
EventId_t reportId;
|
||||
object_id_t objectId;
|
||||
uint32_t parameter1;
|
||||
uint32_t parameter2;
|
||||
};
|
||||
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE5PACKETS_H_ */
|
121
src/fsfw/pus/servicepackets/Service8Packets.h
Normal file
121
src/fsfw/pus/servicepackets/Service8Packets.h
Normal file
@ -0,0 +1,121 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_
|
||||
|
||||
#include "../../action/ActionMessage.h"
|
||||
#include "../../objectmanager/SystemObjectIF.h"
|
||||
#include "../../serialize/SerialBufferAdapter.h"
|
||||
#include "../../serialize/SerializeElement.h"
|
||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||
#include "../../serialize/SerialFixedArrayListAdapter.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservice 128
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class DirectCommand: public SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128
|
||||
public:
|
||||
|
||||
DirectCommand(const uint8_t* tcData, size_t size) {
|
||||
SerializeAdapter::deSerialize(&objectId, &tcData, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&actionId, &tcData, &size,
|
||||
SerializeIF::Endianness::BIG);
|
||||
parameterBuffer = tcData;
|
||||
parametersSize = size;
|
||||
}
|
||||
|
||||
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 = 0;
|
||||
ActionId_t actionId = 0;
|
||||
uint32_t parametersSize; //!< [EXPORT] : [IGNORE]
|
||||
const uint8_t * parameterBuffer; //!< [EXPORT] : [MAXSIZE] 65535 Bytes
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservice 130
|
||||
* Data reply (subservice 130) consists of
|
||||
* 1. Target Object ID
|
||||
* 2. Action ID
|
||||
* 3. Data
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Subservice 132
|
||||
* @details
|
||||
* Not used yet. Telecommand Verification takes care of this.
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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 /* FSFW_PUS_SERVICEPACKETS_SERVICE8PACKETS_H_ */
|
32
src/fsfw/pus/servicepackets/Service9Packets.h
Normal file
32
src/fsfw/pus/servicepackets/Service9Packets.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE9PACKETS_H_
|
||||
#define FSFW_PUS_SERVICEPACKETS_SERVICE9PACKETS_H_
|
||||
|
||||
#include "../../serialize/SerialLinkedListAdapter.h"
|
||||
|
||||
/**
|
||||
* @brief Subservice 128
|
||||
* @details
|
||||
* It only contains the time encoded as ASCII, CRC, CUC or CDS
|
||||
* @ingroup spacepackets
|
||||
*/
|
||||
class TimePacket : SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128
|
||||
public:
|
||||
TimePacket(const uint8_t * timeBuffer_, uint32_t timeSize_) {
|
||||
timeBuffer = timeBuffer_;
|
||||
timeSize = timeSize_;
|
||||
}
|
||||
const uint8_t* getTime() {
|
||||
return timeBuffer;
|
||||
}
|
||||
|
||||
uint32_t getTimeSize() const {
|
||||
return timeSize;
|
||||
}
|
||||
|
||||
private:
|
||||
TimePacket(const TimePacket &command);
|
||||
const uint8_t * timeBuffer;
|
||||
uint32_t timeSize; //!< [EXPORT] : [IGNORE]
|
||||
};
|
||||
|
||||
#endif /* FSFW_PUS_SERVICEPACKETS_SERVICE9PACKETS_H_ */
|
Reference in New Issue
Block a user