Dr. Michael Kroll's Mobile Computing Forum

BLEBee byte parsing/buffering for UILabel display in iOS
Page 1 of 1

Author:  mike_s [ Tue Mar 11, 2014 8:01 am ]
Post subject:  BLEBee byte parsing/buffering for UILabel display in iOS

Can you please say how one might parse and/or buffer the byte output stream from the FIO V3/BLEBee setup. I'm receiving the data successfully in the BLE app on the iPhone however, converting the 1 byte (actually 4) output in to a single NSString for a UILabel display has been difficult at best?

I've asked in both Arduino forums as well as the apple developer forums and even bought a tech support package for help and no one seems to be able to figure out what (in my opinion) should be incredibly easy?

With an output of "123456789" from Arduino serial the data received looks like this in Xcode Log:
2014-03-10 22:53:27.771 BTLE-Sensor[2860:60b] Data: 1
2014-03-10 22:53:27.775 BTLE-Sensor[2860:60b] Data: 2345
2014-03-10 22:53:27.777 BTLE-Sensor[2860:60b] Data: 678
2014-03-10 22:53:27.779 BTLE-Sensor[2860:60b] Data: 9

And the label of course displays only the last received byte: 9

Is the buffer created on the Arduino side or in the iOS app?
Thank you!


Author:  mkroll [ Tue Mar 11, 2014 11:45 pm ]
Post subject:  Re: BLEBee byte parsing/buffering for UILabel display in iOS

Hello Mike,
you need to buffer on the iOS Side.
You can test this with BLExplr. Go to the Settings of the App and update the latest UUID Descriptions.
If you connect to the BLEbee and enable notifications on the RX characteristic the received data is buffered and you will see all the characters 123456789 in a row.

This is normal behaviour. The bytes are transferred in a serial way. Byte per byte and according to your log 1, 4, 3 and then one byte. You can see only the 9 since you're are not buffering the first 8 characters.

Does this help?


Author:  mike_s [ Wed Mar 12, 2014 10:28 am ]
Post subject:  Re: BLEBee byte parsing/buffering for UILabel display in iOS

Actually it does help. I'm a UI designer in Cupertino and work on apps all the time but this is my first attempt at the back-end. I now have MUCH more respect for the engineers I work with!

I did solve the problem using an append function but I did have a couple of other rookie questions if you don't mind ...

I know the BLEBee is releasing the data without using the serial buffer but I'm seeing random "bursts" of 4 and sometimes 5 bytes at a time in the log if I have a 0-2000 loop counter with no delay. Common sense leads me to believe that higher baud rates would possibly allow for even more bytes each time I trigger the release of data from the serial buffer?

Do higher bit rates effect the signal adversely or do they have a positive effect? For instance the variables with 2.4GHz vs 5GHz wifi.

At first glance (not being an engineer) after reading the documentation it seems I simply need to send the string "0x04" to UUID "2FBC0F31-726A-4014-B9FE-C8BE0652E982" to change the rate to 38400? If so, do I need to confirm the update with "Response" or will "WriteValue" without a response work? And is the process the same for the other characteristic controls as well?

Lastly, we will have a need for some custom prototyping with the BLE113's as soon as we're past proof of concept, which is very close. Is this something you can help with? Please feel free to email me with this particular answer.

Thank you for your time.

Author:  mkroll [ Wed Mar 12, 2014 11:32 pm ]
Post subject:  Re: BLEBee byte parsing/buffering for UILabel display in iOS

Hi Mike,
yes you can change the baud rate to 38400 by writing 0x04 to the corresponding characteristic, right.
You need to writeWithResponse, since the characteristic is defined that way.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group