Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 1 | #include "aos/events/shm_event_loop.h" |
| 2 | #include "aos/init.h" |
| 3 | #include "aos/network/message_bridge_server_lib.h" |
| 4 | #include "gflags/gflags.h" |
| 5 | #include "glog/logging.h" |
| 6 | |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame^] | 7 | DEFINE_string(config, "aos_config.json", "Path to the config."); |
Austin Schuh | a922ad0 | 2021-10-23 23:25:50 -0700 | [diff] [blame] | 8 | DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority"); |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 9 | |
| 10 | namespace aos { |
| 11 | namespace message_bridge { |
| 12 | |
| 13 | int Main() { |
| 14 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 15 | aos::configuration::ReadConfig(FLAGS_config); |
| 16 | |
| 17 | aos::ShmEventLoop event_loop(&config.message()); |
Austin Schuh | a922ad0 | 2021-10-23 23:25:50 -0700 | [diff] [blame] | 18 | if (FLAGS_rt_priority > 0) { |
| 19 | event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority); |
| 20 | } |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 21 | |
| 22 | MessageBridgeServer app(&event_loop); |
| 23 | |
| 24 | // TODO(austin): Track which messages didn't make it in time and need to be |
| 25 | // logged locally and forwarded. |
| 26 | |
| 27 | event_loop.Run(); |
| 28 | |
| 29 | return EXIT_SUCCESS; |
| 30 | } |
| 31 | |
| 32 | } // namespace message_bridge |
| 33 | } // namespace aos |
| 34 | |
| 35 | int main(int argc, char **argv) { |
| 36 | aos::InitGoogle(&argc, &argv); |
| 37 | |
| 38 | return aos::message_bridge::Main(); |
| 39 | } |