Commit c902f95b authored by weisenbergertub90's avatar weisenbergertub90
Browse files

Add telemetry decoding and fix calendar output.

parent ff90d333
......@@ -192,8 +192,8 @@ namespace gr {
// callsign
uint8_t callsign[6];
// datablocks
uint8_t mobBlock18[2][20];
uint8_t mobBlock18FEC[2][20];
uint8_t mobBlock18[8][20];
uint8_t mobBlock18FEC[8][20];
bool mobBodyCorrect;
// datablocks errorcode
uint8_t errorcode[8];
......
......@@ -75,9 +75,6 @@ namespace gr {
/*************
* FUNCTIONS *
*************/
// ADD BITS TO BYTE ARRAY
void write_bits(uint8_t *bytes, int pos, int length, uint32_t value);
// EXTRACT BITS FROM BYTE ARRAY
uint32_t extract_bits(uint8_t *bytes, int pos, int length);
......
......@@ -56,9 +56,6 @@ namespace gr {
uint16_t searchBody;
size_t d_off;
uint8_t callsign[6];
uint8_t header[6];
// counter for incoming messages
int count_msg_total;
int count_decoding_successful;
......
......@@ -82,60 +82,62 @@ namespace gr {
<< std::dec << std::nouppercase << std::endl;
#endif
formcheck_ok = false;
} else if(rx.header.msgType != MESSAGE_TYPE) {
return formcheck_ok;
}
if(rx.header.msgType == 0x00) {
#if DEBUG == 1
std::cout << "MESSAGE_TYPE should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)MESSAGE_TYPE
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.msgType
<< std::dec << std::nouppercase << std::endl;
std::cout << "Message Type 0x00!!!" << std::endl;
#endif
formcheck_ok = false;
} else if(rx.header.blocks != BLOCKS) {
return formcheck_ok;
}
if(rx.header.msgType == MESSAGE_TYPE) {
if(rx.header.blocks != BLOCKS) {
#if DEBUG == 1
std::cout << "BLOCKS should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)BLOCKS
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.blocks
<< std::dec << std::nouppercase << std::endl;
std::cout << "BLOCKS should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)BLOCKS
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.blocks
<< std::dec << std::nouppercase << std::endl;
#endif
formcheck_ok = false;
} else if(rx.header.baudrate != BAUDRATE) {
formcheck_ok = false;
} else if(rx.header.baudrate != BAUDRATE) {
#if DEBUG == 1
std::cout << "BAUDRATE should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)BAUDRATE
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.baudrate
<< std::dec << std::nouppercase << std::endl;
std::cout << "BAUDRATE should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)BAUDRATE
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.baudrate
<< std::dec << std::nouppercase << std::endl;
#endif
formcheck_ok = false;
} else if(rx.header.ackReq != ACK_REQ) {
formcheck_ok = false;
} else if(rx.header.ackReq != ACK_REQ) {
#if DEBUG == 1
std::cout << "ACK_REQ should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)ACK_REQ
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.ackReq
<< std::dec << std::nouppercase << std::endl;
std::cout << "ACK_REQ should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)ACK_REQ
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.ackReq
<< std::dec << std::nouppercase << std::endl;
#endif
formcheck_ok = false;
} else if(rx.header.rfu != HEADER_RFU) {
formcheck_ok = false;
} else if(rx.header.rfu != HEADER_RFU) {
#if DEBUG == 1
std::cout << "HEADER_RFU should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)HEADER_RFU
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.rfu
<< std::dec << std::nouppercase << std::endl;
std::cout << "HEADER_RFU should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)HEADER_RFU
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(2) << (unsigned)rx.header.rfu
<< std::dec << std::nouppercase << std::endl;
#endif
// formcheck_ok = false; // ignored at the moment
} else if(rx.header.rfu2 != HEADER_RFU2) {
// formcheck_ok = false; // ignored at the moment
} else if(rx.header.rfu2 != HEADER_RFU2) {
#if DEBUG == 1
std::cout << "HEADER_RFU2 should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(4) << (unsigned)HEADER_RFU2
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(4) << (unsigned)rx.header.rfu2
<< std::dec << std::nouppercase << std::endl;
std::cout << "HEADER_RFU2 should be "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(4) << (unsigned)HEADER_RFU2
<< std::dec << std::nouppercase << " but is "
<< std::hex << std::uppercase << std::setfill('0') << std::setw(4) << (unsigned)rx.header.rfu2
<< std::dec << std::nouppercase << std::endl;
#endif
// formcheck_ok = false; // ignored at the moment
// formcheck_ok = false; // ignored at the moment
}
}
return formcheck_ok;
......@@ -196,6 +198,7 @@ namespace gr {
if(formcheckOK()) {
std::cout << "Formcheck \033[1;5;92mOK\033[0m!" << std::endl;
if(rx.header.msgType == 0x0A) {
switch (rx.header.transmitterID) {
case TRANSMITTER_ID::BEESAT5:
std::cout << "Received Beacon from BEESAT-5." << std::endl;
......@@ -213,7 +216,43 @@ namespace gr {
std::cout << "Received Beacon from UNKNOWN satellite!" << std::endl;
break;
}
} else if(rx.header.msgType == 0x01) {
switch (rx.header.transmitterID) {
case TRANSMITTER_ID::BEESAT5:
std::cout << "Received telemetry from BEESAT-5." << std::endl;
break;
case TRANSMITTER_ID::BEESAT6:
std::cout << "Received telemetry from BEESAT-6." << std::endl;
break;
case TRANSMITTER_ID::BEESAT7:
std::cout << "Received telemetry from BEESAT-7." << std::endl;
break;
case TRANSMITTER_ID::BEESAT8:
std::cout << "Received telemetry from BEESAT-8." << std::endl;
break;
default:
std::cout << "Received telemetry from UNKNOWN satellite!" << std::endl;
break;
}
} else {
switch (rx.header.transmitterID) {
case TRANSMITTER_ID::BEESAT5:
std::cout << "Received unkown message type from BEESAT-5." << std::endl;
break;
case TRANSMITTER_ID::BEESAT6:
std::cout << "Received unkown message type from BEESAT-6." << std::endl;
break;
case TRANSMITTER_ID::BEESAT7:
std::cout << "Received unkown message type from BEESAT-7." << std::endl;
break;
case TRANSMITTER_ID::BEESAT8:
std::cout << "Received unkown message type from BEESAT-8." << std::endl;
break;
default:
std::cout << "Received unkown message type from UNKNOWN satellite!" << std::endl;
break;
}
}
// go to SEARCH_BODY
state = SEARCH_BODY;
} else { // 'Message Header' not correct configured
......
......@@ -157,11 +157,10 @@ namespace gr {
++bit_c;
if(bit_c > 11){
bit_c = 0;
if(!mob->decode_mob_block18(block_c)) {
mob->mobBodyCorrect = false;
}
mob->decode_mob_block18(block_c);
++block_c;
if(block_c == 2) {
if(block_c == (mob->header.blocks + 1)) {
block_c = 0;
return true;
}
......
......@@ -40,7 +40,7 @@ namespace gr{
boost::filesystem::create_directory(dirAudio);
boost::filesystem::path dirRaw("TU_BERLIN_SDR_meta_files/raw");
boost::filesystem::create_directory(dirRaw);
LOG_FILE_PATH = "TU_BERLIN_SDR_meta_files/log/SDR_BEESAT-5_Beacon_Receiver";
LOG_FILE_PATH = "TU_BERLIN_SDR_meta_files/log/SDR_BEESAT-5_6_7_8_Beacon_Receiver";
LOG_FILE_TYPE = ".log";
log_file_name = "";
total_log_file_path = "";
......
......@@ -79,9 +79,9 @@ namespace gr{
byte = bytes[endByte];
byte = byte >> (endBit + 1);
value |= byte;
}
return value;
}
return value;
}
namespace HEADER {
......@@ -404,7 +404,8 @@ namespace gr{
}
uint32_t getGPSTow(uint8_t *message_body) {
return (uint32_t)extract_bits(message_body, POS_PARAM_3, LEN_PARAM_3);
uint32_t tow = extract_bits(message_body, POS_PARAM_3, (LEN_PARAM_3 + 8));
return (uint32_t)(tow);
}
uint16_t getGPSWeek(uint8_t *message_body) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment