2016-06-15 23:48:41 +02:00
|
|
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
|
|
|
#include <framework/tmtcpacket/ccsds_header.h>
|
|
|
|
#include <framework/tmtcpacket/SpacePacket.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
SpacePacket::SpacePacket( uint16_t packetDataLength, bool isTelecommand, uint16_t apid, uint16_t sequenceCount ):
|
|
|
|
SpacePacketBase( (uint8_t*)&this->localData ) {
|
|
|
|
initSpacePacketHeader(isTelecommand, false, apid, sequenceCount);
|
|
|
|
this->setPacketSequenceCount(sequenceCount);
|
|
|
|
if ( packetDataLength <= sizeof(this->localData.fields.buffer) ) {
|
|
|
|
this->setPacketDataLength(packetDataLength);
|
2016-06-15 23:48:41 +02:00
|
|
|
} else {
|
2018-07-12 16:29:32 +02:00
|
|
|
this->setPacketDataLength( sizeof(this->localData.fields.buffer) );
|
2016-06-15 23:48:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SpacePacket::~SpacePacket( void ) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SpacePacket::addWholeData( const uint8_t* p_Data, uint32_t packet_size ) {
|
|
|
|
if ( packet_size <= sizeof(this->data) ) {
|
2018-07-12 16:29:32 +02:00
|
|
|
memcpy( &this->localData.byteStream, p_Data, packet_size );
|
2016-06-15 23:48:41 +02:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|