I am having an interesting problem using Monodroid to send commands to a device via Bluetooth.
I am using this Monodroid method:
BluetoothSocket.OutputStream.Write(byte[] buffer, int offset, int count);
I need to send the following 8-byte frame:
- 0x51
- 0x26
- 0x0
- 0x0
- 0x0
- 0x0
- 0xFFFFFFA3
- 0x0
The problem is that 0xFFFFFFA3 is a signed byte (-93) so this means I need to use C#.NET’s sbyte rather than byte to create the array to pass to the Write method.
However, I cannot pass an sbyte[] array to the Write method I can only pass a byte[] array. C#.NET does not allow me to put 0xFFFFFFA3 in a byte because it is signed.
What can I do to pass the command through the socket? Thank you.
0xFFFFFFA3 is the size of an Int32, which may be why the compiler is complaining. You should be able to just specify a byte value of 0xA3.