Re: CBPeripheral's discoverServices Fails After 3-6 Reconnections
Re: CBPeripheral's discoverServices Fails After 3-6 Reconnections
- Subject: Re: CBPeripheral's discoverServices Fails After 3-6 Reconnections
- From: Caylan Larson <email@hidden>
- Date: Tue, 13 May 2014 23:05:05 -0700
A few other notes. The CBCentralManager is running on another thread like
so:
dispatch_queue_t centralQueue =
dispatch_queue_create(SemiCBConnectionManagerQueue,
DISPATCH_QUEUE_SERIAL);
_cbManager = [[CBCentralManager alloc] initWithDelegate:self
queue:centralQueue
options:nil ];
I profiled the app when it had reconnection issues. Even though the
services are not found, the sensor can still respond with
peripheralDidUpdateRSSI.
Here's a sample of the profiling:
Running Time Self Symbol Name
5.0ms 2.4% 0.0 _dispatch_mach_invoke
5.0ms 2.4% 0.0 _dispatch_queue_drain
5.0ms 2.4% 0.0 _dispatch_mach_msg_invoke
5.0ms 2.4% 0.0 _dispatch_client_callout4
5.0ms 2.4% 0.0 _xpc_connection_mach_event
4.0ms 1.9% 0.0 _xpc_connection_call_event_handler
3.0ms 1.4% 0.0 -[CBXpcConnection handleConnectionEvent:]
2.0ms 0.9% 0.0 _xpc_dictionary_look_up
1.0ms 0.4% 0.0 -[CBXpcConnection
nsDictionaryFromXpcDictionary:]
1.0ms 0.4% 0.0 xpc_dictionary_apply
1.0ms 0.4% 0.0 _xpc_dictionary_apply_node_f
1.0ms 0.4% 0.0 _xpc_dictionary_apply_apply
1.0ms 0.4% 0.0 __49-[CBXpcConnection
nsDictionaryFromXpcDictionary:]_block_invoke
1.0ms 0.4% 0.0 -[CBXpcConnection nsObjectWithXpcObject:]
1.0ms 0.4% 0.0 +[NSUUID allocWithZone:]
1.0ms 0.4% 1.0 DYLD-STUB$$__destroy_helper_block_183
1.0ms 0.4% 1.0 __62-[CBXpcConnection
initWithDelegate:queue:options:sessionType:]_block_invoke
1.0ms 0.4% 0.0 -[OS_xpc_object _xref_dispose]
I hope this can help someone isolate a problem...
Caylan
> I am developing an elaborate industrial automation app for a large company
> that reads from four (4) independent Bluetooth 4.0 sensors that are custom
> manufactured for this specific application. We are seeing reconnection
> issues after reconnecting to the sensors 3-6 times.
>
> My tests result in the same issues whether on iPad Air, iPad Mini, iPod
> Touch, iPhone 5. All devices are running 7.1.1. Note: The issue is not
> "Bluetooth Error 1309" however, I have seen it once or twice in my
> testing. The reconnection issue is easily resolved by swiping up from the
> bottom and turning Bluetooth off and then on again. The app does not need
> a restart to benefit from this BTLE power cycling.
>
> I have tried to mitigate the issue with zero luck:
>
> 1. Aggressive retries of discoverServices using various NSTimers
>
> 2. Delaying scanForPeripheralsWithServices by using
> retrievePeripheralsWithIdentifiers on subsequent reconnections. This
> solution works for the 2nd connection and maybe 3rd connection, but no
> difference than if I used a pure scan. (Ugh, how I wish this was the
> solution...)
>
> Any ideas on how to make reconnections reliable?
>
>
> _______________________________________________
> 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
_______________________________________________
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