iOS 關於已配對裝置重新檢測連線問題
//zwl
//已經被系統或者其他APP連線上的裝置陣列
NSArray *arr = [self.CBcentralmagagerretrieveConnectedPeripheralsWithServices:@[[CBUUIDUUIDWithString:ServiceUUID]]];
if(arr.count>0)
{
for (CBPeripheral* peripheral in arr)
{
if (peripheral != nil)
{
peripheral.delegate
[self.CBcentralmagager connectPeripheral:peripheral options:nil];
self.connectedPeripheral=peripheral;
[AppDelegatesharedAppDelegate].peripheral = self.connectedPeripheral;//zwl
[AppDelegatesharedAppDelegate].Globeuuidstr = [[
[[NSNotificationCenterdefaultCenter] postNotificationName:VDBlueToothSearchSuccessNotificationobject:nil];
}
}
}
else
{
[self.CBcentralmagagerscanForPeripheralsWithServices:
[NSTimerscheduledTimerWithTimeInterval:10.0ftarget:selfselector:@selector(scanTimeout:) userInfo:nilrepeats:NO];
_blackPeriperalInfos=blackPeriperalInfos;
[PeriperalInfosremoveAllObjects];
}