1
0
forked from fsfw/fsfw

Today's the day. Renamed platform to framework.

This commit is contained in:
Bastian Baetz
2016-06-15 23:48:41 +02:00
committed by Ulrich Mohr
parent 40987d0b27
commit 1d22a6c97e
356 changed files with 33946 additions and 3 deletions

View File

@ -0,0 +1,39 @@
/*
* 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);
} else {
this->setPacketDataLength( sizeof(this->local_data.fields.buffer) );
}
}
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 );
return true;
} else {
return false;
}
}