简体   繁体   中英

Two instances of Core Bluetooth

The project I am working on uses a manufacture-build library that works with specific BLE products. 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. Can an iOS project have two instances of Core Bluetooth running like this?

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.

Within code you control, I don't recommend having multiple CBCentralManager instances because it's confusing. 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. 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. Apps do not connect to devices; the phone connects to devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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