blob: fc1425db9baa2f5cec77b74cc195f22c170dea73 [file] [log] [blame]
Austin Schuhe84c3ed2019-12-14 15:29:48 -08001#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 Schuhc5fa6d92022-02-25 14:36:28 -08007DEFINE_string(config, "aos_config.json", "Path to the config.");
Austin Schuha922ad02021-10-23 23:25:50 -07008DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority");
Austin Schuhe84c3ed2019-12-14 15:29:48 -08009
10namespace aos {
11namespace message_bridge {
12
13int Main() {
14 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
15 aos::configuration::ReadConfig(FLAGS_config);
16
17 aos::ShmEventLoop event_loop(&config.message());
Austin Schuha922ad02021-10-23 23:25:50 -070018 if (FLAGS_rt_priority > 0) {
19 event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority);
20 }
Austin Schuhe84c3ed2019-12-14 15:29:48 -080021
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
35int main(int argc, char **argv) {
36 aos::InitGoogle(&argc, &argv);
37
38 return aos::message_bridge::Main();
39}