Je dois envoyer comme valeur 0x0001, 0x0002 dans BLE setValue(),ble Android setValue comme 0x0001
Est-ce que quelqu'un sait comment transmettre?
pour l'exemple:
private void command() {
ongoing.setValue(0x0001); //error
mBluetoothLeService.writeCharacteristic(ongoing);
BluetoothLeService.setCharacteristicNotification(ongoing, true);
...
...
...
mBluetoothLeService.readCharacteristic(ongoing);
}
Thanks.
dans 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);
}
}
Quel est le type de 'continuous'? – Sweeper
Il devrait être BluetoothGattCharacteristic parce qu'il est passé à une méthode qui l'exige? – CmosBattery
J'ai seulement lu, mais voir ici pour l'écriture: https://stackoverflow.com/questions/36163998/writing-data-to-bluetooth-le-characteristic-in-android ... Notamment, vous pourriez utiliser un méthode réelle comme @Override public void onCharacteristicWrite (BluetoothGatt gatt, .... pour écrire les données.Mais vous pourriez ne pas être écrit correctement selon le lien – CmosBattery