ios - iPhone 4s可以连接两个蓝牙4.0设备吗?

标签 ios core-bluetooth

我想知道 iPhone 4s 可以连接两个蓝牙 4.0 设备吗?

我使用 Corebluetooth.framework 连接我的蓝牙4.0 设备,现在我有疑问,如果我们有两个设备,我可以同时连接两个设备吗?

非常感谢!

最佳答案

是的。

例如,请查看 Apple 的心率监测器样本 http://developer.apple.com/library/mac/#samplecode/HeartRateMonitor/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40011322 。在 HeartRateMonitorAppDelegate.m 中,您会发现以下收集多个设备的方法:

- (void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)aPeripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI 
{    
    NSMutableArray *peripherals = [self mutableArrayValueForKey:@"heartRateMonitors"];
    if( ![self.heartRateMonitors containsObject:aPeripheral] )
        [peripherals addObject:aPeripheral];

    /* Retreive already known devices */
    if(autoConnect)
    {
        [manager retrievePeripherals:[NSArray arrayWithObject:(id)aPeripheral.UUID]];
    }
}

在此特定示例中,应用程序仅与其中一个心率监测器连接,但您可以查看代码并轻松了解它如何连接到两个心率监测器(假设您愿意更新 UI 以显示两个心率) .

关于ios - iPhone 4s可以连接两个蓝牙4.0设备吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11772746/

相关文章:

iphone - 尝试将用户输入放入 yahoo api URL 中

ios - 子类 CBPeripheral 未转换为正确的类型

ios - CBPeripheralManager : Does add(_ service: CBMutableService) advertise peripheral?

ios - 如何设置tableview单元格的文本和详细文本?

ios - isKindOfClass 为测试用例返回不同的值

ios - userNotificationCenter didReceive 响应包含空通知(watchOS)

ios - 如何在 CoreBluetooth 上同时向多个蓝牙 LE 从设备写入数据?

ios - 我可以在 iOS 中连接摩托罗拉 rs507 作为蓝牙外设吗?

ios - 获取 ios 中可用蓝牙设备的列表

ios - 从 View Controller 中删除 WebView