blob: 61a7271ed5bfb6dc3f3bb163029d286de5201fd3 [file] [log] [blame]
Austin Schuhe84c3ed2019-12-14 15:29:48 -08001#include "aos/network/message_bridge_client_lib.h"
2
3#include "aos/events/shm_event_loop.h"
4#include "aos/init.h"
5
Austin Schuh4a4b6872020-02-22 15:03:36 -08006DEFINE_string(config, "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
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
36int main(int argc, char **argv) {
37 aos::InitGoogle(&argc, &argv);
38
39 return aos::message_bridge::Main();
40}