-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bytes greater than 127 #9
Comments
This is due to the fact that primitives in Java, including |
Thank you Macro, |
Even, If I implement int unsignedByte like your comment then I will receive 3 bytes 239, 191, 189 instead of 1 byte for each negative value I send out. And it is same as negative one, just in unsigned value. |
Can you specify your expected input and output? |
I'm sending 0 to 255 from another bluetooth to android and I'm expecting to receive same number on Android, but I'm receiving 0 to 127 for numbers 0 to 127 I send which is match and OK, but for other numbers between 127 to 255 I'm receiving only 63, not same number that I sent. |
The input from other bluetooth is an array with 256 elements contains 0 to On Thu, Jul 7, 2016 at 8:15 AM, Macro Yau [email protected] wrote:
|
@hamidnaghi Now I understand your issue after testing with an Arduino Bluetooth module. It is caused by the handling of the received bytes in the A simple workaround would be encoding the values as Strings on the device sending the data, if possible. Alternatively, you can consider modifying the |
Once I send the bytes with value of 128 to 255 by Bluetooth to Android then I see different bytes. I receive -17, -65, -67 instead of 128 to 255. But, it works with 0 to 127. Something happens to "(byte[]) msg.obj" with negative values in the
private final Handler mHandler = new Handler()
in the section
case MESSAGE_READ:
byte[] bufferRead = (byte[]) msg.obj;
Would you please resolve it?
Best regards
Hamid Naghizadeh
The text was updated successfully, but these errors were encountered: