Interface AutoConnection
-
- All Superinterfaces:
Facility
public interface AutoConnection extends Facility
Facility that provides control of automatic connection fordrone
andremote control
devices.The goal of auto-connection is to ensure that exactly one remote control and exactly one drone are connected whenever it is possible to do so, based on rules as described below.
GroundSdk may be configured so that auto-connection is started automatically once the first
session
is opened.
This behaviour is enabled by settingauto_connection_at_startup
configuration flag totrue
, and disabled (which is the default) by setting this flag tofalse
.Auto-connection may also be
started
andstopped
manually though thisFacility
API.
Note however that, in any case, auto-connection is stopped as soon as the last opened GroundSdk session is closed.Remote control auto-connection
When started, auto-connection will try to always maintain one, and only one remote control connected. It will pick one remote control amongst all currently visible devices and ensure it is connecting or connected, and will connect it otherwise.
All other connected remote control devices are forcefully disconnected.To chose which device will get connected, visible remote control devices are sorted by connector technology:
USB
is considered better thanWifi
, which is considered better thanBluetooth Low-Energy
. The best available remote control is picked up according to this criteria and will be auto-connected.Also, if the best available remote control is currently connected (or connecting) and an even better connector becomes available for it, then it will be auto-reconnected (that is, disconnected, then connected again) using this better connector.
Drone auto-connection
When started, auto-connection will try to always maintain at least one, and only one drone connected.Two different cases must be distinguished:
- When no remote control is currently connected, then drone auto-connection behaves like remote control auto-connection: drones are sorted by connector technology and the drone with best technology is elected for auto-connection. Auto-reconnection using an even better connector may also happen, as for remote control devices.
- When a remote control is connected (or connecting), then auto-connection will ensure that no drones
are connected through any other connector (including local ones: WIFI or BLE) than this remote control.
Any drone that is currently connected or connecting though one of these connectors will get forcefully
disconnected.
If, by the time the remote control gets auto-connected, some drone is already connected through a local connector, then auto-connection will try to connect it through the remote control if the latter also knows and sees that drone; otherwise auto-connection lets the remote control decide which drone to connect.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AutoConnection.Status
Automatic connection status.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Drone
getDrone()
Retrieves the drone device currently elected for automatic connection.RemoteControl
getRemoteControl()
Retrieves the remote control device currently elected for automatic connection.AutoConnection.Status
getStatus()
Retrieves current automatic connection status.boolean
start()
Starts automatic devices connection.boolean
stop()
Stops automatic devices connection.
-
-
-
Method Detail
-
start
boolean start()
Starts automatic devices connection.- Returns:
true
if auto-connection will effectively start, otherwisefalse
-
stop
boolean stop()
Stops automatic devices connection.- Returns:
true
if auto-connection will effectively stop, otherwisefalse
-
getStatus
@NonNull AutoConnection.Status getStatus()
Retrieves current automatic connection status.- Returns:
- current status
-
getRemoteControl
@Nullable RemoteControl getRemoteControl()
Retrieves the remote control device currently elected for automatic connection.- Returns:
- currently elected remote control, or
null
if none is
-
getDrone
@Nullable Drone getDrone()
Retrieves the drone device currently elected for automatic connection.- Returns:
- currently elected drone, or
null
if none is
-
-