| use aos_configuration as config; |
| use aos_events_shm_event_loop::ShmEventLoop; |
| use aos_init::WithCppFlags; |
| use clap::Parser; |
| use ping_lib::PingTask; |
| use std::path::Path; |
| |
| /// Ping portion of a ping/pong system. |
| #[derive(Parser, Debug)] |
| #[command(name = "ping")] |
| struct App { |
| /// Time to sleep between pings. |
| #[arg(long, default_value_t = 10000, value_name = "MICROS")] |
| sleep: u64, |
| } |
| |
| fn main() { |
| let app = App::parse_with_cpp_flags(); |
| aos_init::init(); |
| let config = config::read_config_from(Path::new("pingpong_config.json")).unwrap(); |
| let ping = PingTask::new(); |
| ShmEventLoop::new(&config).run_with(|runtime| { |
| runtime.set_realtime_priority(5); |
| runtime.spawn(ping.tasks(*runtime, app.sleep)); |
| }); |
| } |