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