You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@weliem I want to congratulate you on this magnificent library. could you help me convert this C code to java.
I tried, but there's something missing in the writeCharateristic. The write does not reply to me with the data.
Where am I doing wrong?
this is a java translate with your lib
``
private static final UUID DIS_SERVICE_UUID = UUID.fromString("0000ff00-0000-1000-8000-00805f9b34fb");
private static final UUID NOTIFY_CHARACTERISTIC_UUID = UUID.fromString("0000ff01-0000-1000-8000-00805f9b34fb");
private static final UUID CTRL_CHARACTERISTIC_UUID = UUID.fromString("0000ff02-0000-1000-8000-00805f9b34fb");
private final BluetoothPeripheralCallback peripheralCallback = new BluetoothPeripheralCallback() {
@Override
public void onServicesDiscovered(@NotNull final BluetoothPeripheral peripheral, @NotNull final List<BluetoothGattService> services) {
BluetoothGattCharacteristic ctrlChar = peripheral.getCharacteristic(DIS_SERVICE_UUID, CTRL_CHARACTERISTIC_UUID);
if(ctrlChar != null) {
if (ctrlChar.supportsWritingWithResponse()) {
BluetoothBytesParser parser = new BluetoothBytesParser();
parser.setIntValue(0x55, BluetoothBytesParser.FORMAT_UINT8);
parser.setIntValue(0x04, BluetoothBytesParser.FORMAT_UINT8);
parser.setIntValue(0x88, BluetoothBytesParser.FORMAT_UINT8);
parser.setIntValue(0xAA, BluetoothBytesParser.FORMAT_UINT8);
peripheral.writeCharacteristic(ctrlChar, parser.getValue(), WriteType.WITH_RESPONSE);
}
}
BluetoothGattCharacteristic notifyChar = peripheral.getCharacteristic(DIS_SERVICE_UUID, NOTIFY_CHARACTERISTIC_UUID);
if (notifyChar != null) {
peripheral.setNotify(notifyChar, true);
}
}
``
The text was updated successfully, but these errors were encountered:
@weliem I want to congratulate you on this magnificent library. could you help me convert this C code to java.
I tried, but there's something missing in the writeCharateristic. The write does not reply to me with the data.
Where am I doing wrong?
this is a C code.
https://github.com/syssi/esphome-tianpower-bms/blob/main/components/tianpower_bms_ble/tianpower_bms_ble.cpp
this is a java translate with your lib
``
private static final UUID DIS_SERVICE_UUID = UUID.fromString("0000ff00-0000-1000-8000-00805f9b34fb");
private static final UUID NOTIFY_CHARACTERISTIC_UUID = UUID.fromString("0000ff01-0000-1000-8000-00805f9b34fb");
private static final UUID CTRL_CHARACTERISTIC_UUID = UUID.fromString("0000ff02-0000-1000-8000-00805f9b34fb");
``
The text was updated successfully, but these errors were encountered: