SITCommunicationManager Class Reference

Inherits from NSObject
Declared in SITCommunicationManager.h

Overview

This class is the interface to perform operations related with Situm Servers.

+ sharedManager

Call this method to receive a reference to an initialized object of this class

+ (instancetype)sharedManager

Return Value

The shared manager object. Initially, this method stablish a value of 24 hours as the CAHCE_MAX_AGE for the cache system.

Discussion

You should not try to initialize multiple objects of this class using alloc:init because it would result in unexpected behaviour.

Declared In

SITCommunicationManager.h

– cacheDate

Retrieve the time when data on cache was retrieved

- (NSDate *)cacheDate

Return Value

the date when the information was successfully fetched or nil if there is not cache.

Declared In

SITCommunicationManager.h

– setCacheMaxAge:

Establish the time when the stored data on cache expires

- (void)setCacheMaxAge:(NSInteger)cacheMaxAge

Parameters

cacheMaxAge

Integer value in seconds. If a negative value is inserted, a value of 0 will be established.

Declared In

SITCommunicationManager.h

– cacheMaxAge

Retrieve the value when the stored data on cache expires.

- (NSInteger)cacheMaxAge

Return Value

Integer value in seconds.

Declared In

SITCommunicationManager.h

– clearCache

Clear the contents of the cache for a particular user

- (void)clearCache

Declared In

SITCommunicationManager.h

– fetchCategoriesWithCompletion:

Retrieve the information of the available categories

- (BOOL)fetchCategoriesWithCompletion:(SITPOICategoriesFetchHandler)completion

Parameters

completion

the kind of block that will be performed after the operation has been completed. Declaration in SITCommunicationInterface

Return Value

BOOL value indicating if the operation will be performed or not

Declared In

SITCommunicationManager.h

– fetchCategoriesWithOptions:withCompletion:

Retrieve the information of the available categories

- (BOOL)fetchCategoriesWithOptions:(NSDictionary *)options withCompletion:(SITPOICategoriesFetchHandler)completion

Parameters

options

additional parameters to customize the internal operation of the method declared in SITCommunicationConstants.h

completion

the kind of block that will be performed after the operation has been completed

Return Value

BOOL value indicating if the operation will be performed or not

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchIndoorBuildingsWithCompletion:

Retrieve the buildings you are allowed to see. This is an asynchronous operation.

- (BOOL)fetchIndoorBuildingsWithCompletion:(SITBuildingFetchHandler)buildindFetchHandler

Parameters

buildindFetchHandler

This is the block which will be called after the operation has been completed.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchFloorsForBuilding:withOptions:success:failure:

Retrieve the list of floors associated with a building

- (NSError *)fetchFloorsForBuilding:(NSString *)buildingIdentifier withOptions:(NSDictionary *)options success:(SITSuccessHandler)success failure:(SITFailureCompletion)failure

Parameters

buildingIdentifier

unique identifier of the building

options

parameters that modify the internal behaviour

success

the kind of block that will be executed when the operation has successfully been performed

failure

the kind of block that will be executed when the operation fails

Return Value

error error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Discussion

Keys of the options dictionary: forceRequest boolean value that determines if the operation should hit the server (YES) or the cachesystem (NO)

Declared In

SITCommunicationManager.h

– fetchBuildingsWithOptions:success:failure:

Retrieve the list of buildings

- (NSError *)fetchBuildingsWithOptions:(NSDictionary *)options success:(SITSuccessHandler)success failure:(SITFailureCompletion)failure

Parameters

options

parameters that modify the internal behaviour

success

the kind of block that will be executed when the operation has successfully been performed. Information can be accessed through the results key on the mapping result dictionary

failure

the kind of block that will be executed when the operation fails with an error describing what has failed

Return Value

error error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Discussion

Keys of the options dictionary: forceRequest boolean value that determines if the operation should hit the server (YES) or the cachesystem (NO)

Declared In

SITCommunicationManager.h

– fetchPoisOfBuilding:withOptions:success:failure:

Retrieve the list of indoor points of interest associated with a building

- (NSError *)fetchPoisOfBuilding:(NSString *)buildingIdentifier withOptions:(NSDictionary *)options success:(SITSuccessHandler)success failure:(SITFailureCompletion)failure

Parameters

buildingIdentifier

unique identifier of the building

options

parameters that modify the internal behaviour (see discussion section)

success

the kind of block that will be executed when the operation has successfully been performed. Information can be accessed through the results key on the mapping result dictionary

