We tried to read data for bluetooth devices to iphone. We flowed this
https://github.com/paulw11/BTBackground .We got devices name and devices uuid number and connection also Fine.But we failed to get data.Please guide to us
-(void) centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
self.connectedPeripheral=peripheral;
NSLog(@"Connected to %@(%@)",peripheral.name,peripheral.identifier.UUIDString);
peripheral.delegate=self;
NSLog(@"DeviceInfoUUID %@",_deviceInfoUUID);
[peripheral discoverServices:@[self.deviceInfoUUID]];
//we tried this also
// [peripheral discoverServices:nil];
}
#pragma mark - CBPeripheralManager delegate methods
-(void) peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
NSLog(@"peripheral.services %@",peripheral.services);
for (CBService *service in peripheral.services) {
NSLog(@"Discovered service %@",service.description);
if ([service.UUID isEqual:self.deviceInfoUUID]) {
[peripheral discoverCharacteristics:nil forService:service];
}
}
}
Please guide to us What wrong in code.We are new this