One CBPeripheralManager instance serving multiple CBCentral instances causing disconnected.
One CBPeripheralManager instance serving multiple CBCentral instances causing disconnected.
- Subject: One CBPeripheralManager instance serving multiple CBCentral instances causing disconnected.
- From: BaThach Nguyen <email@hidden>
- Date: Thu, 16 May 2019 10:55:49 -0600
Hi everyone,
I have an app, which using CoreBluetooth and play both roles Central
and Peripherals. This app get the information from an IoT device, and
then forward it to other apps via notifying.
- App1 has one CBCentralManager instance to connect to IoT device
(peripheral) to get data.
- App1 also has another CBPeripheralManager instance, to advertising
and notifying the data it got from IoT device (via predefined
ServiceUUID so App2 and App3 can scan).
- App 2 and App 3 play as Central roles, having CBPeripheralManager to
connect to App1, subscribe for notification from predefined
characteristic. And getting data whenever App1 notify it.
When App2 and App3 connect to App1, it causes the connection from App1
to IoT device resetting quite often. I saw
centralManager:didDisconnectPeripheral:error: every 5-10minutes.
The reason for IoT device disconnected to App1:
default 16:31:51.032169 -0600 MyBLEApp Disconnected peripheral
(error: Error Domain=CBErrorDomain Code=6 "The connection has timed
out unexpectedly." UserInfo={NSLocalizedDescription=The connection has
timed out unexpectedly.})
When App2 and App3 don't connect to App1, the connection between App1
and IoT device is pretty stable.
I also posted question here with more logs, but no reply yet:
https://forums.developer.apple.com/thread/116525
I thought so many data notifying caused this issue, but when I tried
to remove all code sending/receiving data between App1, and App2/App3,
just connect App2 and App3 to App1 (just call
connectPeripheral:options:, stay connected), issue still happened.
Is there any idea how that can be happened? Thank you!
-- Best,
Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden