To: email@hidden
From: email@hidden
Subject: Retrieve peripheral and connect
Date: Fri, 2 Oct 2015 11:21:53 +0000
Hello!
I have an issue with retrieving peripheral and then connect to device. I successfully retrieve peripheral with given UUID and then try to connect, but device just doesn't connect. After [central connectPeripheral:peripheral options:nil]; state status becomes ' state = connecting>' and nothing happens. Maybe someone has experience with this problem( I am working first time with peripheral retrieving)? Thank you!
p.s. when I scan peripherals and connect then everything works perfect and my iPhone connects without problems .
Code looks like this:
- (void)retrievePeripheral:(NSString *)uuidString central:(CBCentralManager *)central
{
NSUUID *nsUUID = [[NSUUID UUID] initWithUUIDString:uuidString];
NSLog(@"%@", nsUUID);
if(nsUUID)
{
NSArray *peripheralArray = [self.centralManager retrievePeripheralsWithIdentifiers:@[nsUUID]];
// Check for known Peripherals
if([peripheralArray count] > 0)
{
for(CBPeripheral *peripheral in peripheralArray)
{
NSLog(@"Connecting to Peripheral - %@", peripheral);
[central connectPeripheral:peripheral options:nil];
NSLog(@"Connecting to Peripheral - %@", peripheral);
[central connectPeripheral:peripheral options:nil];
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden