sinkuri256 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

[PATCH] Binary transfers for Bluetooth connections #453

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SL4A API asumes data been transfered in Bluetooth connections are encoded as 
ASCII this lends to a loose of data, furthermore json isn't ready to encode 
bytes ranging from 0 to 256 which would be the case for a binary stream.

This patch adds two functions bluetoothReadBinary and bluetoothWriteBinary 
which will use base64 encoding to assure data is valid through the stream, is 
the userspace application the one which needs to encode/decode base64. 
bluetoothReadBinary will return a base64 encoded stream, while 
bluetoothWriteBinary will require data to be transfered to be encoded into 
base64 (no error handling is done in the write function...)

Base64 encoder/decoder is provided in the patch so that the code is compatible 
with Android 1.6 (base64 is part of the API since 2.2)

This should fix issue 445 and 446.

Original issue reported on code.google.com by naranjo....@gmail.com on 5 Oct 2010 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch!

Original comment by damonkoh...@gmail.com on 11 Oct 2010 at 2:00

GoogleCodeExporter commented 9 years ago
Great thanks!.

Original comment by naranjo....@gmail.com on 11 Oct 2010 at 2:06