2016-10-21 15:54:48 +02:00
|
|
|
/* definitions of builtin command list - automatically generated, do not edit */
|
2019-10-25 10:56:32 +02:00
|
|
|
#include <px4_platform_common/time.h>
|
|
|
|
|
#include <px4_platform_common/posix.h>
|
|
|
|
|
#include <px4_platform_common/log.h>
|
2016-10-21 15:54:48 +02:00
|
|
|
|
|
|
|
|
#include "apps.h"
|
|
|
|
|
|
2016-10-29 02:22:04 +02:00
|
|
|
#include <cstdio>
|
2016-10-21 15:54:48 +02:00
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
2018-09-10 12:53:26 -04:00
|
|
|
#define MODULE_NAME "px4"
|
|
|
|
|
|
2016-10-27 19:20:07 +02:00
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
${builtin_apps_decl_string}
|
|
|
|
|
int shutdown_main(int argc, char *argv[]);
|
|
|
|
|
int list_tasks_main(int argc, char *argv[]);
|
|
|
|
|
int list_files_main(int argc, char *argv[]);
|
|
|
|
|
int sleep_main(int argc, char *argv[]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-21 15:54:48 +02:00
|
|
|
void init_app_map(apps_map_type &apps)
|
|
|
|
|
{
|
2020-01-09 11:00:40 -05:00
|
|
|
${builtin_apps_string}
|
2016-10-21 15:54:48 +02:00
|
|
|
apps["shutdown"] = shutdown_main;
|
|
|
|
|
apps["list_tasks"] = list_tasks_main;
|
|
|
|
|
apps["list_files"] = list_files_main;
|
|
|
|
|
apps["sleep"] = sleep_main;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void list_builtins(apps_map_type &apps)
|
|
|
|
|
{
|
2017-01-30 11:26:09 +01:00
|
|
|
printf("Builtin Commands:\n");
|
2017-01-14 15:23:21 -05:00
|
|
|
for (apps_map_type::iterator it = apps.begin(); it != apps.end(); ++it) {
|
2017-01-30 11:26:09 +01:00
|
|
|
printf(" %s\n", it->first.c_str());
|
2017-01-14 15:23:21 -05:00
|
|
|
}
|
2016-10-21 15:54:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int shutdown_main(int argc, char *argv[])
|
|
|
|
|
{
|
2016-10-29 02:22:04 +02:00
|
|
|
printf("Shutting down\n");
|
2018-08-31 13:28:28 +02:00
|
|
|
system_exit(0);
|
2016-10-21 15:54:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int list_tasks_main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
px4_show_tasks();
|
|
|
|
|
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]);
|
2016-10-29 02:22:04 +02:00
|
|
|
printf("Sleeping for %s s; (%lu us).\n", argv[1], usecs);
|
2018-10-04 06:51:04 +02:00
|
|
|
px4_usleep(usecs);
|
2016-10-21 15:54:48 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|