mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-26 15:50:31 -04:00
POCSAG Processor Rewrite (#1437)
* WIP Refactoring * WordExtractor building * Fix buffer sizes and squelch execute * Move impls to cpp file * Baud indicator * WIP new bit extractor * New approach for bit extraction. * Code fit and finish * Fix case on button * Cleanup * Adjust rate miss threshold * Fix count bits error calculation.
This commit is contained in:
parent
9525738118
commit
31e8019642
13 changed files with 648 additions and 534 deletions
|
@ -45,6 +45,10 @@ enum PacketFlag : uint32_t {
|
|||
TOO_LONG
|
||||
};
|
||||
|
||||
/* Number of codewords in a batch. */
|
||||
constexpr uint8_t batch_size = 16;
|
||||
using batch_t = std::array<uint32_t, batch_size>;
|
||||
|
||||
class POCSAGPacket {
|
||||
public:
|
||||
void set_timestamp(const Timestamp& value) {
|
||||
|
@ -55,16 +59,20 @@ class POCSAGPacket {
|
|||
return timestamp_;
|
||||
}
|
||||
|
||||
void set(const size_t index, const uint32_t data) {
|
||||
if (index < 16)
|
||||
void set(size_t index, uint32_t data) {
|
||||
if (index < batch_size)
|
||||
codewords[index] = data;
|
||||
}
|
||||
|
||||
uint32_t operator[](const size_t index) const {
|
||||
return (index < 16) ? codewords[index] : 0;
|
||||
void set(const batch_t& batch) {
|
||||
codewords = batch;
|
||||
}
|
||||
|
||||
void set_bitrate(const uint16_t bitrate) {
|
||||
uint32_t operator[](size_t index) const {
|
||||
return (index < batch_size) ? codewords[index] : 0;
|
||||
}
|
||||
|
||||
void set_bitrate(uint16_t bitrate) {
|
||||
bitrate_ = bitrate;
|
||||
}
|
||||
|
||||
|
@ -72,7 +80,7 @@ class POCSAGPacket {
|
|||
return bitrate_;
|
||||
}
|
||||
|
||||
void set_flag(const PacketFlag flag) {
|
||||
void set_flag(PacketFlag flag) {
|
||||
flag_ = flag;
|
||||
}
|
||||
|
||||
|
@ -89,7 +97,7 @@ class POCSAGPacket {
|
|||
private:
|
||||
uint16_t bitrate_{0};
|
||||
PacketFlag flag_{NORMAL};
|
||||
std::array<uint32_t, 16> codewords{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
batch_t codewords{};
|
||||
Timestamp timestamp_{};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue