/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include #include #include #include int main(int argc, char **argv) { std::string broadcastAddress="127.0.0.255"; std::string srcAddress="127.0.0.1"; unsigned short port = 8888; // which devices we want to reach, default all BC::DataTypes::deviceIdType destination = 0; CLI::App app("Command line tool for interacting with libbattle-com++"); app.require_subcommand(1); // command line options for testservice command auto testservice = app.add_subcommand("testservice", "start a battle-com service but to not subscribe to anything."); testservice->add_option("-b",broadcastAddress,"the broadcast address to use for the pub/sub service (Default: 127.0.0.255)"); testservice->add_option("-s",srcAddress,"the source address to use for the pub/sub service (Default: 127.0.0.1 )"); testservice->add_option("-p",port,"the broadcast port to use for the pub/sub service (Default: 8888)"); testservice->callback( [&](){ BCCLI::testservice(broadcastAddress, srcAddress, port); }); // command line options for ping command auto ping = app.add_subcommand("ping", "ping another service and print round trip times"); ping->add_option("-b",broadcastAddress,"the broadcast address to use for the pub/sub service (Default: 127.0.0.255)"); ping->add_option("-s",srcAddress,"the source address to use for the pub/sub service (Default: 127.0.0.1 )"); ping->add_option("-p",port,"the broadcast port to use for the pub/sub service (Default: 8888)"); ping->add_option("-d",destination,"the destionation to ping (Default: allDevices)"); ping->callback( [&](){ BCCLI::ping(broadcastAddress, srcAddress, port,destination); }); CLI11_PARSE(app, argc, argv); return 0; }