DJI Mobile SDK Documentation

      class HandheldController

      class HandheldController extends BaseComponent
      Package:dji.sdk.handheldcontroller
      Inherits From:BaseComponent
      Description:

      This class contains interfaces related to the hand controller of a handheld device (such as Osmo). This object is available from the HandHeld subclass off BaseProduct.

      Class Members:
      State Updates
      method
      method setPowerModeCallback
      void setPowerModeCallback(@NonNull PowerMode.Callback callback)
      Package:dji.sdk.handheldcontroller
      SDK Key:HandheldControllerKey.POWER_MODE
      Description:

      Setup the callback that returns changed power mode state information.

      Input Parameters:
      @NonNull PowerMode.Callback callbackThe callback for the power mode state.
      method setHardwareStateCallback
      void setHardwareStateCallback(@Nullable HardwareState.Callback callback)
      Package:dji.sdk.handheldcontroller
      Description:

      Set up the callback for the handheld's hardware state.

      Input Parameters:
      @Nullable HardwareState.Callback callbackCallback for the handheld controller's current hardware state (e.g. the state of the physical buttons and joysticks).
      Power
      method
      method setPowerMode
      void setPowerMode(@NonNull PowerMode mode, @Nullable final CompletionCallback callback)
      Package:dji.sdk.handheldcontroller
      SDK Key:HandheldControllerKey.POWER_MODE
      Description:

      Set the power mode for the handheld controller.

      Input Parameters:
      @NonNull PowerMode modeThe power mode to set. CAUTION! When the mode is OFF, the handheld product will be shut down and the connection will be broken. The user must then power on the device manually.
      @Nullable final CompletionCallback callbackThe execution callback with the execution result returned.
      method controlLEDWithCommand
      void controlLEDWithCommand(@NonNull LEDCommand command,
      @Nullable CompletionCallback callback)
      Package:dji.sdk.handheldcontroller
      SDK Key:HandheldControllerKey.LED_COMMAND
      Description:

      Controls the LED of the handheld controller.

      Input Parameters:
      @NonNull LEDCommand commandThe command to control the LED.
      @Nullable CompletionCallback callbackThe execution callback with the execution result returned.
      Stick Control
      method
      method setStickGimbalControlEnabled
      void setStickGimbalControlEnabled(boolean enabled, @Nullable CompletionCallback callback)
      Package:dji.sdk.handheldcontroller
      SDK Key:HandheldControllerKey.STICK_GIMBAL_CONTROL_ENABLED
      Description:

      Enables/disables the gimbal control with the joystick. By default, it is enabled. The handheld will be reset to the default value when it reboots or SDK reinitializes. When gimbal control is disabled, the joystick can be used for other purposes in an SDK application by reading its position values with StickVerticalDirection and StickHorizontalDirection. Only supported in firmware version 1.2.0.40 or above.

      Input Parameters:
      boolean enabledtrue to enable the gimbal control.
      @Nullable CompletionCallback callbackThe execution callback with the execution result returned.
      method getStickGimbalControlEnabled
      void getStickGimbalControlEnabled(@NonNull final CompletionCallbackWith<Boolean> callback)
      Package:dji.sdk.handheldcontroller
      SDK Key:HandheldControllerKey.STICK_GIMBAL_CONTROL_ENABLED
      Description:

      true if gimbal control with the joystick is enabled. Only supported in firmware version 1.2.0.40 or above.

      Input Parameters:
      @NonNull final CompletionCallbackWith<Boolean> callbackThe execution callback with the returned value(s).
      enum PowerMode
      @EXClassNullAway
      enum PowerMode
      Package:dji.common.handheld
      SDK Key:HandheldControllerKey.POWER_MODE
      Description:

      Handheld Power Mode.

      Enum Members:
      ONThe handheld product is awake. For Osmo, when it is in this mode, all the components in HandHeld are accessible.
      SLEEPINGThe handheld product is sleeping. The handheld controller keeps the wireless connection to the mobile device alive but most other components are off. The power consumption is low in this mode. For Osmo in this mode, only the HandheldController, AirLink, and Battery are accessible.
      OFFThe handheld product is powered off. Once this mode is set the callback will receive this mode until the handheld device is shut down completely. It is not supported by Osmo Mobile.
      UNKNOWNThe Handheld Power Mode in unknown.
      Class Members:
      State Updates
      class
      enum ControllerMode
      @EXClassNullAway
      enum ControllerMode
      Package:dji.common.handheldcontroller
      SDK Key:GimbalKey.CONTROLLER_MODE
      Description:

      The control mode for the gimbal physical controller (joystick for Osmo). The total controller deflection is a combination of horizontal and vertical deflection. This translates to gimbal movement around the yaw and pitch axes. The gimbal can be set to either move in both yaw and pitch simultaneously based on horizontal and vertical deflection of the controller, or move in only yaw or pitch exclusively based on whether horizontal or vertical deflection is larger.

      Enum Members:
      ONE_AXISGimbal movement will be exclusively in yaw or pitch depending on whether the controller horizontal or vertical deflection is greater respectively.
      TWO_AXISGimbal movement will be in both yaw and pitch simultaneously relative to the horizontal and vertical deflection of the controller respectively.
      UNKNOWNThe gimbal controller control mode is unknown.
      Class Members:
      enum ZoomState
      @EXClassNullAway
      enum ZoomState
      Package:dji.common.handheld
      Description:

      The state of the zoom slider on the handheld controller. Used by Osmo Mobile 2 only.

      Enum Members:
      IDLEZoom slider is idle.
      ZOOM_INThe slider is pushed up and the camera should zoom in.
      ZOOM_OUTThe slider is pushed down and the camera should zoom out.
      UNKNOWNUnknown.
      Class Members:
      Inherited Methods:
      dji.sdk.base.BaseComponent
      method
      method setComponentListener
      void setComponentListener(ComponentListener listener)
      Package:dji.sdk.base
      Description:

      Sets the listener for the DJI component.

      Input Parameters:
      ComponentListener listenerThe callback of ComponentListener.
      method
      method getIndex
      int getIndex()
      Package:dji.sdk.base
      Description:

      Returns the component index. Index is zero based. A component will have an index greater than zero when there are multiple components of the same type on the DJI product, and one of the components already has the index 0. For instance, M210 can have two gimbal mounted cameras, and will therefore have two gimbal components with indices 0 and 1, and two camera components with indices 0 and 1. For Matrice 600, there are printed numbers on the battery boxes. The Battery component instance with index 0 corresponds to battery compartment number 1. For Inspire 2 and M200 series, Battery with index 0 corresponds to the battery on the port (left hand) side of the aircraft. For M210, M210 RTK, M300 RTK and M350 RTK, Camera and Gimbal with index 0 corresponds to the camera and gimbal on the port (left hand) side of the aircraft. Lidar with index 0 corresponds to the lidar(Zenmuse L1) on the port (left hand) side of the aircraft.

      Return:
      intAn int value of index.
      method isConnected
      boolean isConnected()
      Package:dji.sdk.base
      Description:

      true if the component is connected.

      Return:
      booleantrue if the component is connected.
      method getSerialNumber
      void getSerialNumber(@NonNull CompletionCallbackWith<String> callback)
      Package:dji.sdk.base
      Description:

      Gets the serial number of the component. Depending on the component, this serial number might not match the serial number found on the physical component.

      Input Parameters:
      @NonNull CompletionCallbackWith<String> callbackThe execution callback with the value returned.
      method getFirmwareVersion
      void getFirmwareVersion(@NonNull CompletionCallbackWith<String> callback)
      Package:dji.sdk.base
      Description:

      Returns the firmware version of the component. Each component will have a different firmware version, the combination of which will form the package firmware version getFirmwarePackageVersion found in BaseProduct.

      Input Parameters:
      @NonNull CompletionCallbackWith<String> callbackThe execution callback with the value(s) returned.