summaryrefslogtreecommitdiffstats
path: root/lib/edi/common.hpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-11-26 16:47:15 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-11-26 16:47:15 +0100
commit22fd7d757f11a6c976d7e711fd46cf2ce3247c44 (patch)
tree782bd87ef76cee4bbeb723ff1a99cd2e3ae6d408 /lib/edi/common.hpp
parent9a5cbe7ed3def3eb465174531b530c49a6203a13 (diff)
downloaddabmod-22fd7d757f11a6c976d7e711fd46cf2ce3247c44.tar.gz
dabmod-22fd7d757f11a6c976d7e711fd46cf2ce3247c44.tar.bz2
dabmod-22fd7d757f11a6c976d7e711fd46cf2ce3247c44.zip
Common ba7f317, 5a0689a, c63fb05
Diffstat (limited to 'lib/edi/common.hpp')
-rw-r--r--lib/edi/common.hpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/edi/common.hpp b/lib/edi/common.hpp
index e8c57c1..5e31984 100644
--- a/lib/edi/common.hpp
+++ b/lib/edi/common.hpp
@@ -49,13 +49,6 @@ struct frame_timestamp_t {
static frame_timestamp_t from_unix_epoch(std::time_t time, uint32_t tai_utc_offset, uint32_t tsta);
};
-struct decode_state_t {
- decode_state_t(bool _complete, size_t _num_bytes_consumed) :
- complete(_complete), num_bytes_consumed(_num_bytes_consumed) {}
- bool complete;
- size_t num_bytes_consumed;
-};
-
using tag_name_t = std::array<uint8_t, 4>;
std::string tag_name_to_human_readable(const tag_name_t& name);
@@ -122,7 +115,17 @@ class TagDispatcher {
}
private:
- decode_state_t decode_afpacket(const std::vector<uint8_t> &input_data);
+ enum class decode_state_e {
+ Ok, MissingData, Error
+ };
+ struct decode_result_t {
+ decode_result_t(decode_state_e _st, size_t _num_bytes_consumed) :
+ st(_st), num_bytes_consumed(_num_bytes_consumed) {}
+ decode_state_e st;
+ size_t num_bytes_consumed;
+ };
+
+ decode_result_t decode_afpacket(const std::vector<uint8_t> &input_data);
bool decode_tagpacket(const std::vector<uint8_t> &payload);
PFT::PFT m_pft;