Diffusion Apple API  6.3.3
Unified Client Library for iOS, tvOS and OS X / macOS
 All Classes Functions Variables Properties Pages
Instance Methods | List of all members
PTDiffusionNumberValueUpdater Class Reference


A number value updater may be used to update numeric topics by specifying new values as NSNumber objects.

See Also
Since 6.3. This class will be removed in a future release. It has been replaced by PTDiffusionNumberUpdateStream which is accessed using PTDiffusionTopicUpdateFeature, providing equivalent and additional functionality such as conditional updates.
Inheritance diagram for PTDiffusionNumberValueUpdater:

Instance Methods

(BOOL) - getCachedValue:forTopicPath:error:
(void) - updateWithTopicPath:value:completionHandler:
- Instance Methods inherited from PTDiffusionValueUpdater
(instancetype) - NS_UNAVAILABLE
(void) - removeCachedValuesWithTopicSelector:
(void) - removeCachedValuesWithSelectorExpression:

Additional Inherited Members

- Class Methods inherited from PTDiffusionValueUpdater
(instancetype) + NS_UNAVAILABLE

Method Documentation

- (BOOL) getCachedValue: (NSNumber *_Nullable *_Nonnull)  value
forTopicPath: (NSString *)  topicPath
error: (NSError **)  error 

Returns the current cached value for a given topic path.

valueOn successful return then set to the current cached value or nil if there is no value for the given path. There may be no value because no value has yet been sent, the value has been removed from the cache or the value has been explicitly set to nil by a preceding update.
topicPathSpecifies the topic to obtain the current value for.
errorIf an error occurs, upon return contains an NSError object that describes the problem.
YES if there is no cached value for the given topic path or if the cached entry for the given topic path is of the correct type. In either of these cases the value will be assigned appropriately. Otherwise this method returns NO and error will be assigned with a failure reason.
NSInvalidArgumentExceptionIf either of the value or topicPath arguments are nil.
- (void) updateWithTopicPath: (NSString *)  topicPath
value: (nullable NSNumber *)  value
completionHandler: (NSError *_Nullable error)  completionHandler 

Updates a topic to a specified value.

For exclusive updating, this method caches the supplied value so that subsequent calls for the same topic will be able to use the current value to calculate deltas of change to send to the server rather than having to send the whole value.

For non-exclusive updating, the complete value is always sent to the server and the value is not cached.

topicPathSpecifies the topic to be updated.
valueThe new value for the topic or nil to set to 'no value' (null).
completionHandlerBlock to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil. The completion handler will be called asynchronously on the main dispatch queue.
NSInvalidArgumentExceptionIf either of the topicPath or completionHandler arguments are nil.