taken over some changes
This commit is contained in:
parent
e7210a34f9
commit
90bdb844e7
@ -7,7 +7,8 @@ class TmPacketMinimal;
|
|||||||
class PacketTimestampInterpreterIF {
|
class PacketTimestampInterpreterIF {
|
||||||
public:
|
public:
|
||||||
virtual ~PacketTimestampInterpreterIF() {}
|
virtual ~PacketTimestampInterpreterIF() {}
|
||||||
virtual ReturnValue_t getPacketTime(TmPacketMinimal* packet, timeval* timestamp) const = 0;
|
virtual ReturnValue_t getPacketTime(TmPacketMinimal* packet,
|
||||||
|
timeval* timestamp) const = 0;
|
||||||
virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, uint32_t* size) const = 0;
|
virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, uint32_t* size) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
#include "../../globalfunctions/CRC.h"
|
#include "TcPacketBase.h"
|
||||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
|
||||||
#include "../../tmtcpacket/pus/TcPacketBase.h"
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
TcPacketBase::TcPacketBase(const uint8_t* set_data) :
|
#include "../../globalfunctions/CRC.h"
|
||||||
SpacePacketBase(set_data) {
|
#include "../../globalfunctions/arrayprinter.h"
|
||||||
tcData = (TcPacketPointer*) set_data;
|
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
TcPacketBase::TcPacketBase(const uint8_t* setData) :
|
||||||
|
SpacePacketBase(setData) {
|
||||||
|
tcData = reinterpret_cast<TcPacketPointer*>(const_cast<uint8_t*>(setData));
|
||||||
}
|
}
|
||||||
|
|
||||||
TcPacketBase::~TcPacketBase() {
|
TcPacketBase::~TcPacketBase() {
|
||||||
@ -51,12 +54,6 @@ void TcPacketBase::setData(const uint8_t* pData) {
|
|||||||
tcData = (TcPacketPointer*) pData;
|
tcData = (TcPacketPointer*) pData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcPacketBase::setAppData(uint8_t * appData, uint16_t dataLen) {
|
|
||||||
memcpy(&tcData->appData, appData, dataLen);
|
|
||||||
SpacePacketBase::setPacketDataLength(dataLen +
|
|
||||||
sizeof(PUSTcDataFieldHeader) + TcPacketBase::CRC_SIZE - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t TcPacketBase::getSecondaryHeaderFlag() {
|
uint8_t TcPacketBase::getSecondaryHeaderFlag() {
|
||||||
return (tcData->dataField.version_type_ack & 0b10000000) >> 7;
|
return (tcData->dataField.version_type_ack & 0b10000000) >> 7;
|
||||||
}
|
}
|
||||||
@ -66,21 +63,17 @@ uint8_t TcPacketBase::getPusVersionNumber() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TcPacketBase::print() {
|
void TcPacketBase::print() {
|
||||||
uint8_t * wholeData = getWholeData();
|
sif::debug << "TcPacketBase::print: " << std::endl;
|
||||||
sif::debug << "TcPacket contains: " << std::endl;
|
arrayprinter::print(getWholeData(), getFullSize());
|
||||||
for (uint8_t count = 0; count < getFullSize(); ++count) {
|
|
||||||
sif::debug << std::hex << (uint16_t) wholeData[count] << " ";
|
|
||||||
}
|
|
||||||
sif::debug << std::dec << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcPacketBase::initializeTcPacket(uint16_t apid, uint16_t sequenceCount,
|
void TcPacketBase::initializeTcPacket(uint16_t apid, uint16_t sequenceCount,
|
||||||
uint8_t ack, uint8_t service, uint8_t subservice) {
|
uint8_t ack, uint8_t service, uint8_t subservice) {
|
||||||
initSpacePacketHeader(true, true, apid, sequenceCount);
|
initSpacePacketHeader(true, true, apid, sequenceCount);
|
||||||
memset(&tcData->dataField, 0, sizeof(tcData->dataField));
|
std::memset(&tcData->dataField, 0, sizeof(tcData->dataField));
|
||||||
setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
||||||
//Data Field Header:
|
//Data Field Header:
|
||||||
//Set CCSDS_secondary_header_flag to 0, version number to 001 and ack to 0000
|
//Set CCSDS_secondary_header_flag to 0 and version number to 001
|
||||||
tcData->dataField.version_type_ack = 0b00010000;
|
tcData->dataField.version_type_ack = 0b00010000;
|
||||||
tcData->dataField.version_type_ack |= (ack & 0x0F);
|
tcData->dataField.version_type_ack |= (ack & 0x0F);
|
||||||
tcData->dataField.service_type = service;
|
tcData->dataField.service_type = service;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef TCPACKETBASE_H_
|
#ifndef TMTCPACKET_PUS_TCPACKETBASE_H_
|
||||||
#define TCPACKETBASE_H_
|
#define TMTCPACKET_PUS_TCPACKETBASE_H_
|
||||||
|
|
||||||
#include "../../tmtcpacket/SpacePacketBase.h"
|
#include "../../tmtcpacket/SpacePacketBase.h"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This struct defines a byte-wise structured PUS TC Data Field Header.
|
* This struct defines a byte-wise structured PUS TC Data Field Header.
|
||||||
* Any optional fields in the header must be added or removed here.
|
* Any optional fields in the header must be added or removed here.
|
||||||
@ -31,7 +32,7 @@ struct TcPacketPointer {
|
|||||||
/**
|
/**
|
||||||
* This class is the basic data handler for any ECSS PUS Telecommand packet.
|
* This class is the basic data handler for any ECSS PUS Telecommand packet.
|
||||||
*
|
*
|
||||||
* In addition to \SpacePacketBase, the class provides methods to handle
|
* In addition to #SpacePacketBase, the class provides methods to handle
|
||||||
* the standardized entries of the PUS TC Packet Data Field Header.
|
* the standardized entries of the PUS TC Packet Data Field Header.
|
||||||
* It does not contain the packet data itself but a pointer to the
|
* It does not contain the packet data itself but a pointer to the
|
||||||
* data must be set on instantiation. An invalid pointer may cause
|
* data must be set on instantiation. An invalid pointer may cause
|
||||||
@ -40,68 +41,38 @@ struct TcPacketPointer {
|
|||||||
* @ingroup tmtcpackets
|
* @ingroup tmtcpackets
|
||||||
*/
|
*/
|
||||||
class TcPacketBase : public SpacePacketBase {
|
class TcPacketBase : public SpacePacketBase {
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* A pointer to a structure which defines the data structure of
|
|
||||||
* the packet's data.
|
|
||||||
*
|
|
||||||
* To be hardware-safe, all elements are of byte size.
|
|
||||||
*/
|
|
||||||
TcPacketPointer* tcData;
|
|
||||||
public:
|
public:
|
||||||
static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + 2);
|
static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) +
|
||||||
/**
|
sizeof(PUSTcDataFieldHeader) + 2);
|
||||||
* With this constant for the acknowledge field responses on all levels are expected.
|
|
||||||
*/
|
enum AckField {
|
||||||
static const uint8_t ACK_ALL = 0b1111;
|
//! No acknowledgements are expected.
|
||||||
/**
|
ACK_NONE = 0b0000,
|
||||||
* With this constant for the acknowledge field a response on acceptance is expected.
|
//! Acknowledgements on acceptance are expected.
|
||||||
*/
|
ACK_ACCEPTANCE = 0b0001,
|
||||||
static const uint8_t ACK_ACCEPTANCE = 0b0001;
|
//! Acknowledgements on start are expected.
|
||||||
/**
|
ACK_START = 0b0010,
|
||||||
* With this constant for the acknowledge field a response on start of execution is expected.
|
//! Acknowledgements on step are expected.
|
||||||
*/
|
ACK_STEP = 0b0100,
|
||||||
static const uint8_t ACK_START = 0b0010;
|
//! Acknowledfgement on completion are expected.
|
||||||
/**
|
ACK_COMPLETION = 0b1000
|
||||||
* With this constant for the acknowledge field responses on execution steps are expected.
|
};
|
||||||
*/
|
|
||||||
static const uint8_t ACK_STEP = 0b0100;
|
static constexpr uint8_t ACK_ALL = ACK_ACCEPTANCE | ACK_START | ACK_STEP |
|
||||||
/**
|
ACK_COMPLETION;
|
||||||
* With this constant for the acknowledge field a response on completion is expected.
|
|
||||||
*/
|
|
||||||
static const uint8_t ACK_COMPLETION = 0b1000;
|
|
||||||
/**
|
|
||||||
* With this constant for the acknowledge field no responses are expected.
|
|
||||||
*/
|
|
||||||
static const uint8_t ACK_NONE = 0b000;
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor.
|
* This is the default constructor.
|
||||||
* It sets its internal data pointer to the address passed and also
|
* It sets its internal data pointer to the address passed and also
|
||||||
* forwards the data pointer to the parent SpacePacketBase class.
|
* forwards the data pointer to the parent SpacePacketBase class.
|
||||||
* @param set_address The position where the packet data lies.
|
* @param setData The position where the packet data lies.
|
||||||
*/
|
*/
|
||||||
TcPacketBase( const uint8_t* set_data );
|
TcPacketBase( const uint8_t* setData );
|
||||||
/**
|
/**
|
||||||
* This is the empty default destructor.
|
* This is the empty default destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~TcPacketBase();
|
virtual ~TcPacketBase();
|
||||||
/**
|
|
||||||
* Initializes the Tc Packet header.
|
|
||||||
* @param apid APID used.
|
|
||||||
* @param service PUS Service
|
|
||||||
* @param subservice PUS Subservice
|
|
||||||
* @param packetSubcounter Additional subcounter used.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Initializes the Tc Packet header.
|
|
||||||
* @param apid APID used.
|
|
||||||
* @param sequenceCount Sequence Count in the primary header.
|
|
||||||
* @param ack Which acknowledeges are expected from the receiver.
|
|
||||||
* @param service PUS Service
|
|
||||||
* @param subservice PUS Subservice
|
|
||||||
*/
|
|
||||||
void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack,
|
|
||||||
uint8_t service, uint8_t subservice);
|
|
||||||
/**
|
/**
|
||||||
* This command returns the CCSDS Secondary Header Flag.
|
* This command returns the CCSDS Secondary Header Flag.
|
||||||
* It shall always be zero for PUS Packets. This is the
|
* It shall always be zero for PUS Packets. This is the
|
||||||
@ -169,24 +140,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setErrorControl();
|
void setErrorControl();
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies the supplied data to the internal TC application data field.
|
|
||||||
* @param pData
|
|
||||||
* @param dataLen
|
|
||||||
*/
|
|
||||||
void setAppData(uint8_t * appData, uint16_t dataLen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* With this method, the packet data pointer can be redirected to another
|
|
||||||
* location.
|
|
||||||
*
|
|
||||||
* This call overwrites the parent's setData method to set both its
|
|
||||||
* \c tc_data pointer and the parent's \c data pointer.
|
|
||||||
*
|
|
||||||
* @param p_data A pointer to another PUS Telecommand Packet.
|
|
||||||
*/
|
|
||||||
void setData( const uint8_t* pData );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a debugging helper method that prints the whole packet content
|
* This is a debugging helper method that prints the whole packet content
|
||||||
* to the screen.
|
* to the screen.
|
||||||
@ -198,7 +151,37 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static size_t calculateFullPacketLength(size_t appDataLen);
|
static size_t calculateFullPacketLength(size_t appDataLen);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* A pointer to a structure which defines the data structure of
|
||||||
|
* the packet's data.
|
||||||
|
*
|
||||||
|
* To be hardware-safe, all elements are of byte size.
|
||||||
|
*/
|
||||||
|
TcPacketPointer* tcData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the Tc Packet header.
|
||||||
|
* @param apid APID used.
|
||||||
|
* @param sequenceCount Sequence Count in the primary header.
|
||||||
|
* @param ack Which acknowledeges are expected from the receiver.
|
||||||
|
* @param service PUS Service
|
||||||
|
* @param subservice PUS Subservice
|
||||||
|
*/
|
||||||
|
void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack,
|
||||||
|
uint8_t service, uint8_t subservice);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* With this method, the packet data pointer can be redirected to another
|
||||||
|
* location.
|
||||||
|
* This call overwrites the parent's setData method to set both its
|
||||||
|
* @c tc_data pointer and the parent's @c data pointer.
|
||||||
|
*
|
||||||
|
* @param p_data A pointer to another PUS Telecommand Packet.
|
||||||
|
*/
|
||||||
|
void setData( const uint8_t* pData );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* TCPACKETBASE_H_ */
|
#endif /* TMTCPACKET_PUS_TCPACKETBASE_H_ */
|
||||||
|
@ -1,32 +1,34 @@
|
|||||||
|
#include "TcPacketStored.h"
|
||||||
#include "../../objectmanager/ObjectManagerIF.h"
|
#include "../../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "../../tmtcpacket/pus/TcPacketStored.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
StorageManagerIF* TcPacketStored::store = nullptr;
|
||||||
|
|
||||||
TcPacketStored::TcPacketStored(store_address_t setAddress) :
|
TcPacketStored::TcPacketStored(store_address_t setAddress) :
|
||||||
TcPacketBase(nullptr), storeAddress(setAddress) {
|
TcPacketBase(nullptr), storeAddress(setAddress) {
|
||||||
this->setStoreAddress(this->storeAddress);
|
setStoreAddress(storeAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
TcPacketStored::TcPacketStored(uint8_t service, uint8_t subservice,
|
TcPacketStored::TcPacketStored(uint16_t apid, uint8_t service,
|
||||||
uint16_t apid, uint8_t sequence_count, const uint8_t* data,
|
uint8_t subservice, uint8_t sequenceCount, const uint8_t* data,
|
||||||
size_t size, uint8_t ack ) :
|
size_t size, uint8_t ack) :
|
||||||
TcPacketBase(nullptr) {
|
TcPacketBase(nullptr) {
|
||||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
if (!this->checkAndSetStore()) {
|
if (not this->checkAndSetStore()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t* p_data = nullptr;
|
uint8_t* pData = nullptr;
|
||||||
ReturnValue_t returnValue = this->store->getFreeElement(&this->storeAddress,
|
ReturnValue_t returnValue = this->store->getFreeElement(&this->storeAddress,
|
||||||
(TC_PACKET_MIN_SIZE + size), &p_data);
|
(TC_PACKET_MIN_SIZE + size), &pData);
|
||||||
if (returnValue != HasReturnvaluesIF::RETURN_OK) {
|
if (returnValue != this->store->RETURN_OK) {
|
||||||
sif::warning << "TcPacketStored::TcPacketStored: Could not get "
|
sif::warning << "TcPacketStored: Could not get free element from store!"
|
||||||
"free element from store!" << std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->setData(p_data);
|
this->setData(pData);
|
||||||
initializeTcPacket(apid, sequence_count, ack, service, subservice);
|
initializeTcPacket(apid, sequenceCount, ack, service, subservice);
|
||||||
memcpy(&tcData->appData, data, size);
|
memcpy(&tcData->appData, data, size);
|
||||||
this->setPacketDataLength(
|
this->setPacketDataLength(
|
||||||
size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
||||||
@ -42,8 +44,7 @@ ReturnValue_t TcPacketStored::getData(const uint8_t ** dataPtr,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TcPacketStored::TcPacketStored() :
|
TcPacketStored::TcPacketStored(): TcPacketBase(nullptr) {
|
||||||
TcPacketBase(NULL) {
|
|
||||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
this->checkAndSetStore();
|
this->checkAndSetStore();
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ TcPacketStored::TcPacketStored() :
|
|||||||
ReturnValue_t TcPacketStored::deletePacket() {
|
ReturnValue_t TcPacketStored::deletePacket() {
|
||||||
ReturnValue_t result = this->store->deleteData(this->storeAddress);
|
ReturnValue_t result = this->store->deleteData(this->storeAddress);
|
||||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
this->setData( NULL);
|
this->setData(nullptr);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,17 +71,17 @@ bool TcPacketStored::checkAndSetStore() {
|
|||||||
|
|
||||||
void TcPacketStored::setStoreAddress(store_address_t setAddress) {
|
void TcPacketStored::setStoreAddress(store_address_t setAddress) {
|
||||||
this->storeAddress = setAddress;
|
this->storeAddress = setAddress;
|
||||||
const uint8_t* temp_data = NULL;
|
const uint8_t* tempData = nullptr;
|
||||||
size_t temp_size;
|
size_t temp_size;
|
||||||
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
|
||||||
if (this->checkAndSetStore()) {
|
if (this->checkAndSetStore()) {
|
||||||
status = this->store->getData(this->storeAddress, &temp_data,
|
status = this->store->getData(this->storeAddress, &tempData,
|
||||||
&temp_size);
|
&temp_size);
|
||||||
}
|
}
|
||||||
if (status == StorageManagerIF::RETURN_OK) {
|
if (status == StorageManagerIF::RETURN_OK) {
|
||||||
this->setData(temp_data);
|
this->setData(tempData);
|
||||||
} else {
|
} else {
|
||||||
this->setData(NULL);
|
this->setData(nullptr);
|
||||||
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +91,7 @@ store_address_t TcPacketStored::getStoreAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TcPacketStored::isSizeCorrect() {
|
bool TcPacketStored::isSizeCorrect() {
|
||||||
const uint8_t* temp_data = NULL;
|
const uint8_t* temp_data = nullptr;
|
||||||
size_t temp_size;
|
size_t temp_size;
|
||||||
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data,
|
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data,
|
||||||
&temp_size);
|
&temp_size);
|
||||||
@ -102,8 +103,6 @@ bool TcPacketStored::isSizeCorrect() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageManagerIF* TcPacketStored::store = NULL;
|
|
||||||
|
|
||||||
TcPacketStored::TcPacketStored(const uint8_t* data, uint32_t size) :
|
TcPacketStored::TcPacketStored(const uint8_t* data, uint32_t size) :
|
||||||
TcPacketBase(data) {
|
TcPacketBase(data) {
|
||||||
if (getFullSize() != size) {
|
if (getFullSize() != size) {
|
||||||
@ -112,7 +111,7 @@ TcPacketStored::TcPacketStored(const uint8_t* data, uint32_t size) :
|
|||||||
if (this->checkAndSetStore()) {
|
if (this->checkAndSetStore()) {
|
||||||
ReturnValue_t status = store->addData(&storeAddress, data, size);
|
ReturnValue_t status = store->addData(&storeAddress, data, size);
|
||||||
if (status != HasReturnvaluesIF::RETURN_OK) {
|
if (status != HasReturnvaluesIF::RETURN_OK) {
|
||||||
this->setData(NULL);
|
this->setData(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef TCPACKETSTORED_H_
|
#ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_
|
||||||
#define TCPACKETSTORED_H_
|
#define TMTCPACKET_PUS_TCPACKETSTORED_H_
|
||||||
|
|
||||||
|
#include "TcPacketBase.h"
|
||||||
#include "../../storagemanager/StorageManagerIF.h"
|
#include "../../storagemanager/StorageManagerIF.h"
|
||||||
#include "../../tmtcpacket/pus/TcPacketBase.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class generates a ECSS PUS Telecommand packet within a given
|
* This class generates a ECSS PUS Telecommand packet within a given
|
||||||
@ -15,26 +15,6 @@
|
|||||||
* @ingroup tmtcpackets
|
* @ingroup tmtcpackets
|
||||||
*/
|
*/
|
||||||
class TcPacketStored : public TcPacketBase {
|
class TcPacketStored : public TcPacketBase {
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* This is a pointer to the store all instances of the class use.
|
|
||||||
* If the store is not yet set (i.e. \c store is NULL), every constructor
|
|
||||||
* call tries to set it and throws an error message in case of failures.
|
|
||||||
* The default store is objects::TC_STORE.
|
|
||||||
*/
|
|
||||||
static StorageManagerIF* store;
|
|
||||||
/**
|
|
||||||
* The address where the packet data of the object instance is stored.
|
|
||||||
*/
|
|
||||||
store_address_t storeAddress;
|
|
||||||
/**
|
|
||||||
* A helper method to check if a store is assigned to the class.
|
|
||||||
* If not, the method tries to retrieve the store from the global
|
|
||||||
* ObjectManager.
|
|
||||||
* @return @li \c true if the store is linked or could be created.
|
|
||||||
* @li \c false otherwise.
|
|
||||||
*/
|
|
||||||
bool checkAndSetStore();
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* This is a default constructor which does not set the data pointer.
|
* This is a default constructor which does not set the data pointer.
|
||||||
@ -53,9 +33,6 @@ public:
|
|||||||
* a new PUS Telecommand Packet is created there.
|
* a new PUS Telecommand Packet is created there.
|
||||||
* Packet Application Data passed in data is copied into the packet.
|
* Packet Application Data passed in data is copied into the packet.
|
||||||
* @param apid Sets the packet's APID field.
|
* @param apid Sets the packet's APID field.
|
||||||
* @param ack Set's the packet's Ack field,
|
|
||||||
* which specifies number and size of verification packets returned
|
|
||||||
* for this command.
|
|
||||||
* @param service Sets the packet's Service ID field.
|
* @param service Sets the packet's Service ID field.
|
||||||
* This specifies the destination service.
|
* This specifies the destination service.
|
||||||
* @param subservice Sets the packet's Service Subtype field.
|
* @param subservice Sets the packet's Service Subtype field.
|
||||||
@ -63,10 +40,13 @@ public:
|
|||||||
* @param sequence_count Sets the packet's Source Sequence Count field.
|
* @param sequence_count Sets the packet's Source Sequence Count field.
|
||||||
* @param data The data to be copied to the Application Data Field.
|
* @param data The data to be copied to the Application Data Field.
|
||||||
* @param size The amount of data to be copied.
|
* @param size The amount of data to be copied.
|
||||||
|
* @param ack Set's the packet's Ack field, which specifies
|
||||||
|
* number of verification packets returned
|
||||||
|
* for this command.
|
||||||
*/
|
*/
|
||||||
TcPacketStored( uint8_t service, uint8_t subservice, uint16_t apid,
|
TcPacketStored(uint16_t apid, uint8_t service, uint8_t subservice,
|
||||||
uint8_t sequence_count = 0, const uint8_t* data = nullptr,
|
uint8_t sequence_count = 0, const uint8_t* data = nullptr,
|
||||||
size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL );
|
size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL);
|
||||||
/**
|
/**
|
||||||
* Another constructor to create a TcPacket from a raw packet stream.
|
* Another constructor to create a TcPacket from a raw packet stream.
|
||||||
* Takes the data and adds it unchecked to the TcStore.
|
* Takes the data and adds it unchecked to the TcStore.
|
||||||
@ -75,12 +55,18 @@ public:
|
|||||||
*/
|
*/
|
||||||
TcPacketStored( const uint8_t* data, uint32_t size);
|
TcPacketStored( const uint8_t* data, uint32_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter function for the raw data.
|
||||||
|
* @param dataPtr [out] Pointer to the data pointer to set
|
||||||
|
* @param dataSize [out] Address of size to set.
|
||||||
|
* @return -@c RETURN_OK if data was retrieved successfully.
|
||||||
|
*/
|
||||||
ReturnValue_t getData(const uint8_t ** dataPtr,
|
ReturnValue_t getData(const uint8_t ** dataPtr,
|
||||||
size_t* dataSize);
|
size_t* dataSize);
|
||||||
/**
|
/**
|
||||||
* This is a getter for the current store address of the packet.
|
* This is a getter for the current store address of the packet.
|
||||||
* @return The current store address. The (raw) value is \c StorageManagerIF::INVALID_ADDRESS if
|
* @return The current store address. The (raw) value is
|
||||||
* the packet is not linked.
|
* @c StorageManagerIF::INVALID_ADDRESS if the packet is not linked.
|
||||||
*/
|
*/
|
||||||
store_address_t getStoreAddress();
|
store_address_t getStoreAddress();
|
||||||
/**
|
/**
|
||||||
@ -104,7 +90,28 @@ public:
|
|||||||
* store or size is incorrect.
|
* store or size is incorrect.
|
||||||
*/
|
*/
|
||||||
bool isSizeCorrect();
|
bool isSizeCorrect();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* This is a pointer to the store all instances of the class use.
|
||||||
|
* If the store is not yet set (i.e. @c store is NULL), every constructor
|
||||||
|
* call tries to set it and throws an error message in case of failures.
|
||||||
|
* The default store is objects::TC_STORE.
|
||||||
|
*/
|
||||||
|
static StorageManagerIF* store;
|
||||||
|
/**
|
||||||
|
* The address where the packet data of the object instance is stored.
|
||||||
|
*/
|
||||||
|
store_address_t storeAddress;
|
||||||
|
/**
|
||||||
|
* A helper method to check if a store is assigned to the class.
|
||||||
|
* If not, the method tries to retrieve the store from the global
|
||||||
|
* ObjectManager.
|
||||||
|
* @return @li @c true if the store is linked or could be created.
|
||||||
|
* @li @c false otherwise.
|
||||||
|
*/
|
||||||
|
bool checkAndSetStore();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* TCPACKETSTORED_H_ */
|
#endif /* TMTCPACKET_PUS_TCPACKETSTORED_H_ */
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
|
#include "TmPacketBase.h"
|
||||||
|
|
||||||
#include "../../globalfunctions/CRC.h"
|
#include "../../globalfunctions/CRC.h"
|
||||||
|
#include "../../globalfunctions/arrayprinter.h"
|
||||||
#include "../../objectmanager/ObjectManagerIF.h"
|
#include "../../objectmanager/ObjectManagerIF.h"
|
||||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "../../tmtcpacket/pus/TmPacketBase.h"
|
|
||||||
#include "../../timemanager/CCSDSTime.h"
|
#include "../../timemanager/CCSDSTime.h"
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
TmPacketBase::TmPacketBase(uint8_t* set_data) :
|
#include <cstring>
|
||||||
SpacePacketBase(set_data) {
|
|
||||||
tm_data = (TmPacketPointer*) set_data;
|
TimeStamperIF* TmPacketBase::timeStamper = nullptr;
|
||||||
|
object_id_t TmPacketBase::timeStamperId = 0;
|
||||||
|
|
||||||
|
TmPacketBase::TmPacketBase(uint8_t* setData) :
|
||||||
|
SpacePacketBase(setData) {
|
||||||
|
tmData = reinterpret_cast<TmPacketPointer*>(setData);
|
||||||
}
|
}
|
||||||
|
|
||||||
TmPacketBase::~TmPacketBase() {
|
TmPacketBase::~TmPacketBase() {
|
||||||
@ -15,25 +21,25 @@ TmPacketBase::~TmPacketBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TmPacketBase::getService() {
|
uint8_t TmPacketBase::getService() {
|
||||||
return tm_data->data_field.service_type;
|
return tmData->data_field.service_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TmPacketBase::getSubService() {
|
uint8_t TmPacketBase::getSubService() {
|
||||||
return tm_data->data_field.service_subtype;
|
return tmData->data_field.service_subtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* TmPacketBase::getSourceData() {
|
uint8_t* TmPacketBase::getSourceData() {
|
||||||
return &tm_data->data;
|
return &tmData->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TmPacketBase::getSourceDataSize() {
|
uint16_t TmPacketBase::getSourceDataSize() {
|
||||||
return getPacketDataLength() - sizeof(tm_data->data_field)
|
return getPacketDataLength() - sizeof(tmData->data_field)
|
||||||
- CRC_SIZE + 1;
|
- CRC_SIZE + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TmPacketBase::getErrorControl() {
|
uint16_t TmPacketBase::getErrorControl() {
|
||||||
uint32_t size = getSourceDataSize() + CRC_SIZE;
|
uint32_t size = getSourceDataSize() + CRC_SIZE;
|
||||||
uint8_t* p_to_buffer = &tm_data->data;
|
uint8_t* p_to_buffer = &tmData->data;
|
||||||
return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1];
|
return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,16 +53,12 @@ void TmPacketBase::setErrorControl() {
|
|||||||
|
|
||||||
void TmPacketBase::setData(const uint8_t* p_Data) {
|
void TmPacketBase::setData(const uint8_t* p_Data) {
|
||||||
SpacePacketBase::setData(p_Data);
|
SpacePacketBase::setData(p_Data);
|
||||||
tm_data = (TmPacketPointer*) p_Data;
|
tmData = (TmPacketPointer*) p_Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmPacketBase::print() {
|
void TmPacketBase::print() {
|
||||||
/*uint8_t * wholeData = getWholeData();
|
sif::debug << "TmPacketBase::print: " << std::endl;
|
||||||
debug << "TmPacket contains: " << std::endl;
|
arrayprinter::print(getWholeData(), getFullSize());
|
||||||
for (uint8_t count = 0; count < getFullSize(); ++count ) {
|
|
||||||
debug << std::hex << (uint16_t)wholeData[count] << " ";
|
|
||||||
}
|
|
||||||
debug << std::dec << std::endl;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TmPacketBase::checkAndSetStamper() {
|
bool TmPacketBase::checkAndSetStamper() {
|
||||||
@ -73,47 +75,43 @@ bool TmPacketBase::checkAndSetStamper() {
|
|||||||
|
|
||||||
ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const {
|
ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const {
|
||||||
uint32_t tempSize = 0;
|
uint32_t tempSize = 0;
|
||||||
return CCSDSTime::convertFromCcsds(timestamp, tm_data->data_field.time,
|
return CCSDSTime::convertFromCcsds(timestamp, tmData->data_field.time,
|
||||||
&tempSize, sizeof(tm_data->data_field.time));
|
&tempSize, sizeof(tmData->data_field.time));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* TmPacketBase::getPacketTimeRaw() const{
|
uint8_t* TmPacketBase::getPacketTimeRaw() const{
|
||||||
return tm_data->data_field.time;
|
return tmData->data_field.time;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmPacketBase::initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter) {
|
void TmPacketBase::initializeTmPacket(uint16_t apid, uint8_t service,
|
||||||
|
uint8_t subservice, uint8_t packetSubcounter) {
|
||||||
//Set primary header:
|
//Set primary header:
|
||||||
initSpacePacketHeader(false, true, apid);
|
initSpacePacketHeader(false, true, apid);
|
||||||
//Set data Field Header:
|
//Set data Field Header:
|
||||||
//First, set to zero.
|
//First, set to zero.
|
||||||
memset(&tm_data->data_field, 0, sizeof(tm_data->data_field));
|
memset(&tmData->data_field, 0, sizeof(tmData->data_field));
|
||||||
//Set CCSDS_secondary header flag to 0, version number to 001 and ack to 0000
|
|
||||||
// NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits.
|
// NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits.
|
||||||
// The other 4 bits of the first byte are the spacecraft time reference status
|
// The other 4 bits of the first byte are the spacecraft time reference
|
||||||
// To change to PUS-C, set 0b00100000
|
// status. To change to PUS-C, set 0b00100000.
|
||||||
tm_data->data_field.version_type_ack = 0b00010000;
|
// Set CCSDS_secondary header flag to 0, version number to 001 and ack
|
||||||
tm_data->data_field.service_type = service;
|
// to 0000
|
||||||
tm_data->data_field.service_subtype = subservice;
|
tmData->data_field.version_type_ack = 0b00010000;
|
||||||
tm_data->data_field.subcounter = packetSubcounter;
|
tmData->data_field.service_type = service;
|
||||||
|
tmData->data_field.service_subtype = subservice;
|
||||||
|
tmData->data_field.subcounter = packetSubcounter;
|
||||||
//Timestamp packet
|
//Timestamp packet
|
||||||
if (checkAndSetStamper()) {
|
if (checkAndSetStamper()) {
|
||||||
timeStamper->addTimeStamp(tm_data->data_field.time, sizeof(tm_data->data_field.time));
|
timeStamper->addTimeStamp(tmData->data_field.time,
|
||||||
|
sizeof(tmData->data_field.time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmPacketBase::setSourceData(uint8_t* sourceData, size_t sourceSize) {
|
|
||||||
memcpy(getSourceData(), sourceData, sourceSize);
|
|
||||||
setSourceDataSize(sourceSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TmPacketBase::setSourceDataSize(uint16_t size) {
|
void TmPacketBase::setSourceDataSize(uint16_t size) {
|
||||||
setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1);
|
setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TmPacketBase::getTimestampSize() const {
|
size_t TmPacketBase::getTimestampSize() const {
|
||||||
return sizeof(tm_data->data_field.time);
|
return sizeof(tmData->data_field.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeStamperIF* TmPacketBase::timeStamper = NULL;
|
|
||||||
object_id_t TmPacketBase::timeStamperId = 0;
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef TMPACKETBASE_H_
|
#ifndef TMTCPACKET_PUS_TMPACKETBASE_H_
|
||||||
#define TMPACKETBASE_H_
|
#define TMTCPACKET_PUS_TMPACKETBASE_H_
|
||||||
|
|
||||||
|
#include "../SpacePacketBase.h"
|
||||||
#include "../../timemanager/TimeStamperIF.h"
|
#include "../../timemanager/TimeStamperIF.h"
|
||||||
#include "../../tmtcpacket/SpacePacketBase.h"
|
|
||||||
#include "../../timemanager/Clock.h"
|
#include "../../timemanager/Clock.h"
|
||||||
#include "../../objectmanager/SystemObjectIF.h"
|
#include "../../objectmanager/SystemObjectIF.h"
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ void setStaticFrameworkObjectIds();
|
|||||||
* This struct defines a byte-wise structured PUS TM Data Field Header.
|
* This struct defines a byte-wise structured PUS TM Data Field Header.
|
||||||
* Any optional fields in the header must be added or removed here.
|
* Any optional fields in the header must be added or removed here.
|
||||||
* Currently, no Destination field is present, but an eigth-byte representation
|
* Currently, no Destination field is present, but an eigth-byte representation
|
||||||
* for a time tag [TBD].
|
* for a time tag.
|
||||||
* @ingroup tmtcpackets
|
* @ingroup tmtcpackets
|
||||||
*/
|
*/
|
||||||
struct PUSTmDataFieldHeader {
|
struct PUSTmDataFieldHeader {
|
||||||
@ -40,7 +40,7 @@ struct TmPacketPointer {
|
|||||||
/**
|
/**
|
||||||
* This class is the basic data handler for any ECSS PUS Telemetry packet.
|
* This class is the basic data handler for any ECSS PUS Telemetry packet.
|
||||||
*
|
*
|
||||||
* In addition to \SpacePacketBase, the class provides methods to handle
|
* In addition to #SpacePacketBase, the class provides methods to handle
|
||||||
* the standardized entries of the PUS TM Packet Data Field Header.
|
* the standardized entries of the PUS TM Packet Data Field Header.
|
||||||
* It does not contain the packet data itself but a pointer to the
|
* It does not contain the packet data itself but a pointer to the
|
||||||
* data must be set on instantiation. An invalid pointer may cause
|
* data must be set on instantiation. An invalid pointer may cause
|
||||||
@ -54,29 +54,27 @@ public:
|
|||||||
/**
|
/**
|
||||||
* This constant defines the minimum size of a valid PUS Telemetry Packet.
|
* This constant defines the minimum size of a valid PUS Telemetry Packet.
|
||||||
*/
|
*/
|
||||||
static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTmDataFieldHeader) + 2); //!< Minimum size of a valid PUS Telemetry Packet.
|
static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) +
|
||||||
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; //!< Maximum size of a TM Packet in this mission.
|
sizeof(PUSTmDataFieldHeader) + 2);
|
||||||
static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; //!< First byte of secondary header for PUS-A packets.
|
//! Maximum size of a TM Packet in this mission.
|
||||||
|
//! TODO: Make this dependant on a config variable.
|
||||||
|
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048;
|
||||||
|
//! First byte of secondary header for PUS-A packets.
|
||||||
|
//! TODO: Maybe also support PUS-C via config?
|
||||||
|
static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor.
|
* This is the default constructor.
|
||||||
* It sets its internal data pointer to the address passed and also
|
* It sets its internal data pointer to the address passed and also
|
||||||
* forwards the data pointer to the parent SpacePacketBase class.
|
* forwards the data pointer to the parent SpacePacketBase class.
|
||||||
* @param set_address The position where the packet data lies.
|
* @param set_address The position where the packet data lies.
|
||||||
*/
|
*/
|
||||||
TmPacketBase( uint8_t* set_data );
|
TmPacketBase( uint8_t* setData );
|
||||||
/**
|
/**
|
||||||
* This is the empty default destructor.
|
* This is the empty default destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~TmPacketBase();
|
virtual ~TmPacketBase();
|
||||||
/**
|
|
||||||
* Initializes the Tm Packet header.
|
|
||||||
* Does set the timestamp (to now), but not the error control field.
|
|
||||||
* @param apid APID used.
|
|
||||||
* @param service PUS Service
|
|
||||||
* @param subservice PUS Subservice
|
|
||||||
* @param packetSubcounter Additional subcounter used.
|
|
||||||
*/
|
|
||||||
void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter);
|
|
||||||
/**
|
/**
|
||||||
* This is a getter for the packet's PUS Service ID, which is the second
|
* This is a getter for the packet's PUS Service ID, which is the second
|
||||||
* byte of the Data Field Header.
|
* byte of the Data Field Header.
|
||||||
@ -107,10 +105,13 @@ public:
|
|||||||
uint16_t getSourceDataSize();
|
uint16_t getSourceDataSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In case data was filled manually (almost never the case).
|
* With this method, the Error Control Field is updated to match the
|
||||||
* @param size Size of source data (without CRC and data filed header!).
|
* current content of the packet. This method is not protected because
|
||||||
|
* a recalculation by the user might be necessary when manipulating fields
|
||||||
|
* like the sequence count.
|
||||||
*/
|
*/
|
||||||
void setSourceDataSize(uint16_t size);
|
void setErrorControl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This getter returns the Error Control Field of the packet.
|
* This getter returns the Error Control Field of the packet.
|
||||||
*
|
*
|
||||||
@ -120,35 +121,15 @@ public:
|
|||||||
* @return The PUS Error Control
|
* @return The PUS Error Control
|
||||||
*/
|
*/
|
||||||
uint16_t getErrorControl();
|
uint16_t getErrorControl();
|
||||||
/**
|
|
||||||
* With this method, the Error Control Field is updated to match the
|
|
||||||
* current content of the packet.
|
|
||||||
*/
|
|
||||||
void setErrorControl();
|
|
||||||
/**
|
|
||||||
* This sets the source data. It copies the provided data to
|
|
||||||
* the internal TmPacketPointer source data location.
|
|
||||||
* @param sourceData
|
|
||||||
* @param sourceSize
|
|
||||||
*/
|
|
||||||
void setSourceData(uint8_t* sourceData, size_t sourceSize);
|
|
||||||
/**
|
|
||||||
* With this method, the packet data pointer can be redirected to another
|
|
||||||
* location.
|
|
||||||
*
|
|
||||||
* This call overwrites the parent's setData method to set both its
|
|
||||||
* \c tc_data pointer and the parent's \c data pointer.
|
|
||||||
*
|
|
||||||
* @param p_data A pointer to another PUS Telemetry Packet.
|
|
||||||
*/
|
|
||||||
void setData( const uint8_t* p_Data );
|
|
||||||
/**
|
/**
|
||||||
* This is a debugging helper method that prints the whole packet content
|
* This is a debugging helper method that prints the whole packet content
|
||||||
* to the screen.
|
* to the screen.
|
||||||
*/
|
*/
|
||||||
void print();
|
void print();
|
||||||
/**
|
/**
|
||||||
* Interprets the "time"-field in the secondary header and returns it in timeval format.
|
* Interprets the "time"-field in the secondary header and returns it in
|
||||||
|
* timeval format.
|
||||||
* @return Converted timestamp of packet.
|
* @return Converted timestamp of packet.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getPacketTime(timeval* timestamp) const;
|
ReturnValue_t getPacketTime(timeval* timestamp) const;
|
||||||
@ -158,7 +139,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
uint8_t* getPacketTimeRaw() const;
|
uint8_t* getPacketTimeRaw() const;
|
||||||
|
|
||||||
uint32_t getTimestampSize() const;
|
size_t getTimestampSize() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -167,14 +148,43 @@ protected:
|
|||||||
*
|
*
|
||||||
* To be hardware-safe, all elements are of byte size.
|
* To be hardware-safe, all elements are of byte size.
|
||||||
*/
|
*/
|
||||||
TmPacketPointer* tm_data;
|
TmPacketPointer* tmData;
|
||||||
/**
|
/**
|
||||||
* The timeStamper is responsible for adding a timestamp to the packet.
|
* The timeStamper is responsible for adding a timestamp to the packet.
|
||||||
* It is initialized lazy.
|
* It is initialized lazy.
|
||||||
*/
|
*/
|
||||||
static TimeStamperIF* timeStamper;
|
static TimeStamperIF* timeStamper;
|
||||||
|
//! The ID to use when looking for a time stamper.
|
||||||
|
static object_id_t timeStamperId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the Tm Packet header.
|
||||||
|
* Does set the timestamp (to now), but not the error control field.
|
||||||
|
* @param apid APID used.
|
||||||
|
* @param service PUS Service
|
||||||
|
* @param subservice PUS Subservice
|
||||||
|
* @param packetSubcounter Additional subcounter used.
|
||||||
|
*/
|
||||||
|
void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice,
|
||||||
|
uint8_t packetSubcounter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* With this method, the packet data pointer can be redirected to another
|
||||||
|
* location.
|
||||||
|
*
|
||||||
|
* This call overwrites the parent's setData method to set both its
|
||||||
|
* @c tc_data pointer and the parent's @c data pointer.
|
||||||
|
*
|
||||||
|
* @param p_data A pointer to another PUS Telemetry Packet.
|
||||||
|
*/
|
||||||
|
void setData( const uint8_t* pData );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In case data was filled manually (almost never the case).
|
||||||
|
* @param size Size of source data (without CRC and data filed header!).
|
||||||
|
*/
|
||||||
|
void setSourceDataSize(uint16_t size);
|
||||||
|
|
||||||
static object_id_t timeStamperId; //!< The ID to use when looking for a time stamper.
|
|
||||||
/**
|
/**
|
||||||
* Checks if a time stamper is available and tries to set it if not.
|
* Checks if a time stamper is available and tries to set it if not.
|
||||||
* @return Returns false if setting failed.
|
* @return Returns false if setting failed.
|
||||||
@ -183,4 +193,4 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* TMPACKETBASE_H_ */
|
#endif /* TMTCPACKET_PUS_TMPACKETBASE_H_ */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "../../tmtcpacket/pus/TmPacketMinimal.h"
|
#include "TmPacketMinimal.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "../../tmtcpacket/pus/PacketTimestampInterpreterIF.h"
|
#include "PacketTimestampInterpreterIF.h"
|
||||||
|
|
||||||
TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) {
|
TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) {
|
||||||
this->tm_data = (TmPacketMinimalPointer*)set_data;
|
this->tm_data = (TmPacketMinimalPointer*)set_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user