UHNBLEControllerDelegate Protocol Reference

Conforms to NSObject
Declared in UHNBLEController.h

Overview

The UHNBLEControllerDelegate protocol defines the methods that a delegate of a UHNBLEController object must adopt. The optional methods of the protocol allow the delegate to monitor the discovery and connectivity of peripheral devices. The required methods of the protocol indicates discovery, connectivity, and read/write request with the peripheral device.

– bleController:didDiscoverPeripheral:services:RSSI: required method

Notifies the delegate when a peripheral has been discovered

- (void)bleController:(UHNBLEController *)controller didDiscoverPeripheral:(NSString *)deviceName services:(NSArray *)serviceUUIDs RSSI:(NSNumber *)RSSI

Parameters

controller

The UHNBLEController that discovered the peripheral

deviceName

The device name of the peripheral

serviceUUIDs

An array of NSString representing the UUID of the services available for the peripheral. This array includes all the provided required services and potentially additional services.

RSSI

The rssi power of the peripheral

Discussion

This method is invoked when a peripheral with the required services is discovered. If required services were provided during instantiation, the only peripherals with all of those services will be notified to the delegate. If no required services were provided, all discovered peripherals will be notified to the delegate.

Declared In

UHNBLEController.h

– bleController:didDisconnectFromPeripheral: required method

Notifies the delegate when a peripheral was disconnected

- (void)bleController:(UHNBLEController *)controller didDisconnectFromPeripheral:(NSString *)deviceName

Parameters

controller

The UHNBLEController that was managing the peripheral

deviceName

The device name of the peripheral

Discussion

This method is invoked when a peripheral is disconnected

Declared In

UHNBLEController.h

– bleController:failedToConnectWithPeripheral:

Notifies the delegate when a peripheral failed to connect

- (void)bleController:(UHNBLEController *)controller failedToConnectWithPeripheral:(NSString *)deviceName

Parameters

controller

The UHNBLEController that discovered the peripheral

deviceName

The device name of the peripheral

Discussion

This method is invoked when a peripheral failed to connect

Declared In

UHNBLEController.h

– bleController:didUpdateNotificationState:forCharacteristic:

Notifies the delegate when the peripheral did update a characteristic notification state

- (void)bleController:(UHNBLEController *)controller didUpdateNotificationState:(BOOL)notify forCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

notify

The current state of the characteristic notification/indication

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when the peripheral successfully updated the notification state of a characteristic

Declared In

UHNBLEController.h

– bleController:didWriteValue:toCharacteristic:

Notifies the delegate when the peripheral did complete a successful write to a characteristic

- (void)bleController:(UHNBLEController *)controller didWriteValue:(NSData *)value toCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

value

The value that was written to the characteristic

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when a value was successfully written to a characteristic

Declared In

UHNBLEController.h

– bleController:didUpdateValue:forCharacteristic:

Notifies the delegate when the peripheral did update the value of a characteristic (either read or notified/indicated)

- (void)bleController:(UHNBLEController *)controller didUpdateValue:(NSData *)value forCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

value

The value that was written to the characteristic

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when a value was successfully updated for a characteristic. Values are updated with either reads or notifications/indications

Declared In

UHNBLEController.h

– bleController:didConnectWithPeripheral:withUUID:

Notifies the delegate when a peripheral did connect

- (void)bleController:(UHNBLEController *)controller didConnectWithPeripheral:(NSString *)deviceName withUUID:(NSUUID *)uuid

Parameters

controller

The UHNBLEController that is managing the peripheral

deviceName

The device name of the peripheral

uuid

A NSUUID with the uuid of the peripheral

Discussion

This method is invoked when the peripheral is connected

Declared In

UHNBLEController.h

– bleController:didConnectWithPeripheral:withServices:andUUID:

Notifies the delegate when a peripheral did connect

- (void)bleController:(UHNBLEController *)controller didConnectWithPeripheral:(NSString *)deviceName withServices:(NSArray *)serviceUUIDs andUUID:(NSUUID *)uuid

Parameters

controller

The UHNBLEController that is managing the peripheral

deviceName

The device name of the peripheral

serviceUUIDs

An array of NSString representing the UUID of the services available for the peripheral. This array includes all the provided required services and potentially additional services.

uuid

A NSUUID with the uuid of the peripheral

Discussion

This method is invoked if required services were provided during instantiation after the discovery of the required services. If this method is invoked, it indicates that a request to discover all charactieristic for the required services has been initiated.

Declared In

UHNBLEController.h

– bleController:didDiscoverServices:

Notifies the delegate when services were discovered for the peripheral

- (void)bleController:(UHNBLEController *)controller didDiscoverServices:(NSArray *)serviceUUIDs

Parameters

controller

The UHNBLEController that is managing the peripheral

serviceUUIDs

An array of NSString representing the UUID of the services available for the peripheral.

Discussion

This method is invoked when services were discovered for the peripheral

Declared In

UHNBLEController.h

– bleController:didDiscoverCharacteristics:forService:

Notifies the delegate when characteristics were discovered for the peripheral

- (void)bleController:(UHNBLEController *)controller didDiscoverCharacteristics:(NSArray *)characteristicUUIDs forService:(NSString *)serviceUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

characteristicUUIDs

An array of NSString representing the characteristic UUIDs

serviceUUID

A NSString representing the UUID of the service

Discussion

This method is invoked when characteristics were discovered for the peripheral. If required services are provided with instantiation of the UHNBLEController, it is suggested to start making requests with the connected peripheral after the [UHNBLEControllerDelegate bleController:didDiscoverCharacteristics:forService:] event is received.

Declared In

UHNBLEController.h

– bleController:serviceNotAvailable:

Notifies the delegate when the requested service is not available for the peripheral

- (void)bleController:(UHNBLEController *)controller serviceNotAvailable:(NSString *)serviceUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

serviceUUID

A NSString representing the UUID of the service

Discussion

This method is invoked when a requested service has not been discovered or is not available in the peripheral

Declared In

UHNBLEController.h

– bleController:characteristicNotAvailable:

Notifies the delegate when the requested characteristic is not available for the peripheral

- (void)bleController:(UHNBLEController *)controller characteristicNotAvailable:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when a requested characteristic has not been discovered or is not available in the peripheral

Declared In

UHNBLEController.h

– bleController:failedWriteToCharacteristic:

Notifies the delegate when a write to characteristic request failed

- (void)bleController:(UHNBLEController *)controller failedWriteToCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when the peripheral failed to write to a characteristic

Declared In

UHNBLEController.h

– bleController:failedReadOfCharacteristic:

Notifies the delegate when a read from characteristic request failed

- (void)bleController:(UHNBLEController *)controller failedReadOfCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when the peripheral failed to read a characteristic

Declared In

UHNBLEController.h

– bleController:failedNotificationUpdateToCharacteristic:

Notifies the delegate when a update notification state request failed

- (void)bleController:(UHNBLEController *)controller failedNotificationUpdateToCharacteristic:(NSString *)characteristicUUID

Parameters

controller

The UHNBLEController that is managing the peripheral

characteristicUUID

A NSString representing the UUID of the characteristic

Discussion

This method is invoked when the peripheral failed to update the notification state of a characteristic

Declared In

UHNBLEController.h

– bleControllerPairingFailed:

Notifies the delegate when pairing failed

- (void)bleControllerPairingFailed:(UHNBLEController *)controller

Parameters

controller

The UHNBLEController that is managing the peripheral

Discussion

This method is invoked after making a request to the peripheral, but the request failed due to pairing issues.

Declared In

UHNBLEController.h