aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-06 10:11:37 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-06 11:10:45 +0200
commit6aec5974cd77b6896e2f4e2ef53911be90e0996f (patch)
tree885e7bf2d4462177e9971841fd10c24b34261634 /src/main.cpp
parent367b854e7bbf758cb3119162dece4669d00dabb1 (diff)
downloadODR-EDI2EDI-6aec5974cd77b6896e2f4e2ef53911be90e0996f.tar.gz
ODR-EDI2EDI-6aec5974cd77b6896e2f4e2ef53911be90e0996f.tar.bz2
ODR-EDI2EDI-6aec5974cd77b6896e2f4e2ef53911be90e0996f.zip
Add EDI output
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b3a0519..9dc6011 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -72,6 +72,17 @@ static void usage()
/* There is some state inside the parsing of destination arguments,
* because several destinations can be given. */
+class ReceivedTagItem : public edi::TagItem {
+ public:
+ ReceivedTagItem(const EdiDecoder::ReceivedTagPacket& rt) : m_rt(rt) { }
+
+ virtual std::vector<uint8_t> Assemble() override {
+ return m_rt.tagpacket;
+ }
+
+ private:
+ const EdiDecoder::ReceivedTagPacket& m_rt;
+};
class Main : public EdiDecoder::ETIDataCollector {
public:
@@ -99,13 +110,14 @@ class Main : public EdiDecoder::ETIDataCollector {
virtual void add_subchannel(EdiDecoder::eti_stc_data&& stc) override { }
// Tell the ETIWriter that the AFPacket is complete
- virtual void assemble(EdiDecoder::ReceivedTagData&& tag_data) override
+ virtual void assemble(EdiDecoder::ReceivedTagPacket&& tag_data) override
{
- etiLog.level(info) << "Received " << tag_data.all_tags.size() << " tags at " << tag_data.timestamp.to_unix_epoch();
+ etiLog.level(info) << "Received tagpacket " << tag_data.tagpacket.size() << " bytes at " <<
+ tag_data.timestamp.to_string();
- for (const auto& tag : tag_data.all_tags) {
- etiLog.level(debug) << " TAG " << EdiDecoder::tag_name_to_human_readable(tag.name);
- }
+ edi::TagPacket edi_tagpacket(0);
+ edi_tagpacket.raw_tagpacket = move(tag_data.tagpacket);
+ edi_sender->write(edi_tagpacket);
}
int start(int argc, char **argv)
@@ -231,6 +243,8 @@ class Main : public EdiDecoder::ETIDataCollector {
return 1;
}
+ edi_sender = make_shared<edi::Sender>(edi_conf);
+
edi_decoder.set_verbose(edi_conf.verbose);
etiLog.level(info) << "Setting up EDI2EDI with delay " << delay_ms << " ms. " <<
@@ -326,6 +340,8 @@ class Main : public EdiDecoder::ETIDataCollector {
uint32_t backoff_after_reset_ms = DEFAULT_BACKOFF;
std::string startupcheck;
std::string source;
+
+ std::shared_ptr<edi::Sender> edi_sender;
};