finalized PUS C TM support
This commit is contained in:
parent
f906605097
commit
ed186b04df
@ -1,8 +1,9 @@
|
||||
#include "Service17Test.h"
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../serviceinterface/ServiceInterface.h"
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStoredPusA.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStored.h"
|
||||
|
||||
|
||||
Service17Test::Service17Test(object_id_t objectId,
|
||||
@ -17,15 +18,25 @@ Service17Test::~Service17Test() {
|
||||
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
|
||||
switch(subservice) {
|
||||
case Subservice::CONNECTION_TEST: {
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA connectionPacket(apid, serviceId,
|
||||
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
||||
#else
|
||||
TmPacketStoredPusC connectionPacket(apid, serviceId,
|
||||
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
||||
#endif
|
||||
connectionPacket.sendPacket(requestQueue->getDefaultDestination(),
|
||||
requestQueue->getId());
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case Subservice::EVENT_TRIGGER_TEST: {
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA connectionPacket(apid, serviceId,
|
||||
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
||||
#else
|
||||
TmPacketStoredPusC connectionPacket(apid, serviceId,
|
||||
Subservice::CONNECTION_TEST_REPORT, packetSubCounter++);
|
||||
#endif
|
||||
connectionPacket.sendPacket(requestQueue->getDefaultDestination(),
|
||||
requestQueue->getId());
|
||||
triggerEvent(TEST, 1234, 5678);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../tmtcservices/PusVerificationReport.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStoredPusA.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStored.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../tmtcservices/AcceptsTelemetryIF.h"
|
||||
|
||||
@ -68,8 +68,13 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
|
||||
message->getTcSequenceControl(), message->getStep(),
|
||||
message->getErrorCode(), message->getParameter1(),
|
||||
message->getParameter2());
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(),
|
||||
packetSubCounter++, &report);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(),
|
||||
packetSubCounter++, &report);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(),
|
||||
tmQueue->getId());
|
||||
return result;
|
||||
@ -79,8 +84,13 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
|
||||
PusVerificationMessage *message) {
|
||||
SuccessReport report(message->getReportId(),message->getTcPacketId(),
|
||||
message->getTcSequenceControl(),message->getStep());
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(),
|
||||
packetSubCounter++, &report);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(),
|
||||
packetSubCounter++, &report);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(),
|
||||
tmQueue->getId());
|
||||
return result;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../events/EventManagerIF.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStoredPusA.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStored.h"
|
||||
|
||||
|
||||
Service5EventReporting::Service5EventReporting(object_id_t objectId,
|
||||
@ -52,8 +52,13 @@ ReturnValue_t Service5EventReporting::generateEventReport(
|
||||
{
|
||||
EventReport report(message.getEventId(),message.getReporter(),
|
||||
message.getParameter1(),message.getParameter2());
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacket(PusServiceBase::apid, PusServiceBase::serviceId,
|
||||
message.getSeverity(), packetSubCounter++, &report);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacket(PusServiceBase::apid, PusServiceBase::serviceId,
|
||||
message.getSeverity(), packetSubCounter++, &report);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacket.sendPacket(
|
||||
requestQueue->getDefaultDestination(),requestQueue->getId());
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
|
@ -5,6 +5,7 @@ target_sources(${LIB_FSFW_NAME}
|
||||
TmPacketBase.cpp
|
||||
TmPacketMinimal.cpp
|
||||
TmPacketStoredPusA.cpp
|
||||
TmPacketStoredPusC.cpp
|
||||
TmPacketPusA.cpp
|
||||
TmPacketPusC.cpp
|
||||
TmPacketStoredBase.cpp
|
||||
|
@ -54,8 +54,8 @@ uint8_t* TmPacketPusC::getPacketTimeRaw() const{
|
||||
}
|
||||
|
||||
void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service,
|
||||
uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId = 0,
|
||||
uint8_t timeRefField = 0) {
|
||||
uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId,
|
||||
uint8_t timeRefField) {
|
||||
//Set primary header:
|
||||
initSpacePacketHeader(false, true, apid);
|
||||
//Set data Field Header:
|
||||
@ -67,13 +67,15 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service,
|
||||
// status. To change to PUS-C, set 0b00100000.
|
||||
// Set CCSDS_secondary header flag to 0, version number to 001 and ack
|
||||
// to 0000
|
||||
/* Only account for last 4 bytes */
|
||||
timeRefField &= 0b1111;
|
||||
tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField;
|
||||
tmData->dataField.serviceType = service;
|
||||
tmData->dataField.serviceSubtype = subservice;
|
||||
tmData->dataField.subcounter = packetSubcounter;
|
||||
tmData->dataField.destinationId = destinationId;
|
||||
//Timestamp packet
|
||||
if (checkAndSetStamper()) {
|
||||
if (TmPacketBase::checkAndSetStamper()) {
|
||||
timeStamper->addTimeStamp(tmData->dataField.time,
|
||||
sizeof(tmData->dataField.time));
|
||||
}
|
||||
|
@ -73,19 +73,13 @@ public:
|
||||
uint16_t getSourceDataSize() override;
|
||||
uint16_t getDataFieldSize() override;
|
||||
|
||||
/**
|
||||
* Interprets the "time"-field in the secondary header and returns it in
|
||||
* timeval format.
|
||||
* @return Converted timestamp of packet.
|
||||
*/
|
||||
ReturnValue_t getPacketTime(timeval* timestamp) const override;
|
||||
/**
|
||||
* Returns a raw pointer to the beginning of the time field.
|
||||
* @return Raw pointer to time field.
|
||||
*/
|
||||
uint8_t* getPacketTimeRaw() const override;
|
||||
|
||||
size_t getTimestampSize() const override;
|
||||
|
||||
size_t getPacketMinimumSize() const override;
|
||||
|
||||
protected:
|
||||
@ -106,7 +100,7 @@ protected:
|
||||
* @param packetSubcounter Additional subcounter used.
|
||||
*/
|
||||
void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice,
|
||||
uint16_t packetSubcounter, uint16_t destinationId, uint8_t timeRefField);
|
||||
uint16_t packetSubcounter, uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
||||
|
||||
/**
|
||||
* With this method, the packet data pointer can be redirected to another
|
||||
@ -125,11 +119,6 @@ protected:
|
||||
*/
|
||||
void setSourceDataSize(uint16_t size);
|
||||
|
||||
/**
|
||||
* Checks if a time stamper is available and tries to set it if not.
|
||||
* @return Returns false if setting failed.
|
||||
*/
|
||||
bool checkAndSetStamper();
|
||||
};
|
||||
|
||||
#endif /* FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ */
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 1
|
||||
#include "TmPacketStoredPusC.h"
|
||||
#else
|
||||
#include "TmPacketStoredPusA.h"
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "TmPacketStoredPusA.h"
|
||||
|
||||
#include "../../objectmanager/ObjectManagerIF.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../serviceinterface/ServiceInterface.h"
|
||||
#include "../../tmtcservices/TmTcMessage.h"
|
||||
|
||||
#include <cstring>
|
||||
|
@ -1,18 +1,12 @@
|
||||
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_
|
||||
#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_
|
||||
|
||||
#include "TmPacketBase.h"
|
||||
#include "TmPacketStoredBase.h"
|
||||
#include "TmPacketPusA.h"
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#include "../../tmtcpacket/pus/TmPacketPusA.h"
|
||||
#include "../../serialize/SerializeIF.h"
|
||||
#include "../../storagemanager/StorageManagerIF.h"
|
||||
#include "../../internalError/InternalErrorReporterIF.h"
|
||||
#include "../../ipc/MessageQueueSenderIF.h"
|
||||
|
||||
/**
|
||||
* This class generates a ECSS PUS Telemetry packet within a given
|
||||
* This class generates a ECSS PUS A Telemetry packet within a given
|
||||
* intermediate storage.
|
||||
* As most packets are passed between tasks with the help of a storage
|
||||
* anyway, it seems logical to create a Packet-In-Storage access class
|
||||
|
@ -1,2 +1,80 @@
|
||||
#include "TmPacketStoredPusC.h"
|
||||
|
||||
#include "../../serviceinterface/ServiceInterface.h"
|
||||
#include "../../tmtcservices/TmTcMessage.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
TmPacketStoredPusC::TmPacketStoredPusC(store_address_t setAddress) :
|
||||
TmPacketStoredBase(setAddress), TmPacketPusC(nullptr){
|
||||
}
|
||||
|
||||
TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
|
||||
uint8_t subservice, uint16_t packetSubcounter, const uint8_t *data,
|
||||
uint32_t size, const uint8_t *headerData, uint32_t headerSize, uint16_t destinationId,
|
||||
uint8_t timeRefField) :
|
||||
TmPacketPusC(nullptr) {
|
||||
storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||
if (not TmPacketStoredBase::checkAndSetStore()) {
|
||||
return;
|
||||
}
|
||||
uint8_t *pData = nullptr;
|
||||
ReturnValue_t returnValue = store->getFreeElement(&storeAddress,
|
||||
(getPacketMinimumSize() + size + headerSize), &pData);
|
||||
|
||||
if (returnValue != store->RETURN_OK) {
|
||||
TmPacketStoredBase::checkAndReportLostTm();
|
||||
return;
|
||||
}
|
||||
setData(pData);
|
||||
initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField);
|
||||
memcpy(getSourceData(), headerData, headerSize);
|
||||
memcpy(getSourceData() + headerSize, data, size);
|
||||
setPacketDataLength(
|
||||
size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
|
||||
}
|
||||
|
||||
TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
|
||||
uint8_t subservice, uint16_t packetSubcounter, SerializeIF *content,
|
||||
SerializeIF *header, uint16_t destinationId, uint8_t timeRefField) :
|
||||
TmPacketPusC(nullptr) {
|
||||
storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||
if (not TmPacketStoredBase::checkAndSetStore()) {
|
||||
return;
|
||||
}
|
||||
size_t sourceDataSize = 0;
|
||||
if (content != NULL) {
|
||||
sourceDataSize += content->getSerializedSize();
|
||||
}
|
||||
if (header != NULL) {
|
||||
sourceDataSize += header->getSerializedSize();
|
||||
}
|
||||
uint8_t *p_data = NULL;
|
||||
ReturnValue_t returnValue = store->getFreeElement(&storeAddress,
|
||||
(getPacketMinimumSize() + sourceDataSize), &p_data);
|
||||
if (returnValue != store->RETURN_OK) {
|
||||
TmPacketStoredBase::checkAndReportLostTm();
|
||||
}
|
||||
setData(p_data);
|
||||
initializeTmPacket(apid, service, subservice, packetSubcounter);
|
||||
uint8_t *putDataHere = getSourceData();
|
||||
size_t size = 0;
|
||||
if (header != NULL) {
|
||||
header->serialize(&putDataHere, &size, sourceDataSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
if (content != NULL) {
|
||||
content->serialize(&putDataHere, &size, sourceDataSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
setPacketDataLength(
|
||||
sourceDataSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
|
||||
}
|
||||
|
||||
uint8_t* TmPacketStoredPusC::getAllTmData() {
|
||||
return getWholeData();
|
||||
}
|
||||
|
||||
void TmPacketStoredPusC::setDataPointer(const uint8_t *newPointer) {
|
||||
setData(newPointer);
|
||||
}
|
||||
|
@ -1,7 +1,64 @@
|
||||
#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
||||
#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_
|
||||
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStoredBase.h>
|
||||
|
||||
/**
|
||||
* This class generates a ECSS PUS A Telemetry packet within a given
|
||||
* intermediate storage.
|
||||
* As most packets are passed between tasks with the help of a storage
|
||||
* anyway, it seems logical to create a Packet-In-Storage access class
|
||||
* which saves the user almost all storage handling operation.
|
||||
* Packets can both be newly created with the class and be "linked" to
|
||||
* packets in a store with the help of a storeAddress.
|
||||
* @ingroup tmtcpackets
|
||||
*/
|
||||
class TmPacketStoredPusC:
|
||||
public TmPacketStoredBase,
|
||||
public TmPacketPusC {
|
||||
public:
|
||||
/**
|
||||
* This is a default constructor which does not set the data pointer.
|
||||
* However, it does try to set the packet store.
|
||||
*/
|
||||
TmPacketStoredPusC( store_address_t setAddress );
|
||||
/**
|
||||
* With this constructor, new space is allocated in the packet store and
|
||||
* a new PUS Telemetry Packet is created there.
|
||||
* Packet Application Data passed in data is copied into the packet.
|
||||
* The Application data is passed in two parts, first a header, then a
|
||||
* data field. This allows building a Telemetry Packet from two separate
|
||||
* data sources.
|
||||
* @param apid Sets the packet's APID field.
|
||||
* @param service Sets the packet's Service ID field.
|
||||
* This specifies the source service.
|
||||
* @param subservice Sets the packet's Service Subtype field.
|
||||
* This specifies the source sub-service.
|
||||
* @param packet_counter Sets the Packet counter field of this packet
|
||||
* @param data The payload data to be copied to the
|
||||
* Application Data Field
|
||||
* @param size The amount of data to be copied.
|
||||
* @param headerData The header Data of the Application field,
|
||||
* will be copied in front of data
|
||||
* @param headerSize The size of the headerDataF
|
||||
*/
|
||||
TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice,
|
||||
uint16_t packetCounter = 0, const uint8_t* data = nullptr,
|
||||
uint32_t size = 0, const uint8_t* headerData = nullptr,
|
||||
uint32_t headerSize = 0, uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
||||
/**
|
||||
* Another ctor to directly pass structured content and header data to the
|
||||
* packet to avoid additional buffers.
|
||||
*/
|
||||
TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice,
|
||||
uint16_t packetCounter, SerializeIF* content,
|
||||
SerializeIF* header = nullptr, uint16_t destinationId = 0, uint8_t timeRefField = 0);
|
||||
|
||||
uint8_t* getAllTmData() override;
|
||||
void setDataPointer(const uint8_t* newPointer) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include "AcceptsTelemetryIF.h"
|
||||
#include "CommandingServiceBase.h"
|
||||
#include "TmTcMessage.h"
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#include "../tcdistribution/PUSDistributorIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../tmtcpacket/pus/TcPacketStored.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStoredPusA.h"
|
||||
#include "../tmtcpacket/pus/TmPacketStored.h"
|
||||
#include "../serviceinterface/ServiceInterface.h"
|
||||
|
||||
object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
|
||||
@ -293,8 +294,13 @@ void CommandingServiceBase::handleRequestQueue() {
|
||||
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
|
||||
const uint8_t* data, size_t dataLen, const uint8_t* headerData,
|
||||
size_t headerSize) {
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, data, dataLen, headerData, headerSize);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, data, dataLen, headerData, headerSize);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacketStored.sendPacket(
|
||||
requestQueue->getDefaultDestination(), requestQueue->getId());
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -311,8 +317,13 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
|
||||
size_t size = 0;
|
||||
SerializeAdapter::serialize(&objectId, &pBuffer, &size,
|
||||
sizeof(object_id_t), SerializeIF::Endianness::BIG);
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, data, dataLen, buffer, size);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, data, dataLen, buffer, size);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacketStored.sendPacket(
|
||||
requestQueue->getDefaultDestination(), requestQueue->getId());
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -324,8 +335,13 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
|
||||
|
||||
ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice,
|
||||
SerializeIF* content, SerializeIF* header) {
|
||||
#if FSFW_USE_PUS_C_TELEMETRY == 0
|
||||
TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, content, header);
|
||||
#else
|
||||
TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice,
|
||||
this->tmPacketCounter, content, header);
|
||||
#endif
|
||||
ReturnValue_t result = tmPacketStored.sendPacket(
|
||||
requestQueue->getDefaultDestination(), requestQueue->getId());
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "CatchFactory.h"
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include "CatchFactory.h"
|
||||
|
||||
#include <fsfw/events/EventManager.h>
|
||||
#include <fsfw/health/HealthTable.h>
|
||||
@ -74,7 +74,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
|
||||
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
|
||||
|
||||
TmPacketStoredPusA::timeStamperId = objects::NO_OBJECT;
|
||||
TmPacketBase::timeStamperId = objects::NO_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user