Inherits from NSObject
Declared in CCHSensorPipeline.h
CCHSensorPipeline.m

Overview

The CCHSensorPipeline monitors events as they are triggered. You can use the CCHSensorPipeline to gain access to the events before and after they are sent to the server. The CCHSensorPipelineDelegate and CCHSensorPipelineDataSource give you the ability to filter events and add custom data to events before they are sent to the ContextHub server. As events are triggered on the device, the framework will assemble a context dictionary that includes data about the event. The CCHSensorPipeline will call datasource and delegate life cycle methods and post lifecycle notifications.

Notifications

The following life cycle notifications are posted. The notifications are called before the associated delegate methods are called.

CCHSensorPipelineDidDetectEvent

The object is the assembled context event. The userInfo object is not set.

CCHSensorPipelineWillPostEvent

The object is the assembled context event. The userInfo object is not set.

CCHSensorPipelineDidPostEvent

The object is the assembled context event. The userInfo object is not set.

CCHSensorPipelineDidCancelEvent

The object is the assembled context event. The userInfo object is not set.

Properties

dataSource

@property (nonatomic, strong) id<CCHSensorPipelineDataSource> dataSource

Declared In

CCHSensorPipeline.h

delegate

@property (nonatomic, strong) id<CCHSensorPipelineDelegate> delegate

Declared In

CCHSensorPipeline.h

monitoredRegions

Returns the set of geofences that are considered significant based on the devices context. It contains a subset of all regions that are being monitored.

@property (nonatomic, readonly) NSSet *monitoredRegions

Declared In

CCHSensorPipeline.h

Class Methods

sharedInstance

Returns the singleton instanace of the CCHSensorPipeline

+ (instancetype)sharedInstance

Declared In

CCHSensorPipeline.h

Instance Methods

addElementsWithTags:

To enable automatic region monitoring for geofences and iBeacons you must add the tags of the elements to the sensor pipeline.

- (BOOL)addElementsWithTags:(NSArray *)tags

Parameters

tags

The tags of the elements that you want to monitor.

Return Value

Returns A boolean indicating that the tags were added successfully.

Declared In

CCHSensorPipeline.h

elementTags

Returns an array of the tags that the pipeline is tracking.

- (NSArray *)elementTags

Return Value

Returns an array of the tags that the pipeline is tracking.

Declared In

CCHSensorPipeline.h

removeElementsWithTags:

To disable automatic region monitoring for geofences and beacons, you must remove the tags from the sensor pipeline.

- (BOOL)removeElementsWithTags:(NSArray *)tags

Parameters

tags

The tags of the elements that you want to stop monitoring.

Return Value

Returns A boolean indicating that the tags were removed successfully.

Declared In

CCHSensorPipeline.h

synchronize:

Calling synchronize will tell the SDK to check for server-side context changes and will update monitored regions. The method gives you a way to load new context information if you are not using background push notifications.

- (void)synchronize:(void ( ^ ) ( NSError *error ))completionHandler

Parameters

completionHandler

(optional) Called when the synchronization completes. If an error occurs, the NSError will be passed to the block.

Declared In

CCHSensorPipeline.h

triggerEvent:completionHandler:

This method give you the ability to trigger custom events on the ContextHub sensor pipeline

- (void)triggerEvent:(NSDictionary *)event completionHandler:(void ( ^ ) ( NSError *error ))completionHandler

Parameters

event

The event that you want to send to the server.

completionHandler

(optional) Called when the event is created. If an error occurs, the NSError will be passed to the block.

Discussion

Note: The event must contain a name key. If you want to pass contextual information along with the event, you can do so by setting a data key for the event.

Declared In

CCHSensorPipeline.h