• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Peripheral issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Peripheral issue


  • Subject: Re: Peripheral issue
  • From: András Kövi <email@hidden>
  • Date: Sun, 02 Feb 2014 10:05:39 +0100

Hi Yuri, nice writeup and definitely requires some consideration.

I guess, if you use notifications and implement correct transmission control operations on top of it (like TCP/IP does), then this issue will probably manifest in some failed read requests on the central side but not complete freeze or disconnect.

It's definitely bad if the respondToRequest silently fails and there is no way to recover from it. You should open a bug and describe the expected operation in detail. You may get some valuable response.

Regards,
Andras


2014-02-02 <email@hidden>:
Hello everyone,
I’m working on a simple wrapper around CoreBluetooth to send any data to any device.
During developing I encountered a lot of bugs in framework, they were very annoying and to make my wrapper stable I had to shorten some of functionality for reliability.

For now I’m working on sending data from peripheral.
Ok, so I have following case:
- Client asks for value of dynamic characteristic
- I get a callback on server-side - peripheral:didReceiveReadRequest:
Note : I need to respond to this CBATTRequest in this method - I can’t store it elsewhere and respond to it asynchronously. (Im just putting some chunk @“PrepareToReceiveValue” that will be ignored on central side. All sending is done in queue.)
- For providing data for various devices I constructed a queue with BTMessage's in it. (So for readRequest I create message and add it to sending queue. If chunk sending failed - I will get a callback from peripheral manager about readyToUpdateSubscribers and will ask queue to resend failed chunk)
- So when I’m requesting immediately a lot of dynamic characteristic values and sending data from peripheral to central concurrently sometimes it just freezes sending progress and leads to disconnection.

After several testing I found out that it was all about transmit queue:
If transmit queue  is full and you will receive read request - it just won’t respond to it.

So l I have potential unstable system state:
1. Peripheral is sending data to some central.
2. In my sending method updateValue:forCharac… returns NO because transmit queue is full.
3. At this moment central requests dynamic value for characteristic and peripheral:didReceiveReadRequest: invocation will be added to current runloop.
4.  After returning from sending method it will dequeue peripheral:didReceiveReadRequest: method and responding to this request will have no effect (transmit queue is full).
5. So in this case respondToRequest: is ignored like I didn’t invoked it at all.
6. CoreBluetooth will not be able to send/receive any data until I will respond to request. That was the reason for freezing any sending/receiving progress with concomitant disconnection.
7. As I mentioned before - I must respond to request in appropriate method - otherwise it will also have no effect. (Im saying it because I’ve tried to put those request in array if queue is full and respond to them when it will have some space but with no luck).

Im waiting for your proposals/suggestions how to resolve this problem, any help will be appreciated.

Best regards, Yuri.



 _______________________________________________
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

References: 
 >Peripheral issue (From: email@hidden)

  • Prev by Date: Peripheral issue
  • Next by Date: BLE Write Command while Write Request is pending
  • Previous by thread: Peripheral issue
  • Next by thread: BLE Write Command while Write Request is pending
  • Index(es):
    • Date
    • Thread