failure

the kind of block that will be executed when the operation fails with an error describing what has failed

Return Value

error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Discussion

Keys of the options dictionary: forceRequest boolean value that determines if the operation should hit the server (YES) or the cachesystem (NO)

Declared In

SITCommunicationManager.h

– fetchOutdoorPoisOfBuilding:withOptions:success:failure:

Retrieve the list of outdoor points of interest associated with a building

- (NSError *)fetchOutdoorPoisOfBuilding:(NSString *)buildingIdentifier withOptions:(NSDictionary *)options success:(SITSuccessHandler)success failure:(SITFailureCompletion)failure

Parameters

buildingIdentifier

unique identifier of the building

options

parameters that modify the internal behaviour (see discussion section)

success

the kind of block that will be executed when the operation has successfully been performed. Information can be accessed through the results key on the mapping result dictionary

failure

the kind of block that will be executed when the operation fails with an error describing what has failed

Return Value

error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Discussion

Keys of the options dictionary: forceRequest boolean value that determines if the operation should hit the server (YES) or the cachesystem (NO)

Declared In

SITCommunicationManager.h

– fetchBuildingInfo:withOptions:success:failure:

Retrieve the information of a building.

- (NSError *)fetchBuildingInfo:(NSString *)buildingIdentifier withOptions:(NSDictionary *)options success:(SITSuccessHandler)success failure:(SITFailureCompletion)failure

Parameters

buildingIdentifier

unique identifier of the building.

options

parameters that modify the internal behaviour (see discussion section)

success

the kind of block that will be executed when the operation has successfully been performed. Information can be accessed through the results key on the mapping result dictionary

failure

failure the kind of block that will be executed when the operation fails with an error describing what has failed

Return Value

error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Discussion

Keys of the options dictionary: forceRequest boolean value that determines if the operation should hit the server (YES) or the cachesystem (NO)

Declared In

SITCommunicationManager.h

– fetchMapFromFloor:withCompletion:

Retrieve the floorplan of a floor

- (BOOL)fetchMapFromFloor:(SITFloor *)floor withCompletion:(SITImageFetchHandler)imageFetchHandler

Parameters

floor

SITFloor object

imageFetchHandler

the kind of block that will be executed when the operation has successfully been performed (a nil data would mean the operation has failed)

Return Value

error that describes why the operation could not be executed (a nil value means the request is valid and will be executed)

Declared In

SITCommunicationManager.h

– fetchIndoorBuildingsWithOptions:withCompletion:

Retrieve the buildings you are allowed to see. This is an asynchronous operation.

- (BOOL)fetchIndoorBuildingsWithOptions:(NSDictionary *)options withCompletion:(SITBuildingFetchHandler)buildindFetchHandler

Parameters

options

additional parameters to customize the internal operation of the method

buildindFetchHandler

buildindFetchHandler This is the block which will be called after the operation has been completed.

Return Value

This method gives the user a flag that indicates if the operation has been performed (YES) or not (NO).

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchIndoorLevelsFromIndoorBuilding:withCompletion:

Retrieve levels of a building.

- (BOOL)fetchIndoorLevelsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withCompletion:(SITIndoorLevelFetchHandler)indoorLevelFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

indoorLevelFetchHandler

SITIndoorLevelsFetchHandler handler.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchIndoorLevelsFromIndoorBuilding:withOptions:withCompletion:

Retrieve levels of a building.

- (BOOL)fetchIndoorLevelsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withOptions:(NSDictionary *)options withCompletion:(SITIndoorLevelFetchHandler)indoorLevelFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

options

additional parameters to customize the internal operation of the method

indoorLevelFetchHandler

SITIndoorLevelsFetchHandler handler.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchIndoorLevelMapFromIndoorLevel:withCompletion:

Retrieve the map of an indoor level of a building.

- (BOOL)fetchIndoorLevelMapFromIndoorLevel:(SITIndoorLevel *)indoorLevel withCompletion:(SITIndoorLevelMapFetchHandler)indoorLevelMapHandler

Parameters

indoorLevel

SITIndoorLevel object.

indoorLevelMapHandler

SITIndoorLevelMapFetchHandler handler.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchPOIsFromIndoorBuilding:withCompletion:

Retrieve POIs from a building.

- (BOOL)fetchPOIsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withCompletion:(SITPOIFetchHandler)POIFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

POIFetchHandler

SITPOIFetchHandler handler.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchPOIsFromIndoorBuilding:withOptions:withCompletion:

