Class RemoteControl

    • Constructor Detail

      • RemoteControl

        public RemoteControl()
    • Method Detail

      • getUid

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

        Remote control uid uniquely identifies a remote control, and is persistent between sessions.

        Returns:
        remote control uid
      • getModel

        @NonNull
        public abstract RemoteControl.Model getModel()
        Gets the remote control model.

        Model is set when the remote control instance is created and never changes.

        Returns:
        remote control model
      • getName

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

        Remote control 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:
        remote control current name
      • getName

        @NonNull
        public abstract Ref<String> getName​(@NonNull
                                            Ref.Observer<String> observer)
        Gets the remote control name and registers an observer notified each time it changes.

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

        Parameters:
        observer - observer to notify when the remote control name changes
        Returns:
        reference to remote control name
        See Also:
        to get current name without registring an observer
      • getState

        @NonNull
        public abstract DeviceState getState()
        Gets the remote control 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 remote control state
      • getState

        @NonNull
        public abstract Ref<DeviceState> getState​(@NonNull
                                                  Ref.Observer<DeviceState> observer)
        Gets the remote control state and registers an observer notified each time it changes.

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

        Parameters:
        observer - observer to notify when the remote control state changes
        Returns:
        reference to remote control state
        See Also:
        to get current state without registring an observer
      • forget

        public abstract boolean forget()
        Forgets the remote control.

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

        Returns:
        true if the remote control has been forgotten, otherwise false
      • connect

        public abstract boolean connect()
        Connects the remote control.

        Chooses the best available connector, as follows:

        • If there is only one available connector, then it is used to connect the remote control. Otherwise,
        • if there is only one available USB connector (note that there can be two of those in case both the device USB and the USB Debug Bridge are used), then it is used to connect the remote control.
        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 remote control is not visible anymore
      • connect

        public abstract boolean connect​(@NonNull
                                        DeviceConnector connector)
        Connects the remote control using the specified device connector.
        Parameters:
        connector - connector that should be used
        Returns:
        true if the connection process has started, otherwise false, for example if the remote control is not visible anymore
      • connect

        public abstract boolean connect​(@NonNull
                                        DeviceConnector connector,
                                        @NonNull
                                        String password)
        Connects the remote control.
        Parameters:
        connector - connector that should be used
        password - password to use for authentication
        Returns:
        true if the connection process has started, otherwise false, for example if the remote control is not visible anymore
      • disconnect

        public abstract boolean disconnect()
        Disconnects the remote control.

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

        Returns:
        true if the disconnection process has started, otherwise false