DJI Mobile SDK Documentation

      class DJIMissionTrigger

      @interface DJIMissionTrigger : NSObject
      Header:DJIMissionTrigger.h
      Inherits From:NSObject
      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 DJIMissionTrigger should implement the logic for collecting and judging the criteria, and then executing the action. Mission Triggers are used in the Timeline element DJIMissionControlTimelineElement.

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

      Class Members:
      State
      property
      property isActive
      @property BOOL isActive
      Header:DJIMissionTrigger.h
      Description:

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

      Action to Trigger
      property
      property action
      @property (copy, nonatomic) DJIMissionTriggerAction action
      Header:DJIMissionTrigger.h
      Description:

      The action to execute. The action should never be called explicitly by the trigger, instead call the triggerAction method.

      See Also:

      DJIMissionTriggerAction

      Control
      method
      method start
      - (void)start
      Header:DJIMissionTrigger.h
      Description:

      Begins trigger activity including monitoring the criteria required to trigger the action. When subclassing, [super start] should be called on the first line.

      method
      method stop
      - (void)stop
      Header:DJIMissionTrigger.h
      Description:

      Ends all trigger activities including monitoring the criteria required to trigger the action. When subclassing, [super stop] should be called at the end.

      method triggerAction
      - (void)triggerAction
      Header:DJIMissionTrigger.h
      Description:

      Method which checks whether the action block is not null and executes it. It also notifies the listeners about the success / failure (in the case of a null action block) of the action. When subclassing, [super triggerAction] should be called at the end.

      method addListener:toTimelineProgressWithBlock
      - (void)addListener:(id)listener toTimelineProgressWithBlock:(DJIMissionTriggerBlock)eventBlock
      Header:DJIMissionTrigger.h
      Description:

      Adds a listener to all trigger events with the passed block

      Input Parameters:
      id listenerA listener object
      DJIMissionTriggerBlock eventBlockA block to be called for each events
      method removeListener
      - (void)removeListener:(id)listener
      Header:DJIMissionTrigger.h
      Description:

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

      Input Parameters:
      id listenerA previously added listener object.
      method removeAllListeners
      - (void)removeAllListeners
      Header:DJIMissionTrigger.h
      Description:

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

      Notify Listeners
      method
      method notifyListenersOfEvent:error
      - (void)notifyListenersOfEvent:(DJIMissionTriggerEvent)event
      error:(NSError * _Nullable)error
      Header:DJIMissionTrigger.h
      Description:

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

      Input Parameters:
      DJIMissionTriggerEvent eventA valid DJIMissionTriggerEvent.
      NSError * _Nullable errorAn optional error.
      Action
      typedef block
      typedef block DJIMissionTriggerAction
      typedef void (^DJIMissionTriggerAction)()
      Header:DJIMissionTrigger.h
      Description:

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

      Trigger Event
      typedef block
      typedef block DJIMissionTriggerBlock
      typedef void (^DJIMissionTriggerBlock)(DJIMissionTrigger *trigger, DJIMissionTriggerEvent event, NSError *_Nullable error)
      Header:DJIMissionTrigger.h
      Description:

      The block type used when an event is called and listened to.

      Input Parameters:
      DJIMissionTrigger * triggerThe instance of the trigger
      DJIMissionTriggerEvent eventThe event type which caused the block call
      NSError *_Nullable errorAn optional error
      enum DJIMissionTriggerEvent
      typedef NS_ENUM(NSInteger, DJIMissionTriggerEvent)
      Header:DJIMissionTrigger.h
      Description:

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

      Enum Members:
      DJIMissionTriggerEventUnknownThe default event if no other event matches the situation.
      DJIMissionTriggerEventStartedThe trigger has started to monitor for its triggering criteria
      DJIMissionTriggerEventActionTriggeredThe action block has been called as a result of matching the triggers' criteria
      DJIMissionTriggerEventStoppedThe trigger no longer monitors data for its triggering criteria