Re: Reconnecting a peripheral
Re: Reconnecting a peripheral
- Subject: Re: Reconnecting a peripheral
- From: Roland King <email@hidden>
- Date: Sat, 11 Jul 2015 14:52:37 +0800
Searching through this forum and stackoverflow is seems clear that, after disconnecting from a peripheral, you must go through the service(s) & characteristic(s) discovery process again after reconnection before you can interact with a characteristic.
The project that I am working on is a central (iOS device) and controlled peripheral (TI CC2541 device). Communication is predominantly control sequences from the iOS device to the peripheral. Following Apple's guidelines, I should be connecting, transferring data, disconnecting in order to "minimise radio usage."
To avoid the need to re-discover services and characteristics, I could leave the connection open for as long as the iOS application is running. What is the impact of doing so? Will the iOS device's radio be on for the duration and, presumably, draining the battery more quickly? What about the peripheral? Will maintaining an open connection have any adverse impact on battery life of the peripheral?
If you leave the connection open you will drain the iOS battery, the peripheral battery (assuming your advertising power consumption is less than your connection power consumption which is a factor of advertising interval and payload vs connection interval and slave latency).
However iOS caches services and characteristics on devices it’s connected to so just reconnecting to the device by UUID should mean that yes you still do the service discovery and characteristic discovery again but the results come from the cache and aren’t re-transferred from the peripheral.
Now where I get confused is whether a peripheral needs to be bonded in order to get this behaviour or not. I thought not, it was based on the address of the device as long as BTLE hasn’t been turned off etc etc. but I’m quite prepared to be wrong on that point.
Note that during development I usually use a randomly generated address each time I start up in order to avoid any of the iOS caching behaviour because I’ve found it doing odd things before.
|
_______________________________________________
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