Provide configuration of symbol unstuffing.

This commit is contained in:
Jared Boone 2015-09-26 14:37:59 -07:00
parent a00fcbaa8f
commit e9f28f9ef3
5 changed files with 25 additions and 4 deletions

View File

@ -199,6 +199,8 @@ static constexpr FSKConfiguration fsk_configuration_ais = {
.access_code = 0b01010101010101010101111110,
.access_code_length = 26,
.access_code_tolerance = 1,
.unstuffing_pattern = 0b111110,
.unstuffing_length = 6,
.packet_length = 256,
};
@ -207,6 +209,8 @@ static constexpr FSKConfiguration fsk_configuration_tpms_a = {
.access_code = 0b0101010101010101010101010110,
.access_code_length = 28,
.access_code_tolerance = 1,
.unstuffing_pattern = 0,
.unstuffing_length = 0,
.packet_length = 160,
};

View File

@ -21,11 +21,18 @@
#include "packet_builder.hpp"
void PacketBuilder::configure(size_t new_payload_length) {
void PacketBuilder::configure(
uint32_t unstuffing_pattern,
size_t unstuffing_length,
size_t new_payload_length
) {
unstuff.configure(unstuffing_pattern, unstuffing_length);
if( new_payload_length <= payload.size() ) {
payload_length = new_payload_length;
reset_state();
}
reset_state();
}
void PacketBuilder::reset_state() {

View File

@ -30,7 +30,11 @@
class PacketBuilder {
public:
void configure(size_t new_payload_length);
void configure(
uint32_t unstuffing_pattern,
size_t unstuffing_length,
size_t new_payload_length
);
template<typename PayloadHandler>
void execute(

View File

@ -50,7 +50,11 @@ void FSKProcessor::configure(const FSKConfiguration new_configuration) {
new_configuration.access_code_length,
new_configuration.access_code_tolerance
);
packet_builder.configure(new_configuration.packet_length);
packet_builder.configure(
new_configuration.unstuffing_pattern,
new_configuration.unstuffing_length,
new_configuration.packet_length
);
}
void FSKProcessor::execute(buffer_c8_t buffer) {

View File

@ -198,6 +198,8 @@ struct FSKConfiguration {
uint32_t access_code;
size_t access_code_length;
size_t access_code_tolerance;
uint32_t unstuffing_pattern;
size_t unstuffing_length;
size_t packet_length;
};