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. |
Handle< std::string > ReceiveHandle | Handle type for subscribe_receive. |
Public Member Functions
Type | Name | Description |
---|---|---|
Shell (System & system) | Constructor. Creates the plugin for a specific System. | |
Shell (std::shared_ptr< System > system) | Constructor. Creates the plugin for a specific System. | |
~Shell () override | Destructor (internal use only). | |
Shell (const Shell & other) | Copy constructor. | |
Result | send (std::string command)const | Send a command line. |
ReceiveHandle | subscribe_receive (const ReceiveCallback & callback) | Receive feedback from a sent command line. |
void | unsubscribe_receive (ReceiveHandle handle) | Unsubscribe from subscribe_receive. |
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 = Shell(system);
Parameters
- System& system - The specific system associated with this plugin.
Shell()
mavsdk::Shell::Shell(std::shared_ptr< System > system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto shell = Shell(system);
Parameters
- std::shared_ptr< System > system - The specific system associated with this plugin.
~Shell()
mavsdk::Shell::~Shell() override
Destructor (internal use only).
Shell()
mavsdk::Shell::Shell(const Shell &other)
Copy constructor.
Parameters
- const Shell& other -
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.
typedef ReceiveHandle
using mavsdk::Shell::ReceiveHandle = Handle<std::string>
Handle 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()
ReceiveHandle mavsdk::Shell::subscribe_receive(const 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
- const ReceiveCallback& callback -
Returns
unsubscribe_receive()
void mavsdk::Shell::unsubscribe_receive(ReceiveHandle handle)
Unsubscribe from subscribe_receive.
Parameters
- ReceiveHandle handle -
operator=()
const Shell& mavsdk::Shell::operator=(const Shell &)=delete
Equality operator (object is not copyable).
Parameters
- const Shell& -
Returns
const Shell & -