//zwl
//已经被系统或者其他APP连接上的设备数组
NSArray *arr = [self.CBcentralmagager retrieveConnectedPeripheralsWithServices:@[[CBUUID UUIDWithString:ServiceUUID]]];
if(arr.count>0)
{
for (CBPeripheral* peripheral in arr)
{
if (peripheral != nil)
{
peripheral.delegate = self;
[self.CBcentralmagager connectPeripheral:peripheral options:nil];
self.connectedPeripheral=peripheral;
[AppDelegate sharedAppDelegate].peripheral = self.connectedPeripheral;//zwl
[AppDelegate sharedAppDelegate].Globeuuidstr = [[AppDelegate sharedAppDelegate].peripheral.identifier UUIDString];
[[NSNotificationCenter defaultCenter] postNotificationName:VDBlueToothSearchSuccessNotification object:nil];
}
}
}
else
{
[self.CBcentralmagager scanForPeripheralsWithServices:nil options:nil];
[NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(scanTimeout:) userInfo:nil repeats:NO];
_blackPeriperalInfos=blackPeriperalInfos;
[PeriperalInfos removeAllObjects];
}