Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 1 | #include "aos/network/message_bridge_client_lib.h" |
| 2 | |
| 3 | #include "aos/events/shm_event_loop.h" |
| 4 | #include "aos/init.h" |
| 5 | |
Austin Schuh | 4a4b687 | 2020-02-22 15:03:36 -0800 | [diff] [blame] | 6 | DEFINE_string(config, "config.json", "Path to the config."); |
Austin Schuh | a922ad0 | 2021-10-23 23:25:50 -0700 | [diff] [blame^] | 7 | DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority"); |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 8 | |
| 9 | namespace aos { |
| 10 | namespace message_bridge { |
| 11 | |
| 12 | int Main() { |
| 13 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 14 | aos::configuration::ReadConfig(FLAGS_config); |
| 15 | |
| 16 | aos::ShmEventLoop event_loop(&config.message()); |
Austin Schuh | a922ad0 | 2021-10-23 23:25:50 -0700 | [diff] [blame^] | 17 | if (FLAGS_rt_priority > 0) { |
| 18 | event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority); |
| 19 | } |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 20 | |
| 21 | MessageBridgeClient app(&event_loop); |
| 22 | |
| 23 | // TODO(austin): Save messages into a vector to be logged. One file per |
| 24 | // channel? Need to sort out ordering. |
| 25 | // |
| 26 | // TODO(austin): Low priority, "reliable" logging channel. |
| 27 | |
| 28 | event_loop.Run(); |
| 29 | |
| 30 | return EXIT_SUCCESS; |
| 31 | } |
| 32 | |
| 33 | } // namespace message_bridge |
| 34 | } // namespace aos |
| 35 | |
| 36 | int main(int argc, char **argv) { |
| 37 | aos::InitGoogle(&argc, &argv); |
| 38 | |
| 39 | return aos::message_bridge::Main(); |
| 40 | } |