-
Notifications
You must be signed in to change notification settings - Fork 1k
temp
====================== 添加一个定时读取rssi的方法 ====================== 添加一个返回所有ble事件的错误的委托,并打印错误信息
====================== 修改filterblock的参数,把外设添加进去 ====================== 添加一个尝试重连设备的委托,对设备重连功能进行进一步的扩展。 ======================= 修改链式方法为command模式 ====================== 支持swift,Android,js,react-native
====================== 添加一个尝试重连设备的委托,对设备重连功能进行进一步的扩展。 =======================增加一个和检验工具方法http://www.jianshu.com/p/a5e25206df39 =======================优化app demo,从工程中分离出去 ,添加ui,点击进入教程,github蓝牙库 =======================用断言优化babybluetooth链式方法调用顺序的检查 =======================初始化CBCentralManager指定queue方法,注意是否可以再次初始化重新制定运行线程。 =======================添加定时阅读rssi的方法 =======================增加对复杂操作的支持 =======================对象改名方案 Babyblahblahblah
当一系列操作后执行的方法
//方法声明
-(void)until:(void (^)())step
then:(void(^)(CBCentralManager *manager,CBPeripheral *peripheral))then;
-(void)until:(void (^)())step
step:(void (^)())step;
//方法调用
[baby
until:^() {
//获取characteristic
fetchC(characteristicc1,"ff01");
//characteristic write操作
writeC(characteristicc1,"ff01");
writeC(characteristicc2,characteristicc1);
//检查是否写成功,默认write就会检查是否写成功
ckeckValueEqual(characteristicc1,characteristicc2);
//check Block检查
}
then:^(CBCentralManager *manager,CBPeripheral *peripheral) {
//do when step done
notity(c3,c4,onBlock());
}
];
[baby until:^{
//
} step:^{
//
} then:^(CBCentralManager *manager, CBPeripheral *peripheral) {
}];
//#warning 测试数据
////个性化,读取设备养护数据
//-(void)readPlantAssistantData{
// //写入当前系统时间
//
// CBCharacteristic *currentTime = [BabyToy findCharacteristicFormServices:self.services UUIDString:@"FFA8"];
//
// if (currentTime) {
// NSMutableData *data = [NSMutableData data];
// NSDateFormatter *df = [[NSDateFormatter alloc]init];
// [df setDateFormat:@"yyyy/MM/dd/hh/mm"];
// NSArray *dateArray = df stringFromDate:[NSDate date componentsSeparatedByString:@"/"];
// for (NSString *item in dateArray) {
// int intItem = [item intValue];
// if (intItem > 1000) {
// int hPart = intItem/100;
// int lPart = intItem%2000;
// [data appendData:[NSData dataWithBytes:&hPart length:1]];
// [data appendData:[NSData dataWithBytes:&lPart length:1]];
// }
// else{
// [data appendData:[NSData dataWithBytes:&intItem length:1]];
// }
//
// }
//
// [self.currPeripheral writeValue:data forCharacteristic:currentTime type:CBCharacteristicWriteWithResponse];
// }
//
// //读取当前RecordStartTime(FFA2)RecordPeriod(FFAB) CurrentTime(FFA8),ReadID(FFA4),ReadOT(FFA5)
//
// //设置ReadID,ReadOT
//
// //TransferStatus(FFA9) 写1
// CBCharacteristic *transferStatus = [BabyToy findCharacteristicFormServices:self.services UUIDString:@"FFA9"];
//
// if (transferStatus) {
// int i = 1;
// NSData *value = [NSData dataWithBytes:&i length:sizeof(i)];
// [self.currPeripheral writeValue:value forCharacteristic:transferStatus type:CBCharacteristicWriteWithResponse];
// }
// //订阅RecordBuf(FFA1)数据
// CBCharacteristic *recordBuf = [BabyToy findCharacteristicFormServices:self.services UUIDString:@"FFA1"];
//
// if (recordBuf) {
// [self.currPeripheral setNotifyValue:YES forCharacteristic:recordBuf];
// }
//
//}