blob: 8aad8678c6b6c7fc56ca1c22d6ee82d42fe2700b [file] [log] [blame]
Austin Schuhe84c3ed2019-12-14 15:29:48 -08001#include "aos/events/shm_event_loop.h"
2#include "aos/init.h"
Sarah Newman45a64df2022-04-11 19:33:46 -07003#include "aos/logging/dynamic_logging.h"
Austin Schuh60e77942022-05-16 17:48:24 -07004#include "aos/network/message_bridge_client_lib.h"
Austin Schuhe84c3ed2019-12-14 15:29:48 -08005
Austin Schuhc5fa6d92022-02-25 14:36:28 -08006DEFINE_string(config, "aos_config.json", "Path to the config.");
Austin Schuha922ad02021-10-23 23:25:50 -07007DEFINE_int32(rt_priority, -1, "If > 0, run as this RT priority");
Austin Schuhe84c3ed2019-12-14 15:29:48 -08008
9namespace aos {
10namespace message_bridge {
11
12int Main() {
13 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
14 aos::configuration::ReadConfig(FLAGS_config);
15
16 aos::ShmEventLoop event_loop(&config.message());
Austin Schuha922ad02021-10-23 23:25:50 -070017 if (FLAGS_rt_priority > 0) {
18 event_loop.SetRuntimeRealtimePriority(FLAGS_rt_priority);
19 }
Austin Schuhe84c3ed2019-12-14 15:29:48 -080020
21 MessageBridgeClient app(&event_loop);
22
Sarah Newman45a64df2022-04-11 19:33:46 -070023 logging::DynamicLogging dynamic_logging(&event_loop);
Austin Schuhe84c3ed2019-12-14 15:29:48 -080024 // TODO(austin): Save messages into a vector to be logged. One file per
25 // channel? Need to sort out ordering.
26 //
27 // TODO(austin): Low priority, "reliable" logging channel.
28
29 event_loop.Run();
30
31 return EXIT_SUCCESS;
32}
33
34} // namespace message_bridge
35} // namespace aos
36
37int main(int argc, char **argv) {
38 aos::InitGoogle(&argc, &argv);
39
40 return aos::message_bridge::Main();
41}