0

I am sending this command AE A7 04 00 05 09 BC B7 to BLE, onCharacteristicWrite returns status=0, but BLE device does not send any data ( I mean I do not get any response ). So what is wrong ? Maybe I am sending in a wrong format ?

    public void WriteValue()
        {
      mNotifyCharacteristic.setValue("AE A7 04 00 05 09 BC B7".getBytes());
            mBluetoothGatt.writeCharacteristic(mNotifyCharacteristic);
        }
abrutsze
  • 496
  • 1
  • 8
  • 24

3 Answers3

1

On Android try set write type to WRITE_TYPE_NO_RESPONSE

Btw, you should use LightBlue to test first https://itunes.apple.com/us/app/lightblue-explorer-bluetooth-low-energy/id557428110?mt=8

cxphong
  • 847
  • 2
  • 9
  • 18
1

Try to replace the third line with mNotifyCharacteristic.setValue(new byte[]{(byte)0xAE, (byte)0xA7, 4, 0, 5, 9, (byte)0xBC, (byte)0xB7});

Emil
  • 16,784
  • 2
  • 41
  • 52
1

Test use byte[ ]

I think it good then use getbyte

I use byte[ ] can write successful

You can try it

Byte[] data = new byte[5];

data[0]=xx;

data[1]=xx;

........

Characteristic.Setvalue(data);

If not work try use other road

Not the same characteristic

Rest
  • 17
  • 5