Retrieve POIs from a building.

- (BOOL)fetchPOIsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withOptions:(NSDictionary *)options withCompletion:(SITPOIFetchHandler)POIFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

options

additional parameters to customize the internal operation of the method

POIFetchHandler

SITPOIFetchHandler handler.

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey, SITCustomFiltersKey and SITKeyValueFilterMode. SITForceRequestKey: The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system. SITCustomFiltersKey: The value of this key is an array of objects of the class SITKeyValueFilter objects. AS a result, it will select only the POIs that meet those filters. SITKeyValueFilterMode: The value of this key is an NSNumber with values defined in the enum kSITKeyValueFilterBy. It expresses how to combine results from multiple filters.

Declared In

SITCommunicationManager.h

– fetchSelected:iconForCategory:withCompletion:

Retrieve the contents of an icon of a category

- (BOOL)fetchSelected:(BOOL)selected iconForCategory:(SITPOICategory *)category withCompletion:(SITPOICategoryIconFetchCompletion)completion

Parameters

selected

BOOL parameter indicating the kind of icon to retrieve (YES means the selected one, NO means the regular or normal one)

category

SITPOICategory object. Normally you do not instantiate objects of this class, instead you should use the one obtained by fetchCategoriesWithCompletion:

completion

the kind of callback that will be called after the operation has been completed

Return Value

BOOL value indicating if the operation is well formed and if it will be executed (YES) or not (NO)

Declared In

SITCommunicationManager.h

– filterPOIs:byIndoorLevel:

array of POIs retrieved with the fetchPOIsFromIndoorBuilding:withCompletion: method

- (NSArray *)filterPOIs:(NSArray *)POIs byIndoorLevel:(SITIndoorLevel *)indoorLevel

Parameters

POIs

array of POIs retrieved with the fetchPOIsFromIndoorBuilding:withCompletion: method

indoorLevel

SITIndoorLevel object

Return Value

An array with POIs filtered by the indoorLevel

Declared In

SITCommunicationManager.h

– filterPOIs:byCategory:byIndoorLevel:

This methods selects the POIs verifying certain conditions

- (NSArray *)filterPOIs:(NSArray *)POIs byCategory:(NSString *)category byIndoorLevel:(SITIndoorLevel *)indoorLevel

Parameters

POIs

original array of POIs (of the class SITPOI)

category

category name

indoorLevel

level

Return Value

array of POIs filtered by a category and a level

Discussion

In this method, if a category or a level is nil, then that parameter will not affect the result. This filter is case sensitive.

See Also

  • SITPOI to find the category name and level properties

Declared In

SITCommunicationManager.h

– fetchExteriorPOIsFromIndoorBuilding:withCompletion:

Retrieve Outdoor POIs from a building

- (BOOL)fetchExteriorPOIsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withCompletion:(SITExteriorPOIFetchHandler)exteriorPOIFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

exteriorPOIFetchHandler

SITExteriorPOIFetchHandler handler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchOutdoorPOIsFromIndoorBuilding:withOptions:withCompletion:

Retrieve Outdoor POIs from a building

- (BOOL)fetchOutdoorPOIsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withOptions:(NSDictionary *)options withCompletion:(SITExteriorPOIFetchHandler)exteriorPOIFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object.

options

additional parameters to customize the internal operation of the method

exteriorPOIFetchHandler

SITExteriorPOIFetchHandler handler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey, SITCustomFiltersKey and SITKeyValueFilterMode. SITForceRequestKey: The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system. SITCustomFiltersKey: The value of this key is an array of objects of the class SITKeyValueFilter objects. AS a result, it will select only the POIs that meet those filters. SITKeyValueFilterMode: The value of this key is an NSNumber with values defined in the enum kSITKeyValueFilterBy. It expresses how to combine results from multiple filters.

Declared In

SITCommunicationManager.h

– fetchGraphFromIndoorBuilding:withCompletion:

Retrieve the graph of a SITIndoorBuilding

- (BOOL)fetchGraphFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withCompletion:(SITGraphFetchHandler)graphFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object

graphFetchHandler

SITGraphFetchHandler handler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

You can use the SITGraph object returned on successful operations to compute routes between two SITIndoorPoint ’s of a SITIndoorBuilding

Declared In

SITCommunicationManager.h

– fetchGraphFromIndoorBuilding:withOptions:withCompletion:

Retrieve the graph of a SITIndoorBuilding

- (BOOL)fetchGraphFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withOptions:(NSDictionary *)options withCompletion:(SITGraphFetchHandler)graphFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object

