Re: Can I keep CBService and CBCharacteristics around?
Re: Can I keep CBService and CBCharacteristics around?
- Subject: Re: Can I keep CBService and CBCharacteristics around?
- From: Rick Mann <email@hidden>
- Date: Mon, 03 Jun 2013 14:06:09 -0700
On Jun 3, 2013, at 05:33 , András Kövi <email@hidden> wrote:
> Side note: I feel like this is similar to when you want to cache images but use [UIImage imageNamed:] to obtain them. It may seem to make sense but at the same time UIImage aready does it for you, so it practically just makes things more complex without much gain. I haven't done testing as to how much caching CoreBluetooth does but I feel like this is something that is necessarily an OS function. On the other hand, people on this list have been complaining that it does actually cache quite aggressively, which hinders testing in some cases. All in all, implementing additional caching will surely make your code more complex (think of handling BT reset, crashes, hidden XPC errors, etc.) without much practical gain (if any).
The difference here is that getting a UIImage is a synchronous operation, and everything in CB is async. It's actually a real pain to use the CB API if you want to represent the peripherals in Core Data and split interactions across controllers and Managed Object Contexts.
If CB were a block-based API, a lot of my issues go away, but I'd still have to handle the async nature of things (which means keeping state around to make sure all of several characteristics have been discovered and then read).
--
Rick
_______________________________________________
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