1 year ago

#77495

test-img

Dustin Duclos

BLE Android Studio ERROR 128 WHEN TRYING TO WRITE TO DEVICE

We can read from the device into the terminal, but we continue to receive the 128 after attempting to write to the characteristic. We are attempting write 0x00 to the characteristic which will turn off all of the LEDs on the device.

sendData.setOnClickListener(new View.OnClickListener() {
       public void onClick(View v) {
           byte[] test = {00};
           mBluetoothLeService.writeCharacteristic(c,test);
           return;
       }
});

—-------------------------------------------------------------------------

public void writeCharacteristic(BluetoothGattCharacteristic characteristic, byte[] test ) {
   if (mBluetoothAdapter == null || test == null) {
       Log.w(TAG, "BluetoothAdapter not initialized");
       return;
   }
   


characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
   characteristic.setValue(test);
   if (writeEnabled) {
       mBluetoothGatt.writeCharacteristic(characteristic);
   }

java

android

bluetooth-lowenergy

0 Answers

Your Answer

Accepted video resources