3 #include <boost/program_options.hpp> 4 #include <crazyflie_cpp/Crazyflie.h> 19 if (token ==
"firmware")
21 else if (token ==
"bootloader")
23 else if (token ==
"sysoff")
25 else if (token ==
"syson")
27 else if (token ==
"alloff")
29 else throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value);
33 int main(
int argc,
char **argv)
37 std::string defaultUri(
"radio://0/80/2M/E7E7E7E7E7");
40 namespace po = boost::program_options;
42 po::options_description desc(
"Allowed options");
44 (
"help",
"produce help message")
45 (
"uri", po::value<std::string>(&uri)->default_value(defaultUri),
"unique ressource identifier")
46 (
"mode", po::value<Mode>(&mode)->default_value(mode),
"reboot mode {firmware,bootloader,sysoff,syson,alloff}")
52 po::store(po::parse_command_line(argc, argv, desc), vm);
55 if (vm.count(
"help")) {
56 std::cout << desc <<
"\n";
62 std::cerr << e.what() << std::endl << std::endl;
63 std::cerr << desc << std::endl;
91 catch(std::exception& e)
93 std::cerr << e.what() << std::endl;
int main(int argc, char **argv)
std::istream & operator>>(std::istream &in, Mode &mode)
uint64_t rebootToBootloader()