PTDBeanManagerDelegate Protocol Reference

Conforms to NSObject
Declared in PTDBeanManager.h

Overview

Delegates of a PTDBeanManager object should implement this protocol. See BeanXcodeWorkspace for more examples.

– beanManagerDidUpdateState:

The BeanManager’s BeanManagerState has been updated. This method will also be called when Bluetooth is enabled or disabled.

- (void)beanManagerDidUpdateState:(PTDBeanManager *)beanManager

Parameters

beanManager

the BeanManager whose state was updated

Discussion

 Example:
 - (void)beanManagerDidUpdateState:(PTDBeanManager *)manager{
   // if manager is powered on, start scanning
   if(self.beanManager.state == BeanManagerState_PoweredOn){
     [self.beanManager startScanningForBeans_error:nil];
   }
   else if (self.beanManager.state == BeanManagerState_PoweredOff) {
     // do something else
   }
 }

Declared In

PTDBeanManager.h

– beanManager:didDiscoverBean:error:

An advertising Bean was discovered.

- (void)beanManager:(PTDBeanManager *)beanManager didDiscoverBean:(PTDBean *)bean error:(NSError *)error

Parameters

beanManager

The BeanManager scanning for advertising beans

bean

The Bean that was discovered

error

Not implemented yet

Discussion

Example:
// Manager letting us know a Bean was discovered
- (void)beanManager:(PTDBeanManager*)beanManager didDiscoverBean:(PTDBean*)bean error:(NSError*)error{
    NSError* connectError;
    [self.beanManager connectToBean:bean error:&connectError];
    if (connectError) {
      NSLog(@"%@", [connectError localizedDescription]);
    }
}

Declared In

PTDBeanManager.h

– beanManager:didConnectBean:error:

A Bean was connected

- (void)beanManager:(PTDBeanManager *)beanManager didConnectBean:(PTDBean *)bean error:(NSError *)error

Parameters

beanManager

The BeanManager that connected to an advertising beans

bean

The Bean that was connected

error

This error is passed through from centralManager:didFailToConnectPeripheral:error:

Declared In

PTDBeanManager.h

– beanManager:didDisconnectBean:error:

A Bean was disconnected

- (void)beanManager:(PTDBeanManager *)beanManager didDisconnectBean:(PTDBean *)bean error:(NSError *)error

Parameters

beanManager

The BeanManager that lost connection with the Bean

bean

The Bean that was disconnect

error

This error is passed through from centralManager:didDisconnectPeripheral:error:

Declared In

PTDBeanManager.h