43 #include <px4_platform_common/log.h> 44 #include <px4_platform_common/time.h> 45 #include <px4_platform_common/posix.h> 46 #include <px4_platform_common/defines.h> 47 #include <dspal_platform.h> 61 #include "DriverFramework.hpp" 63 #define MAX_ARGS 8 // max number of whitespace separated args after app name 77 if (sub_qshell_req == PX4_ERROR) {
78 PX4_ERR(
"Error subscribing to qshell_req topic");
82 px4_pollfd_struct_t fds[1] = {};
83 fds[0].fd = sub_qshell_req;
84 fds[0].events = POLLIN;
90 int pret =
px4_poll(&fds[0], (
sizeof(fds) /
sizeof(fds[0])), 1000);
92 if (pret > 0 && fds[0].revents & POLLIN) {
99 std::vector<std::string> appargs;
104 if (isspace(current_char)) {
106 appargs.push_back(arg);
115 appargs.push_back(arg);
131 }
else if (pret == 0) {
146 std::string
command = appargs[0];
148 if (command.compare(
"help") == 0) {
154 for (apps_map_type::iterator it =
m_apps.begin(); it !=
m_apps.end(); ++it) {
155 if (it->first == command) {
161 if (appargs.size() >
MAX_ARGS + 1) {
162 PX4_ERR(
"%d too many arguments in run_cmd", appargs.size() - (
MAX_ARGS + 1));
166 while (i < appargs.size() && appargs[i].c_str()[0] !=
'\0') {
167 arg[i] = (
char *)appargs[i].c_str();
168 PX4_DEBUG(
" arg%d = '%s'\n", i, arg[i]);
175 if (
m_apps[command] == NULL) {
176 PX4_ERR(
"Null function !!\n");
185 PX4_ERR(
"Command %s not found", command.c_str());
int orb_copy(const struct orb_metadata *meta, int handle, void *buffer)
static px4::AppState appState
int run_cmd(const std::vector< std::string > &appargs)
High-resolution timer with callouts and timekeeping.
int orb_subscribe(const struct orb_metadata *meta)
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
uint32_t request_sequence
struct qshell_req_s m_qshell_req
static int orb_publish_auto(const struct orb_metadata *meta, orb_advert_t *handle, const void *data, int *instance, int priority)
Advertise as the publisher of a topic.