updating code from Flying Laptop
This is the framework of Flying Laptop OBSW version A.13.0.
This commit is contained in:
@ -1,28 +1,16 @@
|
||||
/*
|
||||
* SpacePacket.cpp
|
||||
*
|
||||
* Created on: Mar 23, 2012
|
||||
* Author: baetz
|
||||
*/
|
||||
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <framework/tmtcpacket/ccsds_header.h>
|
||||
#include <framework/tmtcpacket/SpacePacket.h>
|
||||
#include <string.h>
|
||||
|
||||
SpacePacket::SpacePacket( uint16_t set_packet_data_length, uint8_t set_type, uint16_t new_apid, uint16_t set_count ):
|
||||
SpacePacketBase( (uint8_t*)&this->local_data ) {
|
||||
//reset everything to zero:
|
||||
memset(this->local_data.byteStream,0 , sizeof(this->local_data.byteStream) );
|
||||
//Primary header:
|
||||
this->local_data.fields.header.packet_id_h = 0b00000000 + ( (set_type & 0b1) << 4 );
|
||||
this->setAPID( new_apid );
|
||||
this->local_data.fields.header.sequence_control_h = 0b11000000;
|
||||
this->setPacketSequenceCount(set_count);
|
||||
if ( set_packet_data_length <= sizeof(this->local_data.fields.buffer) ) {
|
||||
this->setPacketDataLength(set_packet_data_length);
|
||||
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);
|
||||
} else {
|
||||
this->setPacketDataLength( sizeof(this->local_data.fields.buffer) );
|
||||
this->setPacketDataLength( sizeof(this->localData.fields.buffer) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +19,7 @@ SpacePacket::~SpacePacket( void ) {
|
||||
|
||||
bool SpacePacket::addWholeData( const uint8_t* p_Data, uint32_t packet_size ) {
|
||||
if ( packet_size <= sizeof(this->data) ) {
|
||||
memcpy( &this->local_data.byteStream, p_Data, packet_size );
|
||||
memcpy( &this->localData.byteStream, p_Data, packet_size );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user