DJI Mobile SDK Documentation

      class Trigger

      class Trigger
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Mission Triggers can be used to trigger an action during the execution of a Timeline element if a set of criteria is met. The subclass of Trigger should implement the logic for collecting and judging the criteria, and then executing the action. Mission Triggers are used in the Timeline element TimelineElement.

      Trigger actions can be listened to, so when subclassing this class, notifyListenersOfEvent should be used to notify listeners of trigger events.

      Class Members:
      State
      method
      method isActive
      boolean isActive()
      Package:dji.sdk.mission.timeline.triggers
      Description:

      true if the trigger is currently active. The trigger is active when the Timeline element it is associated with is being executed in the Timeline.

      Return:
      booleantrue if active.
      Action to Trigger
      method
      method setAction
      void setAction(Action action)
      Package:dji.sdk.mission.timeline.triggers
      Description:

      The action to execute. It is up to the trigger's implementation to decide when to call this action. The action should never be called by anything but the trigger. Actions can be implemented without using this property, but in addition notifyListenersOfEvent needs to be used to notify any listeners of the Trigger that an action was executed.

      In future subclasses of this property to be provided, this action block will be used to give developers control of an action when a set of criteria has been met. For example, a subclass of this may be a battery threshold trigger. Once the battery passes some threshold developers will be able to define the action they want to trigger.

      Input Parameters:
      Action actionAction to trigger.
      Control
      method
      method start
      void start()
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Begins trigger activity including monitoring the criteria required to trigger the action. When subclassing, the super class's start method should be called on the first line.

      method
      method stop
      void stop()
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Ends all trigger activities including monitoring the criteria required to trigger the action. When subclassing, the super class's stop method should be called at the end.

      Listeners
      method
      method addListener
      void addListener(Listener listener)
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Adds a listener to all trigger events

      Input Parameters:
      Listener listenerA listener object
      method removeListener
      void removeListener(Listener listener)
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Removes the listener from the listeners pool of all trigger events.

      Input Parameters:
      Listener listenerA previously added listener object.
      method removeAllListeners
      void removeAllListeners()
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Removes all listeners from the listeners pool of all trigger events.

      Notify Listeners
      method
      method notifyListenersOfEvent
      void notifyListenersOfEvent(TriggerEvent event, DJIError error)
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Notifies listeners about a trigger event. Should be used in subclasses especially after calling the action.

      Input Parameters:
      TriggerEvent eventA valid DJIMissionTriggerEvent.
      DJIError errorAn optional error.
      Action
      interface
      interface Action
      interface Action
      Package:dji.sdk.mission.timeline.triggers
      Description:

      The type for the block being called when the trigger is triggered.

      Interface Methods:
      State
      method
      method onCall
      void onCall()
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Call the action.

      Listener
      interface
      interface Listener
      interface Listener
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Listener interface for Trigger events.

      Interface Methods:

      Callback Method

      State
      method
      method onEvent
      void onEvent(Trigger trigger, TriggerEvent event, @Nullable DJIError error)
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Called when a trigger event occurs.

      Input Parameters:
      Trigger triggerThe instance of the trigger.
      TriggerEvent eventThe event type which caused the call.
      @Nullable DJIError errorAn optional error.
      Trigger Event
      enum
      enum TriggerEvent
      enum TriggerEvent
      Package:dji.sdk.mission.timeline.triggers
      Description:

      Events that may occur during the lifecycle of a mission trigger.

      Enum Members:
      UNKNOWNThe default event if no other event matches the situation.
      STARTEDThe trigger has started to monitor for its triggering criteria
      ACTION_TRIGGEREDThe action block has been called as a result of matching the triggers' criteria
      STOPPEDThe trigger no longer monitors data for its triggering criteria
      Class Members: