mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-18 04:04:33 -05:00
Put symbol coding into PacketBuilder.
Removes stuffing symbols before placing them into packet buffer.
This commit is contained in:
parent
c936e09702
commit
05badaddda
@ -30,5 +30,6 @@ void PacketBuilder::configure(size_t new_payload_length) {
|
|||||||
|
|
||||||
void PacketBuilder::reset_state() {
|
void PacketBuilder::reset_state() {
|
||||||
bits_received = 0;
|
bits_received = 0;
|
||||||
|
unstuff.reset();
|
||||||
state = State::AccessCodeSearch;
|
state = State::AccessCodeSearch;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
#include "symbol_coding.hpp"
|
||||||
|
|
||||||
class PacketBuilder {
|
class PacketBuilder {
|
||||||
public:
|
public:
|
||||||
void configure(size_t new_payload_length);
|
void configure(size_t new_payload_length);
|
||||||
@ -45,7 +47,9 @@ public:
|
|||||||
|
|
||||||
case State::Payload:
|
case State::Payload:
|
||||||
if( bits_received < payload_length ) {
|
if( bits_received < payload_length ) {
|
||||||
|
if( !unstuff.is_stuffing_bit(symbol) ) {
|
||||||
payload[bits_received++] = symbol;
|
payload[bits_received++] = symbol;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
payload_handler(payload, bits_received);
|
payload_handler(payload, bits_received);
|
||||||
reset_state();
|
reset_state();
|
||||||
@ -68,6 +72,7 @@ private:
|
|||||||
size_t bits_received { 0 };
|
size_t bits_received { 0 };
|
||||||
State state { State::AccessCodeSearch };
|
State state { State::AccessCodeSearch };
|
||||||
std::bitset<256> payload;
|
std::bitset<256> payload;
|
||||||
|
symbol_coding::Unstuff unstuff;
|
||||||
|
|
||||||
void reset_state();
|
void reset_state();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user