forked from Archive/PX4-Autopilot
75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
|
/* definitions of builtin command list - automatically generated, do not edit */
|
||
|
#include "px4_posix.h"
|
||
|
#include "px4_log.h"
|
||
|
|
||
|
#include "apps.h"
|
||
|
|
||
|
#include <iostream>
|
||
|
#include <map>
|
||
|
#include <string>
|
||
|
|
||
|
#include <cstdlib>
|
||
|
|
||
|
extern void px4_show_devices(void);
|
||
|
|
||
|
void init_app_map(apps_map_type &apps)
|
||
|
{
|
||
|
${builtin_apps_string}
|
||
|
apps["shutdown"] = shutdown_main;
|
||
|
apps["list_tasks"] = list_tasks_main;
|
||
|
apps["list_files"] = list_files_main;
|
||
|
apps["list_devices"] = list_devices_main;
|
||
|
apps["list_topics"] = list_topics_main;
|
||
|
apps["sleep"] = sleep_main;
|
||
|
}
|
||
|
|
||
|
void list_builtins(apps_map_type &apps)
|
||
|
{
|
||
|
PX4_INFO("Builtin Commands:\n");
|
||
|
for (apps_map_type::iterator it = apps.begin(); it != apps.end(); ++it)
|
||
|
PX4_INFO("%s : 0x%x\n", it->first.c_str(), it->second);
|
||
|
}
|
||
|
|
||
|
int shutdown_main(int argc, char *argv[])
|
||
|
{
|
||
|
std::cout << "Shutting down" << std::endl;
|
||
|
exit(0);
|
||
|
}
|
||
|
|
||
|
int list_tasks_main(int argc, char *argv[])
|
||
|
{
|
||
|
px4_show_tasks();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int list_devices_main(int argc, char *argv[])
|
||
|
{
|
||
|
px4_show_devices();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int list_topics_main(int argc, char *argv[])
|
||
|
{
|
||
|
px4_show_topics();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int list_files_main(int argc, char *argv[])
|
||
|
{
|
||
|
px4_show_files();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int sleep_main(int argc, char *argv[])
|
||
|
{
|
||
|
if (argc != 2) {
|
||
|
PX4_WARN( "Usage: sleep <seconds>" );
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
unsigned long usecs = 1000000UL * atol(argv[1]);
|
||
|
std::cout << "Sleeping for " << argv[1] << " s; (" << usecs << " us)." << std::endl;
|
||
|
usleep(usecs);
|
||
|
return 0;
|
||
|
}
|