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
Description:
Returns the latest known value if available for the key. Does not pull it from the product if unavailable.
DJIKey * key A 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
Description:
Performs a get on a gettable key, pulling the information from the product if necessary.
method setValue:forKey:withCompletion
- (void )setValue:(id )value forKey:(DJIKey *)key withCompletion:(DJIKeyedSetCompletionBlock)completion
Description:
Performs a set on a settable key, changing attributes on the connected product.
method startListeningForChangesOnKey:withListener:andUpdateBlock
- (void )startListeningForChangesOnKey:(DJIKey *)key withListener:(id )listener andUpdateBlock:(DJIKeyedListenerUpdateBlock)updateBlock
Description:
Subscribes the listener object to all changes of value on the given key.
DJIKey * key A valid value-based key (get, set and/or action) id listener A valid object to hold the subscription DJIKeyedListenerUpdateBlock updateBlock A valid update block
method stopListeningOnKey:ofListener
- (void )stopListeningOnKey:(DJIKey *)key ofListener:(id )listener
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
.
method stopAllListeningOfListeners
- (void )stopAllListeningOfListeners:(id )listener
Description:
Stops all subscriptions on all key value updates for the given listener.
method isKeySupported
- (BOOL )isKeySupported:(DJIKey *)key
Description:
Determines if a key is supported by the connected product.
DJIKey * key Key to be check on current product.
Return:
BOOL YES
if the key is supported.
typedef block DJIKeyedGetCompletionBlock
typedef void (^DJIKeyedGetCompletionBlock)(DJIKeyedValue * _Nullable value, NSError * _Nullable error)
Description:
The completion block called when performing a get on a key.
DJIKeyedValue * _Nullable value An optional value returned as a result of the get. Nil if no value exists yet or if an error is returned. NSError * _Nullable error An optional error object in case the call failed.
typedef block DJIKeyedSetCompletionBlock
typedef void (^DJIKeyedSetCompletionBlock)(NSError * _Nullable error)
Description:
The completion block called when performing a set on a key.
NSError * _Nullable error An optional error in case the call failed.
typedef block DJIKeyedActionCompletionBlock
typedef void (^DJIKeyedActionCompletionBlock)(BOOL finished, DJIKeyedValue * _Nullable response, NSError * _Nullable error)
Description:
The completion block called when performing an action on a key.
BOOL finished Whether or not the action finished. DJIKeyedValue * _Nullable response The optional response value of the action. NSError * _Nullable error The option error in case the call failed.
typedef block DJIKeyedListenerUpdateBlock
typedef void (^DJIKeyedListenerUpdateBlock)(DJIKeyedValue * _Nullable oldValue, DJIKeyedValue * _Nullable newValue)
Description:
The completion block, called every time the value behind a key is updated.
DJIKeyedValue * _Nullable oldValue The old value. nil
if no value was present before. DJIKeyedValue * _Nullable newValue The new value. nil
if the stored values are being flushed.