Ich sende Wert benötigen wie 0x0001, 0x0002 in BLE setValue(),Android ble setValue wie 0x0001
Wer weiß, wie zu übertragen?
zum Beispiel:
private void command() {
ongoing.setValue(0x0001); //error
mBluetoothLeService.writeCharacteristic(ongoing);
BluetoothLeService.setCharacteristicNotification(ongoing, true);
...
...
...
mBluetoothLeService.readCharacteristic(ongoing);
}
Thanks.
in DeviceControlActivity.java:
private void displayGattServices(List<BluetoothGattService> gattServices){
UUID UBI_COMMAND = UUID.fromString(SampleGattAttributes.UBI_ONGOING_INFO_SERVICE_UUID);
...
...
if (uuid.equals(SampleGattAttributes.UBI_ONGOING_INFO_SERVICE_UUID)){
ongoing = gattService.getCharacteristic(UBI_ONGOING);
}
}
Was ist die Art von 'laufenden'? – Sweeper
Es sollte BluetoothGattCharacteristic sein, da es an eine Methode übergeben wird, die es erfordert? – CmosBattery
Ich habe nur gelesen, aber hier zum Schreiben: https://stackoverflow.com/questions/36163998/writing-data-to-bluetooth-le-characteristic-in-android ... Insbesondere könnten Sie ein verwenden tatsächliche Methode wie @Override öffentliche void onCharacteristicWrite (BluetoothGatt gatt, .... um die Daten zu schreiben. Aber Sie könnten nur nicht richtig schreiben, wie auf dem Link. – CmosBattery