PTDBeanDelegate Protocol Reference
Conforms to | PTDBleDeviceDelegate |
---|---|
Declared in | PTDBean.h |
Overview
Delegates of a PTDBean object should implement this protocol. See BeanXcodeWorkspace for more examples.
– bean:error:
Send when a generic Bean related errors occurs. This is usually called when invalid parameters are passed to Bean methods.
- (void)bean:(PTDBean *)bean error:(NSError *)error
Parameters
bean |
The bean that caused or is related to the error. |
---|---|
error |
Refer to BeanErrors for the list of error codes |
Discussion
if (error.code == BeanErrors_InvalidArgument) { NSLog(@“Invalid argument - %@”, [error localizedDescription]); }
Declared In
PTDBean.h
– beanDidUpdateArduinoPowerState:
Sent in response when a Bean’s ArduinoPowerState has been requested.
- (void)beanDidUpdateArduinoPowerState:(PTDBean *)bean
Parameters
bean |
The Bean whose ArduinoPowerState has been requested. |
---|
Declared In
PTDBean.h
– bean:didProgramArduinoWithError:
Sent when a Bean has finished programming it’s Arduino. The programming process was successful when error is nil.
- (void)bean:(PTDBean *)bean didProgramArduinoWithError:(NSError *)error
Parameters
bean |
The Bean whose Arduino has been programmed. |
---|---|
error |
Nil if successful, or an NSError if the programming was unsuccessful. See BeanErrors. |
Declared In
PTDBean.h
– bean:ArduinoProgrammingTimeLeft:withPercentage:
Time remaining until the Arduino is finished programming, and percentage of the process is complete.
- (void)bean:(PTDBean *)bean ArduinoProgrammingTimeLeft:(NSNumber *)seconds withPercentage:(NSNumber *)percentageComplete
Parameters
bean |
The Bean being programmed |
---|---|
seconds |
The remaining number of seconds in the programming process |
percentageComplete |
The completion percentage of the programming process, from 0.0 to 1.0. |
Declared In
PTDBean.h
– bean:serialDataReceived:
Serial data received from a Bean
- (void)bean:(PTDBean *)bean serialDataReceived:(NSData *)data
Parameters
bean |
The Bean we’re receiving serial data from |
---|---|
data |
The data received from the Bean |
Declared In
PTDBean.h
– bean:didUpdateLedColor:
Sent in response when a Bean’s LED values are requested
- (void)bean:(PTDBean *)bean didUpdateLedColor:(UIColor *)color
Parameters
bean |
The Bean whose LED color has been requested |
---|---|
color |
The Bean’s LED color. Alpha channel is always 1. |
See Also
Declared In
PTDBean.h
– bean:didUpdateAccelerationAxes:
Sent in response when a Bean’s accelerometer readings are requested
- (void)bean:(PTDBean *)bean didUpdateAccelerationAxes:(PTDAcceleration)acceleration
Parameters
bean |
the Bean being queried |
---|---|
acceleration |
A typedef struct { double x; double y; double z; } PTDAcceleration; |
See Also
Declared In
PTDBean.h
– beanDidUpdateRSSI:error:
Sent in response when a Bean’s RSSI is requested
- (void)beanDidUpdateRSSI:(PTDBean *)bean error:(NSError *)error
Parameters
bean |
The Bean whose RSSI data has been requested. |
---|---|
error |
Nil if successful, or an NSError if the reading was unsuccessful. See BeanErrors. |
Declared In
PTDBean.h
– bean:didUpdateTemperature:
Sent in response when a Bean’s temperature is requested
- (void)bean:(PTDBean *)bean didUpdateTemperature:(NSNumber *)degrees_celsius
Parameters
bean |
The Bean whose temperature data has been requested. |
---|---|
degrees_celsius |
The ambient temperature in degrees Celsius |
See Also
Declared In
PTDBean.h
– beanDidUpdateBatteryVoltage:error:
Sent in response when a Bean’s battery or power supply voltage is requested
- (void)beanDidUpdateBatteryVoltage:(PTDBean *)bean error:(NSError *)error
Parameters
bean |
The Bean whose battery or power supply voltage has been requested |
---|---|
error |
Nil if successful, or an NSError if the reading was unsuccessful. See BeanErrors. |
See Also
Declared In
PTDBean.h
– bean:didUpdateRadioConfig:
Sent in response when a Bean’s PTDBeanRadioConfig is requested.
- (void)bean:(PTDBean *)bean didUpdateRadioConfig:(PTDBeanRadioConfig *)config
Parameters
bean |
The Bean whose PTDBeanRadioConfig has been requested |
---|---|
config |
The radio configuration of the bean, see PTDBeanRadioConfig for more details. |
See Also
Declared In
PTDBean.h
– bean:didUpdateScratchBank:data:
Sent in response when a Bean’s scratch bank data is requested.
- (void)bean:(PTDBean *)bean didUpdateScratchBank:(NSInteger)bank data:(NSData *)data
Parameters
bean |
The Bean whose scratch bank data has been requested. |
---|---|
bank |
The index of the scratch bank to store data, from 1 to 5. |
data |
Data to be stored in the selected bank. Can be up to 20 bytes. |
Declared In
PTDBean.h
– bean:didUpdateSketchName:dateProgrammed:crc32:
Sent in response when information about a Bean’s Arduino sketch is requested
- (void)bean:(PTDBean *)bean didUpdateSketchName:(NSString *)name dateProgrammed:(NSDate *)date crc32:(UInt32)crc
Parameters
bean |
The Bean whose sketch info has been requested. |
---|---|
name |
The name of the currently programmed sketch |
date |
The date the sketch was programmed |
crc |
The CRC32 of the programmed sketch |
See Also
Declared In
PTDBean.h
– beanFoundWithIncompleteFirmware:
Sent to alert that the firmware update process is incomplete.
- (void)beanFoundWithIncompleteFirmware:(PTDBean *)bean
Parameters
bean |
The Bean whose firmware was found incomplete. |
---|
Declared In
PTDBean.h
– bean:bluetoothError:
A serious error has occurred that Bean can’t resolve. The client must resolve this issue.
- (void)bean:(PTDBean *)bean bluetoothError:(BeanBluetoothError)error
Parameters
bean |
The Bean that encountered this issue |
---|---|
bluetoothError |
a BeanBluetoothError indicating what went wrong |
Declared In
PTDBean.h