简体   繁体   English

核心蓝牙的两个实例

[英]Two instances of Core Bluetooth

The project I am working on uses a manufacture-build library that works with specific BLE products. 我正在从事的项目使用与特定BLE产品配合使用的制造商构建库。 The library handles all the reads and writes from the devices. 该库处理从设备进行的所有读取和写入。 The library files are hidden so I can not modify them. 库文件是隐藏的,因此我无法对其进行修改。 I want to add another BLE product and plan do so using the UUID protocols given. 我想添加另一个BLE产品,并计划使用给定的UUID协议这样做。 Can an iOS project have two instances of Core Bluetooth running like this? 一个iOS项目是否可以有两个这样运行的Core Bluetooth实例?

Yes. 是。

I probably should write more here so it feels like a real answer, but yes. 我可能应该在这里写更多,这样才是真正的答案,但是可以。 It don't matter. 没关系 iOS under the covers unifies the various CBCentralManager instances, across multiple processes, not just within your process, such that it will all work out. CBCentralManager iOS CBCentralManager跨您的流程,而且跨多个流程统一了各种CBCentralManager实例,从而可以正常工作。

Within code you control, I don't recommend having multiple CBCentralManager instances because it's confusing. 在您控制的代码中,建议您不要使用多个CBCentralManager实例,因为这会造成混淆。 But what you're describing is fine. 但是您所描述的很好。 If you can help it, I'd personally avoid having multiple CBPeripheral objects referring to the same device, but even that will technically work. 如果可以提供帮助,我个人会避免使用多个CBPeripheral对象引用同一设备,但是从技术上讲,即使这样也可以。 The main reason to avoid it is that some devices might get confused if you have multiple conversations going on at the same time. 避免这种情况的主要原因是,如果您同时进行多个对话,则某些设备可能会感到困惑。 It's still one BLE connection, though, in terms of the Bluetooth protocol. 但是,就蓝牙协议而言,它仍然是一个BLE连接。 Apps do not connect to devices; 应用无法连接到设备; the phone connects to devices. 手机将连接到设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM