mavsdk::Param Class Reference
#include: param.h
Provide raw access to get and set parameters.
Public Types
Type | Description |
---|---|
enum Result | Possible results returned for param requests. |
std::function< void(Result)> ResultCallback | Callback type for asynchronous Param calls. |
Public Member Functions
Type | Name | Description |
---|---|---|
Param (System & system) | Constructor. Creates the plugin for a specific System. | |
~Param () | Destructor (internal use only). | |
Param (const Param &)=delete | Copy constructor (object is not copyable). | |
std::pair< Result, int32_t > | get_param_int (std::string name)const | Get an int parameter. |
Result | set_param_int (std::string name, int32_t value)const | Set an int parameter. |
std::pair< Result, float > | get_param_float (std::string name)const | Get a float parameter. |
Result | set_param_float (std::string name, float value)const | Set a float parameter. |
const Param & | operator= (const Param &)=delete | Equality operator (object is not copyable). |
Constructor & Destructor Documentation
Param()
mavsdk::Param::Param(System &system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto param = std::make_shared<Param>(system);
Parameters
- System& system - The specific system associated with this plugin.
~Param()
mavsdk::Param::~Param()
Destructor (internal use only).
Param()
mavsdk::Param::Param(const Param &)=delete
Copy constructor (object is not copyable).
Parameters
- const Param& -
Member Typdef Documentation
typedef ResultCallback
using mavsdk::Param::ResultCallback = std::function<void(Result)>
Callback type for asynchronous Param calls.
Member Enumeration Documentation
enum Result
Possible results returned for param requests.
Value | Description |
---|---|
Unknown |
Unknown result. |
Success |
Request succeeded. |
Timeout |
Request timed out. |
ConnectionError |
Connection error. |
WrongType |
Wrong type. |
ParamNameTooLong |
Parameter name too long (> 16). |
Member Function Documentation
get_param_int()
std::pair<Result, int32_t> mavsdk::Param::get_param_int(std::string name) const
Get an int parameter.
If the type is wrong, the result will be WRONG_TYPE
.
This function is blocking.
Parameters
- std::string name -
Returns
std::pair< Result, int32_t > - Result of request.
set_param_int()
Result mavsdk::Param::set_param_int(std::string name, int32_t value) const
Set an int parameter.
If the type is wrong, the result will be WRONG_TYPE
.
This function is blocking.
Parameters
- std::string name -
- int32_t value -
Returns
Result - Result of request.
get_param_float()
std::pair<Result, float> mavsdk::Param::get_param_float(std::string name) const
Get a float parameter.
If the type is wrong, the result will be WRONG_TYPE
.
This function is blocking.
Parameters
- std::string name -
Returns
std::pair< Result, float > - Result of request.
set_param_float()
Result mavsdk::Param::set_param_float(std::string name, float value) const
Set a float parameter.
If the type is wrong, the result will be WRONG_TYPE
.
This function is blocking.
Parameters
- std::string name -
- float value -
Returns
Result - Result of request.
operator=()
const Param& mavsdk::Param::operator=(const Param &)=delete
Equality operator (object is not copyable).
Parameters
- const Param& -
Returns
const Param & -