KTKDeviceConnection Class Reference

Inherits from NSObject
Declared in KTKDeviceConnection.h

Connection Properties

  nearbyDevice

A nearby device of this connection instance.

@property (nonatomic, strong, readonly) KTKNearbyDevice *nearbyDevice

Discussion

A nearby device of this connection instance.

Declared In

KTKDeviceConnection.h

  connectionTimeout

A timeout interval for the connection.

@property (nonatomic, assign, readwrite) NSTimeInterval connectionTimeout

Discussion

A timeout interval for the connection.

Declared In

KTKDeviceConnection.h

  connectionAttempts

A number of maxium connection attempts if one failed.

@property (nonatomic, assign, readwrite) NSUInteger connectionAttempts

Discussion

A number of maxium connection attempts if one failed.

Declared In

KTKDeviceConnection.h

  delegate

The delegate object that will receive events.

@property (nonatomic, weak, readwrite) id<KTKDeviceConnectionDelegate> delegate

Discussion

The delegate object that will receive events.

Declared In

KTKDeviceConnection.h

Configuration Profile Properties

  credentials

A credentails object to be forced over Cloud API credentials.

@property (nonatomic, copy, readwrite) KTKDeviceCredentials *credentials

Discussion

A credentails object to be forced over Cloud API credentials.

This property should be only used to connect to legacy devices (fw < 4.0) while offline or when using Credentials Config Profile Generator. In general devices with firmware >= 4.0 are not using password for the connection so this property will be ignored unless you set configProfileGenerator property to KTKConfigProfileGeneratorUsingCredentials. By default credentials are automatically fetched from the Cloud API just before the connection opertation. If connection to the device while offline is not required this property should be ignored.

If password is changed through KTKDeviceConfiguration on the device while in offline it must be stored and then synchronized to the cloud API when possible.

Declared In

KTKDeviceConnection.h

  configProfileGenerator

A preferred configuration profile packets generator.

@property (nonatomic, assign, readwrite) KTKConfigProfileGenerator configProfileGenerator

Discussion

A preferred configuration profile packets generator.

Declared In

KTKDeviceConnection.h

Other Properties

  executing

A Boolean value indicating whether the operation is currently executing.

@property (nonatomic, readonly, getter=isExecuting) BOOL executing

Discussion

A Boolean value indicating whether the operation is currently executing.

Declared In

KTKDeviceConnection.h

  keepAlive

A Boolean value indicating whether the connection to the device should be kept alive.

@property (nonatomic, readwrite, getter=isKeepAlive) BOOL keepAlive

Discussion

A Boolean value indicating whether the connection to the device should be kept alive.

If any operation is scheduled and keepAlive flag is set to YES this class will keep connection alive even after scheduled operation is completed. To close the connection you have to either call cancel method or change keepalive to NO and if no more operations are scheduled connection will be closed immediately.

Declared In

KTKDeviceConnection.h

  updateTimeAutomatically

A Boolean value indicating whether the devices rtc time should be updated automatically. Defaults to YES.

@property (nonatomic, readwrite, getter=isUpdateTimeAutomatically) BOOL updateTimeAutomatically

Discussion

A Boolean value indicating whether the devices rtc time should be updated automatically. Defaults to YES.

Declared In

KTKDeviceConnection.h

Static Methods

+ connectionOperationsCount

Returns number of all connection operations scheduled in internal connection queue.

+ (NSUInteger)connectionOperationsCount

Return Value

Number of all connection operations scheduled.

Discussion

Returns number of all connection operations scheduled in internal connection queue.

Declared In

KTKDeviceConnection.h

+ cancelAllOperations

Cancels all connection operations scheduled in internal connection queue.

+ (void)cancelAllOperations

Discussion

Cancels all connection operations scheduled in internal connection queue.

Declared In

KTKDeviceConnection.h

Initialization Methods

– initWithNearbyDevice:

Creates instance of KTKDeviceConnection with given KTKNearbyDevice

- (instancetype)initWithNearbyDevice:(KTKNearbyDevice *)nearbyDevice

Parameters

nearbyDevice

KTKNearbyDevice Object

Return Value

New instance of KTKDeviceConnection

Discussion

Creates instance of KTKDeviceConnection with given KTKNearbyDevice

Declared In

KTKDeviceConnection.h

Connection Methods

– writeConfiguration:completion:

Writes the specified configuration to the connection device.

- (void)writeConfiguration:(KTKDeviceConfiguration *)configuration completion:(KTKDeviceConnectionWriteCompletion)completion

Parameters

configuration

The configuration object to write.

completion

A block object to be executed when the write operation finishes.

Discussion

Writes the specified configuration to the connection device.

Declared In

KTKDeviceConnection.h

– readConfigurationWithCompletion:

Reads the configuration from the connection device.

- (void)readConfigurationWithCompletion:(KTKDeviceConnectionReadCompletion)completion

Parameters

completion

A block object to be executed when the read operation finishes.

Discussion

Reads the configuration from the connection device.

Declared In

KTKDeviceConnection.h

– syncTimeWithCompletion:

Send the current time to the connected device.

- (void)syncTimeWithCompletion:(void ( ^ ) ( NSError *_Nullable ))completion

Parameters

completion

A block object to be executed when the write operation finishes.

Discussion

Send the current time to the connected device.

Declared In

KTKDeviceConnection.h

– synchDeviceConfigurationWithCompletion:

Synch the token from the connection device.

- (void)synchDeviceConfigurationWithCompletion:(void ( ^ ) ( __kindof KTKDeviceConfiguration *_Nullable , NSString *firmware , NSError *_Nullable ))completion

Parameters

firmware

The version firmware object for update device

completion

A block object to be executed when the read operation finishes.

Discussion

Synch the token from the connection device.

Declared In

KTKDeviceConnection.h

– sensorsUpdatesWithBlock:

Listens for sensors updates from the connection device.

- (void)sensorsUpdatesWithBlock:(KTKDeviceConnectionSensorsUpdate)updateBlock

Parameters

updateBlock

A block object to be executed when the sensors values are update.

Discussion

Listens for sensors updates from the connection device.

Declared In

KTKDeviceConnection.h

– stopSensorsUpdates

Stops listening for sensors updates.

- (void)stopSensorsUpdates

Discussion

Stops listening for sensors updates.

Declared In

KTKDeviceConnection.h

– updateWithFirmware:progress:completion:

Updates a device to the latest available firmware.

- (void)updateWithFirmware:(KTKFirmware *)firmware progress:(void ( ^ ) ( double ))progress completion:(KTKDeviceConnectionUpdateCompletion)completion

Parameters

firmware

The firmware object you want to update device to. Has to be equal or grater than current firmware version.

progress

A block object to be executed when the progress of an update operation is recieved.

completion

A block object to be executed when the update operation finishes.

Discussion

Updates a device to the latest available firmware.

Declared In

KTKDeviceConnection.h

– getImage:completion:

Get image from a device.

- (void)getImage:(KTKKontaktImageType)type completion:(void ( ^ ) ( NSData *_Nullable , NSArray<KTKDeviceKontaktRecognitionBox*> *_Nullable , KTKDeviceConfiguration *_Nullable configuration , NSError *_Nullable ))completion

Parameters

type

The type object you want to update device to. Has to be equal or grater than current firmware version.

completion

A block object to be executed when the update operation finishes download configuration, image and error.

Discussion

Get image from a device.

Declared In

KTKDeviceConnection.h

– cancel

Cancels all operations on this connection.

- (void)cancel

Discussion

Cancels all operations on this connection.

Declared In

KTKDeviceConnection.h