DJI Mobile SDK Documentation

      class PayloadWidget

      class PayloadWidget
      Package:dji.common.payload
      Description:

      Class to represent the properties of a payload widget. Payload SDK defines different types of widgets for the interaction between the payload device and the mobile device.

      Class Members:
      Type
      method
      method getWidgetType
      PayloadWidgetType getWidgetType()
      Package:dji.common.payload
      Description:

      Get the type of the widget. Different types have different type of values.

      Return:
      PayloadWidgetTypeThe type of the payload widget.
      Index
      method
      method getWidgetIndex
      int getWidgetIndex()
      Package:dji.common.payload
      Description:

      Get the index of the widget. An index is used to differentiate widgets of the same type.

      Return:
      intThe index of the payload widget, same type of widgets must have different index.
      Value
      method
      method getWidgetValue
      int getWidgetValue()
      Package:dji.common.payload
      Description:

      Get the value of the payload widget.

      Return:
      intThe value of the payload widget, the widget of INPUT type will return an int value of 0(normal) or 1(pressed), SWITCH type will return a int value of 0(switch off) or 1(switch on), RANGE type will return a int value from 0 to 100 (inclusive), LIST type will return a int value from 0 to N (N is determined by firmware), INPUT type will return any int value which is set previously.
      Name
      method
      method getName
      String getName()
      Package:dji.common.payload
      Description:

      Get the name of the widget. This is determined by the payload device and not configurable through the mobile device.

      Return:
      StringThe name of the payload widget.
      Hint Message
      method
      method getHintMsg
      String getHintMsg()
      Package:dji.common.payload
      Description:

      Get the hint message of the payload widget.

      Return:
      StringThe hint message of the payload widget, "INPUT" type of widget might has a hint message which describe the function of the widget.
      Sub Items
      method
      method getSubItems
      List<String> getSubItems()
      Package:dji.common.payload
      Description:

      Get the sub items list of the payload widget.

      Return:
      List<String>The sub items list of the payload widget, LIST type widget could return the sub items, which describe the options or different functions related with the widget value, for example, if the widget has a list of sub items with size of 5, then the widget could accept the widget value between 0 to 4 (inclusive), the string with index of 0 will describe the function if the widget value of 0 is set.
      Constructor
      method
      method PayloadWidget
      PayloadWidget(PayloadWidgetType widgetType, int widgetIndex, int widgetValue, String name)
      Package:dji.common.payload
      Description:

      Common widget information.

      Input Parameters:
      PayloadWidgetType widgetTypeAn enum value of PayloadWidgetType.
      int widgetIndexThe widget index.
      int widgetValueThe value of the widget.
      String nameThe widget name.
      method PayloadWidget
      PayloadWidget(PayloadWidgetType widgetType, int widgetIndex, int widgetValue, String name, String hintMsg)
      Package:dji.common.payload
      Description:

      Common widget information with message hint.

      Input Parameters:
      PayloadWidgetType widgetTypeAn enum value of PayloadWidgetType.
      int widgetIndexThe widget index.
      int widgetValueThe value of the widget.
      String nameThe widget name.
      String hintMsgA hint message string.
      method PayloadWidget
      PayloadWidget(PayloadWidgetType widgetType, int widgetIndex, int widgetValue, String name, List<String> subItems)
      Package:dji.common.payload
      Description:

      List widget information with the sub items.

      Input Parameters:
      PayloadWidgetType widgetTypeAn enum value of PayloadWidgetType.
      int widgetIndexThe widget index.
      int widgetValueThe value of the widget.
      String nameThe widget name.
      List<String> subItemsA list of sub items strings.
      method PayloadWidget
      PayloadWidget(PayloadWidgetType widgetType,
      int widgetIndex,
      int widgetValue,
      String name,
      String hintMsg,
      List<String> subItems)
      Package:dji.common.payload
      Description:

      List widget information with the sub items and message hint.

      Input Parameters:
      PayloadWidgetType widgetTypeAn enum value of PayloadWidgetType.
      int widgetIndexThe widget index.
      int widgetValueThe value of the widget.
      String nameThe widget name.
      String hintMsgA hint message string.
      List<String> subItemsA list of sub items strings.
      enum PayloadWidgetType
      enum PayloadWidgetType
      Package:dji.common.payload
      Description:

      Types of widgets on the payload device.

      Enum Members:
      UNKNOWNOther unknown widget type.
      BUTTONButton, button widget could return the widget value of 1 or 0, normally it's widget value is 0, when the button is being pressed the widget value will change to 1.
      SWITCHSwitch, switch widget could return the widget value of 1 or 0, when the switch is changed to "ON" state, the widget value will change to 1, if the switch is changed to "OFF" state, the widget value will change to 0.
      RANGERange, range widget could return the widget value between 0 - 100 (inclusive).
      LISTList, list widget could return the int value between 0 and N, N is determined by the firmware, the size of sub items returned by getSubItems() method in PayloadWidget will be N+1
      INPUTInput widget could be set with any int value, the default value is determined by the firmware.
      Class Members: