tinyb icon indicating copy to clipboard operation
tinyb copied to clipboard

writeValue writes successfully, but doesn't write any actual data

Open NiallBegley opened this issue 8 years ago • 1 comments

After some trial and error with different versions of BlueZ and TinyB, I've successfully gotten my Java application connecting to a custom BLE device, discovering it's services and characteristics and calling into writeValue on one of the characteristics:

        byte[] config = {(byte) 0xE1, (byte) 0x08, 'r', 0x0, 0x0};
        try {
            tempValue.writeValue(config );
            Thread.sleep(1000);
            tempConfig.writeValue(config);
        }
        catch(Exception e)
        {
            System.out.println("what");
            e.printStackTrace();

        }
        finally {
            sensor.disconnect();
        }

However, when this data is received by the custom BLE device, the data appears to be completely empty:

 Received file command - First 5 bytes: [0 0 0 0 0]
 Disconnected

The remote device is also immediately disconnecting after that first writeValue() on the "tempValue" characteristic, but I'm assuming that's something related to receiving an empty message.

I'm a bit at a loss as to what this could be at this point. I don't know if there is something about my system setup that could be causing version problems? Here is what I'm working with:

bluetoothd -v
5.43

ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu9) 2.23

TinyB commit d9c777bc576b5365c2064d55fe872f272faa92e8

java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

cmake -version
cmake version 3.5.1

gcc version 6.3.0 20170519 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 

Any help would be greatly appreciated!

NiallBegley avatar Dec 19 '17 19:12 NiallBegley

Well, to anyone reading this in the future: I fixed the issue I was describing, but I'm sorry to say I don't know exactly how. I updated gcc and tried updating my version of glibc and somehow during that process it resolved that particular issue.

Sadly the data is going across okay, but the writeValue() times out even though the data is being sent. I guess that's a separate issue, though.

NiallBegley avatar Dec 20 '17 18:12 NiallBegley