DJI Mobile SDK Documentation

      class KeyManager

      class KeyManager
      Package:dji.keysdk
      Description:

      KeyManager provides access to the keyed interface using DJIKey and corresponding subclass objects. KeyManager is accessed from getKeyManager in DJISDKManager.

      Class Members:
      method
      method getValue
      @Nullable Object getValue(@NonNull DJIKey key)
      Package:dji.keysdk
      Description:

      Returns the latest known value if available for the key. Does not pull it from the product if unavailable.

      Input Parameters:
      @NonNull DJIKey keyAn instance of DJIKey.
      Return:
      @Nullable ObjectThe value associated with the key.
      method
      method getValue
      void getValue(@NonNull DJIKey key, @NonNull final GetCallback callback)
      Package:dji.keysdk
      Description:

      Performs a get on a gettable key, pulling the information from the product if necessary.

      Input Parameters:
      @NonNull DJIKey keyA valid gettable key
      @NonNull final GetCallback callbackA valid get callback.
      method
      method setValue
      void setValue(@NonNull DJIKey key, @NonNull Object value, @Nullable final SetCallback callback)
      Package:dji.keysdk
      Description:

      Performs a set on a settable key, changing attributes on the connected product.

      Input Parameters:
      @NonNull Object valueA value object relevant to the given key
      @NonNull DJIKey keyA valid settable key
      @Nullable final SetCallback callbackA set callback.
      method performAction
      void performAction(@NonNull DJIKey key, @Nullable final ActionCallback callback, final Object... arguments)
      Package:dji.keysdk
      Description:

      Performs an action on an actionable key.

      Input Parameters:
      @NonNull DJIKey keyA valid actionable key
      final Object... argumentsOptional arguments relevant to the specific key
      @Nullable final ActionCallback callbackAn action callback.
      method addListener
      void addListener(@NonNull DJIKey key, @NonNull final KeyListener listener)
      Package:dji.keysdk
      Description:

      Subscribes the listener object to all changes of value on the given key.

      Input Parameters:
      @NonNull DJIKey keyA valid value-based key (get, set and/or action)
      @NonNull final KeyListener listenerA valid object to hold the subscription
      method removeListener
      void removeListener(@NonNull final KeyListener listener)
      Package:dji.keysdk
      Description:

      Stops the subscription to updates of a specific key value for a specific listener. Does not affect other listeners subscribing to this key or other subscriptions of the listener.

      Input Parameters:
      @NonNull final KeyListener listenerThe listener object passed at the moment of calling startListening.
      method isKeySupported
      boolean isKeySupported(@NonNull DJIKey key)
      Package:dji.keysdk
      Description:

      Determines if a key is supported by the connected product.

      Input Parameters:
      @NonNull DJIKey keyKey to be check on current product.
      Return:
      booleantrue if the key is supported.
      class
      interface
      interface GetCallback
      interface GetCallback
      Package:dji.keysdk.callback
      Description:

      Callback called when performing a get on a key.

      Interface Methods:
      method
      method onSuccess
      void onSuccess(@NonNull Object value)
      Package:dji.keysdk.callback
      Description:

      Invoked when getting process is done successfully.

      Input Parameters:
      @NonNull Object valueThe value returned back.
      method
      method onFailure
      void onFailure(@NonNull DJIError error)
      Package:dji.keysdk.callback
      Description:

      Invoked when getting process has failed.

      Input Parameters:
      @NonNull DJIError errorThe error that occurred.
      interface
      interface SetCallback
      interface SetCallback
      Package:dji.keysdk.callback
      Description:

      Callback called when performing a set on a key.

      Interface Methods:
      method
      method onSuccess
      void onSuccess()
      Package:dji.keysdk.callback
      Description:

      Invoked when setting process is done successfully.

      method
      method onFailure
      void onFailure(@NonNull DJIError error)
      Package:dji.keysdk.callback
      Description:

      Invoked when setting process has failed.

      Input Parameters:
      @NonNull DJIError errorThe error that occurred.
      interface ActionCallback
      interface ActionCallback
      Package:dji.keysdk.callback
      Description:

      Callback called when performing an action on a key.

      Interface Methods:
      method
      method onSuccess
      void onSuccess()
      Package:dji.keysdk.callback
      Description:

      Invoked when the action is done successfully.

      method
      method onFailure
      void onFailure(@NonNull DJIError error)
      Package:dji.keysdk.callback
      Description:

      Invoked when the action has failed.

      Input Parameters:
      @NonNull DJIError errorThe error that occurred.
      interface
      interface KeyListener
      interface KeyListener
      Package:dji.keysdk.callback
      Description:

      Interface to check if the value behind a key is updated.

      Interface Methods:
      method onValueChange
      void onValueChange(@Nullable Object oldValue, @Nullable Object newValue)
      Package:dji.keysdk.callback
      Description:

      The callback, called every time the value behind a key is updated.

      Input Parameters:
      @Nullable Object oldValueThe old value. null if no value was present before.
      @Nullable Object newValueThe new value. null if the stored values are being flushed.