diff options
author | Eddy Pedroni <epedroni@pm.me> | 2025-07-22 22:55:24 +0200 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2025-07-22 22:55:24 +0200 |
commit | 29ca6bac4565d754a67414e503a215627d3aa566 (patch) | |
tree | ae86ca581f6aae6e2d2a870b963a8fe3b05da625 /daemon/src/routing.cpp | |
parent | 6da14e1590935710055ebc81ba55017b457ca1ad (diff) |
Add router implementation, untested
Diffstat (limited to 'daemon/src/routing.cpp')
-rw-r--r-- | daemon/src/routing.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/daemon/src/routing.cpp b/daemon/src/routing.cpp index 709d815..15ae555 100644 --- a/daemon/src/routing.cpp +++ b/daemon/src/routing.cpp @@ -1,14 +1,27 @@ #include "routing.h" +#include <chrono> #include <iostream> namespace midi_router { void -Router::route(Route_Map const & config) const +Router::route(Route_Map const & config) { + Message m; + if (m_queue.wait_dequeue_timed(m, std::chrono::milliseconds(500))) + { + if (!config.contains(*m.source_id) || !config.at(*m.source_id).contains(m.type())) + { + return; + } + for (auto const & target: config.at(*m.source_id).at(m.type())) + { + target(m.bytes); + } + } } void |