some renamings
This commit is contained in:
parent
3c7e2c7cff
commit
2790a40d6c
@ -13,28 +13,28 @@ TcPacketBase::~TcPacketBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TcPacketBase::getService() {
|
uint8_t TcPacketBase::getService() {
|
||||||
return tcData->data_field.service_type;
|
return tcData->dataField.service_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TcPacketBase::getSubService() {
|
uint8_t TcPacketBase::getSubService() {
|
||||||
return tcData->data_field.service_subtype;
|
return tcData->dataField.service_subtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TcPacketBase::getAcknowledgeFlags() {
|
uint8_t TcPacketBase::getAcknowledgeFlags() {
|
||||||
return tcData->data_field.version_type_ack & 0b00001111;
|
return tcData->dataField.version_type_ack & 0b00001111;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* TcPacketBase::getApplicationData() const {
|
const uint8_t* TcPacketBase::getApplicationData() const {
|
||||||
return &tcData->data;
|
return &tcData->appData;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TcPacketBase::getApplicationDataSize() {
|
uint16_t TcPacketBase::getApplicationDataSize() {
|
||||||
return getPacketDataLength() - sizeof(tcData->data_field) - CRC_SIZE + 1;
|
return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TcPacketBase::getErrorControl() {
|
uint16_t TcPacketBase::getErrorControl() {
|
||||||
uint16_t size = getApplicationDataSize() + CRC_SIZE;
|
uint16_t size = getApplicationDataSize() + CRC_SIZE;
|
||||||
uint8_t* p_to_buffer = &tcData->data;
|
uint8_t* p_to_buffer = &tcData->appData;
|
||||||
return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1];
|
return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ void TcPacketBase::setErrorControl() {
|
|||||||
uint32_t full_size = getFullSize();
|
uint32_t full_size = getFullSize();
|
||||||
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
|
uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE);
|
||||||
uint32_t size = getApplicationDataSize();
|
uint32_t size = getApplicationDataSize();
|
||||||
(&tcData->data)[size] = (crc & 0XFF00) >> 8; // CRCH
|
(&tcData->appData)[size] = (crc & 0XFF00) >> 8; // CRCH
|
||||||
(&tcData->data)[size + 1] = (crc) & 0X00FF; // CRCL
|
(&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcPacketBase::setData(const uint8_t* pData) {
|
void TcPacketBase::setData(const uint8_t* pData) {
|
||||||
@ -59,11 +59,11 @@ void TcPacketBase::setApplicationData(const uint8_t * pData, uint16_t dataLen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TcPacketBase::getSecondaryHeaderFlag() {
|
uint8_t TcPacketBase::getSecondaryHeaderFlag() {
|
||||||
return (tcData->data_field.version_type_ack & 0b10000000) >> 7;
|
return (tcData->dataField.version_type_ack & 0b10000000) >> 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TcPacketBase::getPusVersionNumber() {
|
uint8_t TcPacketBase::getPusVersionNumber() {
|
||||||
return (tcData->data_field.version_type_ack & 0b01110000) >> 4;
|
return (tcData->dataField.version_type_ack & 0b01110000) >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcPacketBase::print() {
|
void TcPacketBase::print() {
|
||||||
@ -78,14 +78,14 @@ void TcPacketBase::print() {
|
|||||||
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->data_field, 0, sizeof(tcData->data_field));
|
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, version number to 001 and ack to 0000
|
||||||
tcData->data_field.version_type_ack = 0b00010000;
|
tcData->dataField.version_type_ack = 0b00010000;
|
||||||
tcData->data_field.version_type_ack |= (ack & 0x0F);
|
tcData->dataField.version_type_ack |= (ack & 0x0F);
|
||||||
tcData->data_field.service_type = service;
|
tcData->dataField.service_type = service;
|
||||||
tcData->data_field.service_subtype = subservice;
|
tcData->dataField.service_subtype = subservice;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t TcPacketBase::calculateFullPacketLength(size_t appDataLen) {
|
size_t TcPacketBase::calculateFullPacketLength(size_t appDataLen) {
|
||||||
|
@ -24,8 +24,8 @@ struct PUSTcDataFieldHeader {
|
|||||||
*/
|
*/
|
||||||
struct TcPacketPointer {
|
struct TcPacketPointer {
|
||||||
CCSDSPrimaryHeader primary;
|
CCSDSPrimaryHeader primary;
|
||||||
PUSTcDataFieldHeader data_field;
|
PUSTcDataFieldHeader dataField;
|
||||||
uint8_t data;
|
uint8_t appData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ TcPacketStored::TcPacketStored(uint8_t service, uint8_t subservice,
|
|||||||
}
|
}
|
||||||
this->setData(p_data);
|
this->setData(p_data);
|
||||||
initializeTcPacket(apid, sequence_count, ack, service, subservice);
|
initializeTcPacket(apid, sequence_count, ack, service, subservice);
|
||||||
memcpy(&tcData->data, data, size);
|
memcpy(&tcData->appData, data, size);
|
||||||
this->setPacketDataLength(
|
this->setPacketDataLength(
|
||||||
size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
||||||
this->setErrorControl();
|
this->setErrorControl();
|
||||||
|
Loading…
Reference in New Issue
Block a user