px4-firmware/cmake/posix/apps.h_in

89 lines
1.8 KiB
Plaintext

/* builtin command list - automatically generated, do not edit */
#include <string>
#include <map>
#include <stdio.h>
#include <px4_tasks.h>
#include <px4_posix.h>
#include <px4_log.h>
#include <stdlib.h>
using namespace std;
extern void px4_show_devices(void);
extern "C" {
${builtin_apps_decl_string}
static int shutdown_main(int argc, char *argv[]);
static int list_tasks_main(int argc, char *argv[]);
static int list_files_main(int argc, char *argv[]);
static int list_devices_main(int argc, char *argv[]);
static int list_topics_main(int argc, char *argv[]);
static int sleep_main(int argc, char *argv[]);
}
static map<string,px4_main_t> app_map(void)
{
static map<string,px4_main_t> 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;
return apps;
}
map<string,px4_main_t> apps = app_map();
static void list_builtins(void)
{
cout << "Builtin Commands:" << endl;
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
cout << '\t' << it->first << endl;
}
static int shutdown_main(int argc, char *argv[])
{
printf("Shutting down\n");
exit(0);
}
static int list_tasks_main(int argc, char *argv[])
{
px4_show_tasks();
return 0;
}
static int list_devices_main(int argc, char *argv[])
{
px4_show_devices();
return 0;
}
static int list_topics_main(int argc, char *argv[])
{
px4_show_topics();
return 0;
}
static int list_files_main(int argc, char *argv[])
{
px4_show_files();
return 0;
}
static int sleep_main(int argc, char *argv[])
{
if (argc != 2) {
cout << "Usage: sleep <seconds>" << endl;
return 1;
}
sleep(atoi(argv[1]));
return 0;
}