Conforms to NSObject
Declared in LEDevice.h

Overview

Implement this protocol to be notified about changes to the attributes of the device. The delegate will notify you when an IO such as a motor or sensor is attached or detached from the Device. The delegate will also notify about changes to the device name, battery level and the connect-button state (pressed/released).

Instance Methods

device:didAddService:

Invoked when the a new motor, sensor or other service is attached to the device (Hub).

- (void)device:(LEDevice *)device didAddService:(LEService *)service

Parameters

device

The device

service

The attached service

Discussion

Invoked when the a new motor, sensor or other service is attached to the device (Hub).

Before using the LEService you may check whether the LEService is an instance of one of the known service types, such as LEMotor, LETiltSensor or LEMotionSensor just to mention a few. This will allow you to use a ‘safer’ and more convenient interface to address the underlying IO.

Declared In

LEDevice.h

device:didChangeButtonState:

Invoked when the user press or release the connect-button on the device

- (void)device:(LEDevice *)device didChangeButtonState:(BOOL)pressed

Parameters

device

The device

pressed

YES if the button is pressed, NO otherwise.

Discussion

Invoked when the user press or release the connect-button on the device

Declared In

LEDevice.h

device:didChangeNameFrom:to:

Invoked if the device sends an updated device name.

- (void)device:(LEDevice *)device didChangeNameFrom:(NSString *)oldName to:(NSString *)newName

Parameters

device

The device

oldName

The previous name of the device

newName

The new name of the device

Discussion

Invoked if the device sends an updated device name.

Declared In

LEDevice.h

device:didFailToAddServiceWithError:

Invoked when an update from the device about attached services (sensor, motors, etc) could not be understood.

- (void)device:(LEDevice *)device didFailToAddServiceWithError:(NSError *)error

Parameters

device

The device

error

The cause of the failure.

Discussion

Invoked when an update from the device about attached services (sensor, motors, etc) could not be understood.

Declared In

LEDevice.h

device:didRemoveService:

Invoked when a new motor, sensor or other service is detached from the device (Hub).

- (void)device:(LEDevice *)device didRemoveService:(LEService *)service

Parameters

device

The device

service

The detached service

Discussion

Invoked when a new motor, sensor or other service is detached from the device (Hub).

Declared In

LEDevice.h

device:didUpdateBatteryLevel:

Invoked when a device sends an updated battery level.

- (void)device:(LEDevice *)device didUpdateBatteryLevel:(NSNumber *)newLevel

Parameters

device

The device

newLevel

The new battery level as a number between 0 and 100.

Discussion

Invoked when a device sends an updated battery level.

Declared In

LEDevice.h

device:didUpdateDeviceInfo:error:

Invoked when a new LEDeviceInfo with info about the software and firmware revision is received from the device.

- (void)device:(LEDevice *)device didUpdateDeviceInfo:(LEDeviceInfo *)deviceInfo error:(NSError *)error

Parameters

device

The device

deviceInfo

Info about software and firmware revision of the device

error

If an error occurred, the cause of the failure.

Discussion

Invoked when a new LEDeviceInfo with info about the software and firmware revision is received from the device.

Declared In

LEDevice.h

device:didUpdateLowVoltageState:

Invoked when a device sends a low voltage notification.

- (void)device:(LEDevice *)device didUpdateLowVoltageState:(BOOL)lowVoltage

Parameters

device

The device.

lowVoltage

YES if the battery has ‘low voltage’, false otherwise.

Discussion

Invoked when a device sends a low voltage notification.

Declared In

LEDevice.h