1

I need to receive data periodically through a BlueTooth External Accessory.

I implemented an event-driven model of EA's streams. However, the initial transmission from bluetooth is always delayed. For example, if each packet was 15 bytes long, the stream delegate would not fires until about 150 bytes.

Will polling help?

EDIT:

Also I found it hard to recover the session after the app switching back from background to foreground. Trying to open session again would fail. Any idea?

ZhangChn
  • 3,154
  • 21
  • 41

1 Answers1

2

Read every bytes when NSStreamEventHasBytesAvailable arrives.

Did you develop your own Bluetooth accessory? May be the MCU only flushes after sending every 150 bytes.

Also you mentioned initial transmission. Do you know once the Bluetooth device is paired and connected to iPhone, it has to go through some identification process, handshaking some secret certificate. This may take few and even 10 seconds, depending on signal quality. This may be the cause of delay.

XMLSDK
  • 259
  • 1
  • 10
  • No, I'm on a contract for MFi device. Also I found it hard to recover the session after the app switching back from background to foreground. Any idea? – ZhangChn Sep 02 '11 at 23:50
  • Which iPhone / iPod Touch / iPad are you testing? Some models DID make hard connectivity with Bluetooth devices. This is not caused by your iOS app. You can observe that from iOS Settings > General > About, the accessory may not be removed from the list even the Bluetooth device is out of range or switched off. The iOS sometimes does not sense it correctly. – XMLSDK Sep 03 '11 at 02:14