DJI Mobile SDK Documentation

      class DJIKeyManager

      @interface DJIKeyManager : NSObject
      Header:DJIKeyManager.h
      Inherits From:NSObject
      Description:

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

      Class Members:
      method getValueForKey
      - (nullable DJIKeyedValue *)getValueForKey:(DJIKey *)key
      Header:DJIKeyManager.h
      Description:

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

      Input Parameters:
      DJIKey * keyA valid gettable key
      Return:
      nullable DJIKeyedValue *A value object or nil if no previous value was stored.
      method getValueForKey:withCompletion
      - (void)getValueForKey:(DJIKey *)key
      withCompletion:(DJIKeyedGetCompletionBlock)completion
      Header:DJIKeyManager.h
      Description:

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

      Input Parameters:
      DJIKey * keyA valid gettable key
      DJIKeyedGetCompletionBlock completionA valid get completion block.
      method setValue:forKey:withCompletion
      - (void)setValue:(id)value
      forKey:(DJIKey *)key
      withCompletion:(DJIKeyedSetCompletionBlock)completion
      Header:DJIKeyManager.h
      Description:

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

      Input Parameters:
      id valueA value object relevant to the given key
      DJIKey * keyA valid settable key
      DJIKeyedSetCompletionBlock completionA set completion block.
      method performActionForKey:withArguments:andCompletion
      - (void)performActionForKey:(DJIKey *)key
      withArguments:(nullable NSArray *)arguments
      andCompletion:(DJIKeyedActionCompletionBlock)completion
      Header:DJIKeyManager.h
      Description:

      Performs an action on an actionable key.

      Input Parameters:
      DJIKey * keyA valid actionable key
      nullable NSArray * argumentsOptional arguments relevant to the specific key
      DJIKeyedActionCompletionBlock completionAn action completion block.
      method startListeningForChangesOnKey:withListener:andUpdateBlock
      - (void)startListeningForChangesOnKey:(DJIKey *)key
      withListener:(id)listener
      andUpdateBlock:(DJIKeyedListenerUpdateBlock)updateBlock
      Header:DJIKeyManager.h
      Description:

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

      Input Parameters:
      DJIKey * keyA valid value-based key (get, set and/or action)
      id listenerA valid object to hold the subscription
      DJIKeyedListenerUpdateBlock updateBlockA valid update block
      method stopListeningOnKey:ofListener
      - (void)stopListeningOnKey:(DJIKey *)key
      ofListener:(id)listener
      Header:DJIKeyManager.h
      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:
      DJIKey * keyA valid value-based key
      id listenerA listener object that is subscribed to the key that was setup with startListeningForChangesOnKey:withListener:andUpdateBlock.
      method stopAllListeningOfListeners
      - (void)stopAllListeningOfListeners:(id)listener
      Header:DJIKeyManager.h
      Description:

      Stops all subscriptions on all key value updates for the given listener.

      Input Parameters:
      id listenerThe listener object passed to startListeningForChangesOnKey:withListener:andUpdateBlock.
      method isKeySupported
      - (BOOL)isKeySupported:(DJIKey *)key
      Header:DJIKeyManager.h
      Description:

      Determines if a key is supported by the connected product.

      Input Parameters:
      DJIKey * keyKey to be check on current product.
      Return:
      BOOLYES if the key is supported.
      class
      typedef block DJIKeyedGetCompletionBlock
      typedef void (^DJIKeyedGetCompletionBlock)(DJIKeyedValue * _Nullable value, NSError * _Nullable error)
      Header:DJIKeyManager.h
      Description:

      The completion block called when performing a get on a key.

      Input Parameters:
      DJIKeyedValue * _Nullable valueAn optional value returned as a result of the get. Nil if no value exists yet or if an error is returned.
      NSError * _Nullable errorAn optional error object in case the call failed.
      typedef block DJIKeyedSetCompletionBlock
      typedef void (^DJIKeyedSetCompletionBlock)(NSError * _Nullable error)
      Header:DJIKeyManager.h
      Description:

      The completion block called when performing a set on a key.

      Input Parameters:
      NSError * _Nullable errorAn optional error in case the call failed.
      typedef block DJIKeyedActionCompletionBlock
      typedef void (^DJIKeyedActionCompletionBlock)(BOOL finished, DJIKeyedValue * _Nullable response, NSError * _Nullable error)
      Header:DJIKeyManager.h
      Description:

      The completion block called when performing an action on a key.

      Input Parameters:
      BOOL finishedWhether or not the action finished.
      DJIKeyedValue * _Nullable responseThe optional response value of the action.
      NSError * _Nullable errorThe option error in case the call failed.
      typedef block DJIKeyedListenerUpdateBlock
      typedef void (^DJIKeyedListenerUpdateBlock)(DJIKeyedValue * _Nullable oldValue, DJIKeyedValue * _Nullable newValue)
      Header:DJIKeyManager.h
      Description:

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

      Input Parameters:
      DJIKeyedValue * _Nullable oldValueThe old value. nil if no value was present before.
      DJIKeyedValue * _Nullable newValueThe new value. nil if the stored values are being flushed.