public abstract class

Drone

extends Object

implements Instrument.Provider, Peripheral.Provider, PilotingItf.Provider

 java.lang.Object

↳com.parrot.drone.groundsdk.device.Drone

Overview

A generic drone. This is the base class to manage a specific drone.

Summary

Constructors
publicDrone()

Methods
public abstract booleanconnect()

Connects the drone.

public abstract booleanconnect(DeviceConnector connector)

Connects the drone using the specified device connector.

public abstract booleanconnect(DeviceConnector connector, String password)

Connects the drone using the specified device connector and authentication password.

public abstract booleandisconnect()

Disconnects the drone.

public abstract booleanforget()

Forgets the drone.

public abstract Drone.ModelgetModel()

Gets the drone model.

public abstract StringgetName()

Gets drone current name.

public abstract Ref<String>getName(Ref.Observer<String> observer)

Gets the drone name and registers an observer notified each time it changes.

public abstract DeviceStategetState()

Gets the drone current state.

public abstract Ref<DeviceState>getState(Ref.Observer<DeviceState> observer)

Gets the drone state and registers an observer notified each time it changes.

public abstract StringgetUid()

Gets the drone uid.

from Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Drone()

Methods

public abstract String getUid()

Gets the drone uid.

Drone uid uniquely identifies a drone, and is persistent between sessions.

Returns:

drone uid

public abstract Drone.Model getModel()

Gets the drone model.

Model is set when the drone instance is created and never changes.

Returns:

drone model

public abstract String getName()

Gets drone current name.

Drone name can be changed. This method returns the name at the current time. Use Drone.getName(Ref.Observer) to get the current name and be notified when the name changes.

Returns:

drone current name

public abstract Ref<String> getName(Ref.Observer<String> observer)

Gets the drone name and registers an observer notified each time it changes.

If the drone is removed, the observer will be notified and the name returned by Ref.get() will be null.

Parameters:

observer: observer to notify when the drone name changes

Returns:

reference to drone name

See also: to get current name without registring an observer

public abstract DeviceState getState()

Gets the drone current state.

This method returns the current state without indicating when it changes. Use Drone.getState(Ref.Observer) to get the current state and be notified when the state changes.

Returns:

current drone state

public abstract Ref<DeviceState> getState(Ref.Observer<DeviceState> observer)

Gets the drone state and registers an observer notified each time it changes.

If the drone is removed, the observer will be notified and the state returned by Ref.get() will be null.

Parameters:

observer: observer to notify when the drone state changes

Returns:

reference to drone state

See also: to get current state without registring an observer

public abstract boolean forget()

Forgets the drone.

Persisted drone data are deleted and the drone is removed if it's not currently visible.

Returns:

true if the drone has been forgotten, otherwise false

public abstract boolean connect()

Connects the drone.

Chooses the best available connector, as follows:

  • If there is only one available connector, then it is used to connect the drone. Otherwise,
  • if there is only one available remote control connector, then it is used to connect the drone.
If none of the aforementioned condition holds, then the connection fails and false is returned.
Drone.connect(DeviceConnector) method shall be used to select an appropriate connector instead.

Returns:

true if the connection process has started, otherwise false, for example if the drone is not visible anymore

public abstract boolean connect(DeviceConnector connector)

Connects the drone using the specified device connector.

Parameters:

connector: the connector through which to establish the connection

Returns:

true if the connection process has started, otherwise false, for example if the drone is not visible anymore

public abstract boolean connect(DeviceConnector connector, String password)

Connects the drone using the specified device connector and authentication password.

Parameters:

connector: the connector through which to establish the connection
password: password to use for authentication

Returns:

true if the connection process has started, otherwise false, for example if the drone is not visible anymore

public abstract boolean disconnect()

Disconnects the drone.

This method can be used to disconnect the drone when connected or to cancel the connection process if the drone is currently connecting.

Returns:

true if the disconnection process has started, otherwise false