Bluetooth LE Java 特性 setValue 上的字节数组大小

Bluetooth LE Java byte array size on characteristic setValue

我正在尝试使用以下代码行在我的 Android phone 上使用蓝牙 LE 发送一个值。

我收到一个错误,它超出了数组的大小,由于 0xEA 字节,数组的大小为 127。我将字节转换为 234 左右。是否可以使用以下代码行发送此字节?

private void writeCharacteristic(BluetoothGatt gatt) 
     {BluetoothGattCharacteristic characteristic;
      Log.d(TAG, "Writing Data");
       characteristic = gatt.getService(SERVICE).getCharacteristic(DATA_IN);
       characteristic.setValue(new byte[]{0x08, 0x01, 0x03, 0x04, 0x52, 0x00, 0x02, 0x62, 0xEA});

       gatt.writeCharacteristic(characteristic);
    }

要能够在 java 中使用大于 127 的字节值,请使用 (byte)0xEA