mavsdk::Shell Class Reference

#include: shell.h


  • Allow to communicate with the vehicle's system shell.

Public Types

Type Description
enum Result Possible results returned for shell requests.
std::function< void(Result)> ResultCallback Callback type for asynchronous Shell calls.
std::function< void(std::string)> ReceiveCallback Callback type for subscribe_receive.

Public Member Functions

Type Name Description
  Shell (System & system) Constructor. Creates the plugin for a specific System.
  ~Shell () Destructor (internal use only).
  Shell (const Shell &)=delete Copy constructor (object is not copyable).
Result send (std::string command)const Send a command line.
void subscribe_receive (ReceiveCallback callback) Receive feedback from a sent command line.
const Shell & operator= (const Shell &)=delete Equality operator (object is not copyable).

Constructor & Destructor Documentation

Shell()

mavsdk::Shell::Shell(System &system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto shell = std::make_shared<Shell>(system);

Parameters

  • System& system - The specific system associated with this plugin.

~Shell()

mavsdk::Shell::~Shell()

Destructor (internal use only).

Shell()

mavsdk::Shell::Shell(const Shell &)=delete

Copy constructor (object is not copyable).

Parameters

Member Typdef Documentation

typedef ResultCallback

using mavsdk::Shell::ResultCallback =  std::function<void(Result)>

Callback type for asynchronous Shell calls.

typedef ReceiveCallback

using mavsdk::Shell::ReceiveCallback =  std::function<void(std::string)>

Callback type for subscribe_receive.

Member Enumeration Documentation

enum Result

Possible results returned for shell requests.

Value Description
Unknown Unknown result.
Success Request succeeded.
NoSystem No system is connected.
ConnectionError Connection error.
NoResponse Response was not received.
Busy Shell busy (transfer in progress).

Member Function Documentation

send()

Result mavsdk::Shell::send(std::string command) const

Send a command line.

This function is blocking.

Parameters

  • std::string command -

Returns

Result - Result of request.

subscribe_receive()

void mavsdk::Shell::subscribe_receive(ReceiveCallback callback)

Receive feedback from a sent command line.

This subscription needs to be made before a command line is sent, otherwise, no response will be sent.

Parameters

operator=()

const Shell& mavsdk::Shell::operator=(const Shell &)=delete

Equality operator (object is not copyable).

Parameters

Returns

 const Shell & -

© Dronecode 2017-2020. License: CC BY 4.0            Updated: 2020-09-03 11:40:13

results matching ""

    No results matching ""