POCSAG State machine fix (#1410)

* Reset color for well-formed message fragments

* better colors

* Fix POGSAG decode state machine

* Invert is_message to make more clear

* Use new escape string constants

* Run ECC twice, better diagnostics

* center status icon

---------

Co-authored-by: kallanreed <kallanreed@noreply.github.com>
This commit is contained in:
Kyle Reed 2023-08-26 11:43:34 -07:00 committed by GitHub
parent cf25d85d51
commit 933920edfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 200 additions and 138 deletions

View file

@ -35,7 +35,7 @@
namespace pocsag {
// Todo: these enums suck, make a better decode_batch
// TODO: these enums suck, make a better decode_batch
enum Mode : uint32_t {
STATE_CLEAR,
@ -45,6 +45,7 @@ enum Mode : uint32_t {
enum OutputType : uint32_t {
EMPTY,
IDLE,
ADDRESS,
MESSAGE
};
@ -56,6 +57,7 @@ enum MessageType : uint32_t {
};
struct POCSAGState {
uint8_t codeword_index;
uint32_t function;
uint32_t address;
Mode mode = STATE_CLEAR;
@ -78,7 +80,9 @@ std::string flag_str(PacketFlag packetflag);
void insert_BCH(BCHCode& BCH_code, uint32_t* codeword);
uint32_t get_digit_code(char code);
void pocsag_encode(const MessageType type, BCHCode& BCH_code, const uint32_t function, const std::string message, const uint32_t address, std::vector<uint32_t>& codewords);
void pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState* const state);
// Returns true if the batch has more to process.
bool pocsag_decode_batch(const POCSAGPacket& batch, POCSAGState& state);
} /* namespace pocsag */