Managed Ground Sdk
An GroundSdk session automatically managed according to an android Activity lifecycle.
This class allows the application to retrieve a GroundSdk session whose lifecycle is is automatically managed in correlation with a given Activity
's own lifecycle.This is the recommended way to use GroundSdk API in an android Activity.
The application should obtain such a session in the onCreate method. None of the session's lifecycle management methods, as described in GroundSdk documentation, need to be called.
- The session is automatically retained and restored upon configuration changes.
- The session is resumed when the activity calls through super.onStart() method (by default, but the application may chose to have it resumed in when the activity calls through super.onResume() method instead).
- The session is suspended when the activity calls through super.onStop() method (by default, but the application may chose to have it suspended in when the activity calls through super.onPause() method instead).
- The session is automatically closed when the activity calls through onDestroy. The application MUST NOT use the session past this point.
For example:
public class MyManagedGroundSdkActivity extends Activity {
private ManagedGroundSdk mGroundSdk;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mGroundSdk = ManagedGroundSdk.obtainSession(this);
}
@Override
public void onDestroy() {
super.onDestroy();
// mGroundSdk MUST NOT be used anymore past this point
}
}
Types
Observer Behavior
Link copied to clipboard
enum ObserverBehavior
Content copied to clipboard
Allows to specify when a managed GroundSdk session will resume/suspend its registered observers.
Functions
connect Drone
Link copied to clipboard
Connects a drone identified by its uid.
fun connectDrone(@NonNull uid: String, @NonNull connector: DeviceConnector): Boolean
Content copied to clipboard
Connects a drone identified by its uid using a specific connector.
fun connectDrone(@NonNull uid: String, @NonNull connector: DeviceConnector, @NonNull password: String): Boolean
Content copied to clipboard
Connects a secured drone identified by its uid.
connect Remote Control
Link copied to clipboard
fun connectRemoteControl(@NonNull uid: String, @NonNull connector: DeviceConnector, @NonNull password: String): Boolean
Content copied to clipboard
Connects a remote control identified by its uid.
fun connectRemoteControl(@NonNull uid: String, @NonNull connector: DeviceConnector): Boolean
Content copied to clipboard
Connects a remote control identified by its uid using a specific connector.
disconnect Drone
Link copied to clipboard
Disconnects a drone identified by its uid.
disconnect Remote Control
Link copied to clipboard
Disconnects a remote control identified by its uid.
forget Drone
Link copied to clipboard
Forgets a drone identified by its uid.
forget Remote Control
Link copied to clipboard
Forgets a remote control identified by its uid.
get Drone List
Link copied to clipboard
fun getDroneList(@NonNull filter: Predicate<DroneListEntry>, @NonNull observer: Ref.Observer<List<DroneListEntry>>): Ref<List<DroneListEntry>>
Content copied to clipboard
Gets a list of known drones and registers an observer notified each time this list changes.
get Facility
Link copied to clipboard
Retrieves a facility.
get Remote Control
Link copied to clipboard
fun getRemoteControl(@NonNull uid: String, @NonNull listener: GroundSdk.OnDeviceRemovedListener): RemoteControl
Content copied to clipboard
Gets a remote control by uid.
get Remote Control List
Link copied to clipboard
fun getRemoteControlList(@NonNull filter: Predicate<RemoteControlListEntry>, @NonNull observer: Ref.Observer<List<RemoteControlListEntry>>): Ref<List<RemoteControlListEntry>>
Content copied to clipboard
Gets a list of known remote controls and registers an observer notified each time this list changes.
manage Rc Accessory
Link copied to clipboard
open fun manageRcAccessory(@NonNull context: Context, @NonNull rcAccessory: UsbAccessory)
Content copied to clipboard
Commands GroundSDK to manage the given remote controller USB accessory.
new Session
Link copied to clipboard
obtain Session
Link copied to clipboard
open fun obtainSession(@NonNull activity: Activity, @NonNull observerBehavior: ManagedGroundSdk.ObserverBehavior): ManagedGroundSdk
Content copied to clipboard
Obtains a GroundSdk session automatically managed according to the provided activity's lifecycle.
replay
Link copied to clipboard
fun replay(@NonNull source: FileReplay.Source, @NonNull observer: Ref.Observer<FileReplay>): Ref<FileReplay>
Content copied to clipboard
Creates a new replay stream for some local media file.