The Geofence class enables setting a geofence.
|enum Result||Possible results returned for geofence requests.|
|std::function< void(Result)> result_callback_t||Callback type for async geofence calls.|
|Geofence (System & system)||Constructor. Creates the plugin for a specific System.|
|~Geofence ()||Destructor (internal use only).|
|Geofence (const Geofence &)=delete||Copy constructor (object is not copyable).|
|void||send_geofence_async (const std::vector< std::shared_ptr< Polygon >> & polygons, result_callback_t callback)||Uploads a geofence to the system (asynchronous).|
|const Geofence &||operator= (const Geofence &)=delete||Equality operator (object is not copyable).|
|const char *||result_str (Result result)||Gets a human-readable English string for an Geofence::Result.|
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto geofence = std::make_shared<Geofence>(system);
- System& system - The specific system associated with this plugin.
Destructor (internal use only).
mavsdk::Geofence::Geofence(const Geofence &)=delete
Copy constructor (object is not copyable).
- const Geofence& -
typedef std::function<void(Result)> mavsdk::Geofence::result_callback_t
Callback type for async geofence calls.
Possible results returned for geofence requests.
||Too many Polygon objects in the geofence.|
||Request timed out.|
void mavsdk::Geofence::send_geofence_async(const std::vector< std::shared_ptr< Polygon >> &polygons, result_callback_t callback)
Uploads a geofence to the system (asynchronous).
The polygons are uploaded to a drone. Once uploaded the geofence will remain on the drone even if a connection is lost.
- const std::vector< std::shared_ptr< Polygon >>& polygons - Reference to vector of polygons.
- result_callback_t callback - Callback to receive result of this request.
const Geofence& mavsdk::Geofence::operator=(const Geofence &)=delete
Equality operator (object is not copyable).
- const Geofence& -
const Geofence & -
static const char* mavsdk::Geofence::result_str(Result result)
Gets a human-readable English string for an Geofence::Result.
- Result result - Enum for which string is required.
const char * - Human readable string for the Geofence::Result.