Hello,
The SDK example assumes that the byte stream sent by the serial device is pure text data with no nulls, strange codes, etc. It's not a bullet-proof example as the comments in the code indicate; it's more for demonstration purposes.
To answer your questions:
- when bytes are received on the serial port you get a callback "readBytesAvailable" with a count parameter. The count parameter indicates how many bytes are currently available to be read from the serial port at this instant.
- your code calls [AirconsoleSession read] and passes in a buffer of your choosing - the return code indicates how many bytes were transferred into your buffer. You choose the size of this buffer according to your needs; the SDK will fill it up as much as possible. The SDK example uses a fixed 1024 byte buffer, but this of course could be dynamically allocated to match the "count" parameter passed to readBytesAvailable.
- you now have a buffer of bytes you can use, if you want to convert this to a string, then you'll need to know what format your strings are in - e.g. what character encoding, and what line termination (if any). This shouldn't be a mystery as you know the type of serial device you have connected the Airconsole to. The SDK example assumes, a.) UTF-8 character encoding, and b.) no line termination - data is a stream of characters.
You may want to look at some articles such as
http://stackoverflow.com/questions/2793 ... ted-string for help converting bytes into NSString objects.
Hope that helps