options

additional parameters to customize the internal operation of the method

graphFetchHandler

SITGraphFetchHandler handler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

You can use the SITGraph object returned on successful operations to compute routes between two SITIndoorPoint ’s of a SITIndoorBuilding

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchEventsFromIndoorBuilding:withCompletion:

Retrieve the events of a SITIndoorBuilding

- (BOOL)fetchEventsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withCompletion:(SITEventsFetchHandler)eventsFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object

eventsFetchHandler

SITEventsFetchHandler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Declared In

SITCommunicationManager.h

– fetchEventsFromIndoorBuilding:withOptions:withCompletion:

Retrieve the events of a SITIndoorBuilding

- (BOOL)fetchEventsFromIndoorBuilding:(SITIndoorBuilding *)indoorBuilding withOptions:(NSDictionary *)options withCompletion:(SITEventsFetchHandler)eventsFetchHandler

Parameters

indoorBuilding

SITIndoorBuilding object

options

additional parameters to customize the internal operation of the method

eventsFetchHandler

SITEventsFetchHandler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchEventsFromBuilding:withOptions:withCompletion:

Retrieve the events of a SITBuilding

- (BOOL)fetchEventsFromBuilding:(SITBuilding *)building withOptions:(NSDictionary *)options withCompletion:(SITHandler ( ^ ) ( NSArray<SITEvent*> *result , NSError *error ))completion

Parameters

building

SITBuilding object

options

additional parameters to customize the internal operation of the method

completion

SITHandler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– fetchEventsFromBuilding:withCompletion:

Retrieve the events of a SITBuilding

- (BOOL)fetchEventsFromBuilding:(SITBuilding *)building withCompletion:(SITHandler ( ^ ) ( NSArray<SITEvent*> *result , NSError *error ))completion

Parameters

building

SITBuilding object

completion

SITHandler

Return Value

This method gives the user a flag that indicates if the operation has been performed or not.

Discussion

Valid options for this method are: SITForceRequestKey. The value of this key is a NSNumber with a bool value on it. The value of YES means that the request will be directed to the network system directly without checking the cache system. The value of NO means the request will be directed to the cache system and if not found it will be redirected to the network system.

Declared In

SITCommunicationManager.h

– loginWithUser:password:withCompletion:

Authenticate with user and password

- (BOOL)loginWithUser:(NSString *)user password:(NSString *)password withCompletion:(SITLoginHandler)loginHandler

Parameters

user

email of the user

password

password of the user

loginHandler

completion block that will be executed if the operation is performed

Discussion

This method needs to be called before performing any other network operation in order to validate the credentials. Otherwise the operations could failed with a 401 error code. Before attempting to connect with different credentials remeber to disconnect to the actual session performing a logoutWithCompletion: operation.

Declared In

SITCommunicationManager.h

– logoutWithCompletion:

Disconnect and clear previous session credentials

- (BOOL)logoutWithCompletion:(SITLogoutHandler)logoutHandler

Parameters

logoutHandler

completion block that will be executed if the operation if performed.

Declared In

SITCommunicationManager.h

– pushCalibrationsForFloorIdentifier:filesAtPaths:withCompletion:

Update calibrations made with the example application

- (BOOL)pushCalibrationsForFloorIdentifier:(NSInteger)indoorLevelIdentifier filesAtPaths:(NSArray *)paths withCompletion:(SITCalibrationsPushHandler)calibrationsPushHandler

Parameters

indoorLevelIdentifier

Identifier of the SITIndoorLevel object

paths

Paths of the files upload as bulk for the indoorLevelIdentifier level

calibrationsPushHandler

SITCalibrationsPushHandler object.

Return Value

This method returns a bool value indicating wheter the operation was executed or not.

Discussion

This method is restricted to private use.

Declared In

SITCommunicationManager.h

– updateOccurrence:forEvent:withSuccess:failure:

Update an occurrence

- (BOOL)updateOccurrence:(nonnull SITOccurrence *)occurrence forEvent:(kSITOccurrenceAction)action withSuccess:(nonnull SITOccurrenceCompletion)successCompletion failure:(nonnull SITErrorCompletion)errorCompletion

Parameters

occurrence

occurrence to update

successCompletion

the kind of block that gets performed when a success occurs

errorCompletion

the kind of block that gets performed when a failure occurs

Return Value

BOOL value indicating if the operation gets performed (YES) or not (NO)

Declared In

SITCommunicationManager.h