characterstic yazarken 128 okuma işlemi gerçekleştirmek için başarıyla am güçlü ben BLE device.I üzerinde okuma ve yazma işlemlerini gerçekleştirmek çalışıyorum kütüphaneye react-native-ble-managerBle-alma hata kodu - Aşağıdaki kullanıyorum
tepki. Ama BLE cihazına yazarken hata kodu 128 alıyorum.
ilk ben karakteristik için bildirim sağlayan am -
const base64String = new Buffer('0x00B00050D0', 'hex').toString('base64');
BleManager.write(peripheralId, serviceId, characteristicId, base64Value)
Yaz operasyon dönüş hata kodu -128 - base64 dizeye
dönüştürme 'onaltılık' value -
BleManager.startNotification(peripheralId, serviceId, characteristicId)
Yazma böyledir
:(
GÜNCELLEME - Bu bildirim başlatmak ve tam dosyasını değer-yazma kod parçacığı olan bu bir hayır kaynaklar hatadır burada-BluetoothLeService.java
public void writeCharacteristic(BleCharacteristic bleCharacteristic, String inputValue) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
if (!bleCharacteristic.isNotificationStarted()) {
Log.w(TAG, "Notification not started please start notification");
return;
}
BluetoothGattCharacteristic bluetoothGattCharacteristic = bleCharacteristic.getBluetoothGattCharacteristic();
bluetoothGattCharacteristic.setValue(inputValue);
mBluetoothGatt.writeCharacteristic(bluetoothGattCharacteristic);
}
public void setCharacteristicNotification(BleCharacteristic bleCharacteristic) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
boolean enable = !bleCharacteristic.isNotificationStarted();
Log.d(TAG, "setCharacteristicNotification(device=" + mBluetoothDeviceAddress + ", UUID="
+ bleCharacteristic.getUUID().toString() + ", enable=" + enable + ")");
BluetoothGattCharacteristic characteristic = mBluetoothGatt.getService(bleCharacteristic.getServiceUUID()).getCharacteristic(bleCharacteristic.getUUID());
mBluetoothGatt.setCharacteristicNotification(characteristic, enable);
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
descriptor.setValue(enable ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : new byte[]{0x00, 0x00});
boolean result = mBluetoothGatt.writeDescriptor(descriptor);
bleCharacteristic.setNotificationStarted(result);
Log.d(TAG, "setCharacteristicNotification(device=" + mBluetoothDeviceAddress + ", UUID="
+ bleCharacteristic.getUUID().toString() + ", enabled=" + result + ")");
}
: Burada
bir örnektir. 0_r1/stack/include/gatt_api.h # 49) bu hata 'GATT_NO_RESOURCES' anlamına gelir. – DistjuboSadece ne anlama geldiğinden emin değil, 'write' yerine' writeWithoutResponse' kullandığınızda ne olur? Bu sorununuzu çözüyor mu? – Distjubo
@Distjubo WriteWithoutResponse ile denedim ve herhangi bir hata atmadım ama sorunlar 1 yazıyor. yazdıktan sonra bir yanıt bekliyorum 2. Karakteristik tip yazılabilir YazmadıWithoutResponse – Subham