Class Drone

    • Constructor Detail

      • Drone

        public Drone()
    • Method Detail

      • getUid

        @NonNull
        public abstract String getUid()
        Gets the drone uid.

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

        Returns:
        drone uid
      • getModel

        @NonNull
        public abstract Drone.Model getModel()
        Gets the drone model.

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

        Returns:
        drone model
      • getName

        @NonNull
        public abstract String getName()
        Gets drone current name.

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

        Returns:
        drone current name
      • getName

        @NonNull
        public abstract Ref<String> getName​(@NonNull
                                            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
      • getState

        @NonNull
        public abstract DeviceState getState()
        Gets the drone current state.

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

        Returns:
        current drone state
      • forget

        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
      • connect

        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.
        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
      • connect

        public abstract boolean connect​(@NonNull
                                        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
      • connect

        public abstract boolean connect​(@NonNull
                                        DeviceConnector connector,
                                        @NonNull
                                        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
      • disconnect

        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