0.3.0
0.3.0
- add a new helper class :babyRhythm which can helper user to monitor Operation
- ten new block about cancel sacn and disconnect peripheral and
//when Peripherals FailToConnect
-(void)setBlockOnFailToConnect:(void (^)(CBCentralManager *central,CBPeripheral *peripheral,NSError *error))block;
//when disconnected Peripherals
-(void)setBlockOnDisconnect:(void (^)(CBCentralManager *central,CBPeripheral *peripheral,NSError *error))block;
//when Peripherals FailToConnect
-(void)setBlockOnFailToConnectAtChannel:(NSString *)channel
block:(void (^)(CBCentralManager *central,CBPeripheral *peripheral,NSError *error))block;
//when disconnected Peripherals
-(void)setBlockOnDisconnectAtChannel:(NSString *)channel
block:(void (^)(CBCentralManager *central,CBPeripheral *peripheral,NSError *error))block;
/#pragma mark -babybluetooth Special
//after babyBluettooth cancelScan
-(void)setBlockOnCancelScanBlock:(void(^)(CBCentralManager *centralManager))block;
//after babyBluettooth cancelAllPeripheralsConnectionBlock
-(void)setBlockOnCancelAllPeripheralsConnectionBlock:(void(^)(CBCentralManager *centralManager))block;
//after babyBluettooth cancelPeripheralConnection
-(void)setBlockOnCancelPeripheralConnectionBlock:(void(^)(CBCentralManager *centralManager,CBPeripheral *peripheral))block;
//after babyBluettooth cancelScan方
-(void)setBlockOnCancelScanBlockAtChannel:(NSString *)channel
block:(void(^)(CBCentralManager *centralManager))block;
//after babyBluettooth cancelAllPeripheralsConnectionBlock
-(void)setBlockOnCancelAllPeripheralsConnectionBlockAtChannel:(NSString *)channel
block:(void(^)(CBCentralManager *centralManager))block;
//after babyBluettooth cancelPeripheralConnection
-(void)setBlockOnCancelPeripheralConnectionBlockAtChannel:(NSString *)channel
block:(void(^)(CBCentralManager *centralManager,CBPeripheral *peripheral))block;
- fix xcode7 waring
- simplify readme,move some content to wiki
- add runtime options for sacn,connect,discover service ...
//set runtime option
-(void)setBabyOptionsWithScanForPeripheralsWithOptions:(NSDictionary *) scanForPeripheralsWithOptions
connectPeripheralWithOptions:(NSDictionary *) connectPeripheralWithOptions
scanForPeripheralsWithServices:(NSArray *)scanForPeripheralsWithServices
discoverWithServices:(NSArray *)discoverWithServices
discoverWithCharacteristics:(NSArray *)discoverWithCharacteristics;
//set runtime option at channel
-(void)setBabyOptionsAtChannel:(NSString *)channel
scanForPeripheralsWithOptions:(NSDictionary *) scanForPeripheralsWithOptions
connectPeripheralWithOptions:(NSDictionary *) connectPeripheralWithOptions
scanForPeripheralsWithServices:(NSArray *)scanForPeripheralsWithServices
discoverWithServices:(NSArray *)discoverWithServices
discoverWithCharacteristics:(NSArray *)discoverWithCharacteristics;
exp:
/*set babyOptions
use in those function,if no option set nil
- [centralManager scanForPeripheralsWithServices:scanForPeripheralsWithServices options:scanForPeripheralsWithOptions];
- [centralManager connectPeripheral:peripheral options:connectPeripheralWithOptions];
- [peripheral discoverServices:discoverWithServices];
- [peripheral discoverCharacteristics:discoverWithCharacteristics forService:service];
at channel function:
[baby setBabyOptionsAtChannel:<#(NSString *)#> scanForPeripheralsWithOptions:<#(NSDictionary *)#> connectPeripheralWithOptions:<#(NSDictionary *)#> scanForPeripheralsWithServices:<#(NSArray *)#> discoverWithServices:<#(NSArray *)#> discoverWithCharacteristics:<#(NSArray *)#>]
*/
//sacnfor options->CBCentralManagerScanOptionAllowDuplicatesKey:忽略同一个Peripheral端的多个发现事件被聚合成一个发现事件
NSDictionary *scanForPeripheralsWithOptions = @{CBCentralManagerScanOptionAllowDuplicatesKey:@YES};
/*connect options-> only works in non-background model
CBConnectPeripheralOptionNotifyOnConnectionKey
CBConnectPeripheralOptionNotifyOnDisconnectionKey
CBConnectPeripheralOptionNotifyOnNotificationKey
*/
NSDictionary *connectOptions = @{CBConnectPeripheralOptionNotifyOnConnectionKey:@YES,
CBConnectPeripheralOptionNotifyOnDisconnectionKey:@YES,
CBConnectPeripheralOptionNotifyOnNotificationKey:@YES};
[baby setBabyOptionsAtChannel:channelOnPeropheralView scanForPeripheralsWithOptions:scanForPeripheralsWithOptions connectPeripheralWithOptions:connectOptions scanForPeripheralsWithServices:nil discoverWithServices:nil discoverWithCharacteristics:nil];