summaryrefslogtreecommitdiffstats
path: root/lib/edi/common.hpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-19 14:47:55 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-19 14:47:55 +0200
commit6a9d4b12280f7d0411a44aaad9528d9cbb725b94 (patch)
tree7ae55087c7c219a4e1f31506858c5041aec2a204 /lib/edi/common.hpp
parent5fa3e1d291e5331f9684ad144ae302e7085174cb (diff)
downloaddabmod-6a9d4b12280f7d0411a44aaad9528d9cbb725b94.tar.gz
dabmod-6a9d4b12280f7d0411a44aaad9528d9cbb725b94.tar.bz2
dabmod-6a9d4b12280f7d0411a44aaad9528d9cbb725b94.zip
Common 44ae39c: Make SEQ and PSEQ available on EDI receive and improve error handling
Diffstat (limited to 'lib/edi/common.hpp')
-rw-r--r--lib/edi/common.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/edi/common.hpp b/lib/edi/common.hpp
index 14b91ba..e8c57c1 100644
--- a/lib/edi/common.hpp
+++ b/lib/edi/common.hpp
@@ -68,6 +68,13 @@ struct Packet {
Packet() {}
};
+struct seq_info_t {
+ bool seq_valid = false;
+ uint16_t seq = 0;
+ bool pseq_valid = false;
+ uint16_t pseq = 0;
+};
+
/* The TagDispatcher takes care of decoding EDI, with or without PFT, and
* will call functions when TAGs are encountered.
*
@@ -110,13 +117,16 @@ class TagDispatcher {
using tagpacket_handler = std::function<void(const std::vector<uint8_t>&)>;
void register_tagpacket_handler(tagpacket_handler&& h);
+ seq_info_t get_seq_info() const {
+ return m_last_sequences;
+ }
+
private:
decode_state_t decode_afpacket(const std::vector<uint8_t> &input_data);
bool decode_tagpacket(const std::vector<uint8_t> &payload);
PFT::PFT m_pft;
- bool m_last_seq_valid = false;
- uint16_t m_last_seq = 0;
+ seq_info_t m_last_sequences;
std::vector<uint8_t> m_input_data;
std::map<std::string, tag_handler> m_handlers;
std::function<void()> m_af_packet_completed;