-
-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Hi,
I'm trying to write data to a characteristic of a BLE device (following the doc I have for this) but I always get an error :
ERROR Error: Uncaught (in promise): [BluetoothError]:error_function_call, writeCharacteristic, undefined, {"peripheralUUID":"A4:C1:38:C4:28:8A","serviceUUID":"1000","characteristicUUID":"1001","value":{}}
JS: BluetoothError: error_function_call
JS: at file: src\webpack:\myapp\node_modules\@nativescript-community\ble\index.android.js:1934:32
JS: at Bluetooth.attachSubDelegate (file: src\webpack:\myapp\node_modules\@nativescript-community\ble\index.android.js:2388:12)
JS: at file: src\webpack:\myapp\node_modules\@nativescript-community\ble\index.android.js:1897:17
JS: at new ZoneAwarePromise (file: src\webpack:\myapp\node_modules\zone.js\fesm2015\zone.js:1429:0)
JS: at file: src\webpack:\myapp\node_modules\@nativescript-community\ble\index.android.js:1874:50
JS: at file: src\webpack:\myapp\node_modules\@nativescript-community\ble\index.android.js:1633:82
JS: at _ZoneDelegate.invoke (file: src\webpack:\myapp\node_modules\zone.js\fesm2015\zone.js:372:0)
JS: at Object.onInvoke (file: src\webpack:\myapp\node_modules\@angular\core\fesm2015\core.mjs:25548:0)
JS: at _ZoneDelegate.invoke (file: src\webpack:\myapp\node_modules\zone.js\fesm2015\zone.js:371:0)
JS: at Zone.run (file:///data/data/be....
Here is what I try to do in the onConnected method :
let data = new Uint8Array([0x07, 0x04, 0x03, 0x00, 0x1e]);
self.bluetooth.writeWithoutResponse({
peripheralUUID: peripheral2.UUID,
serviceUUID: "00001000-0000-1000-8000-00805f9b34fb",
characteristicUUID: "00001001-0000-1000-8000-00805f9b34fb",
value: data.buffer
}).then(() => {
...
});
I'm having a similar issue with the read function
JS: read error: [BluetoothError]:error_function_call, readCharacteristic, undefined, {"peripheralUUID":"A4:C1:38:FD:D2:38","serviceUUID":"1000","characteristicUUID":"1002"}
Here is my code for that
self.bluetooth.read({
peripheralUUID: peripheral2.UUID,
serviceUUID: '00001000-0000-1000-8000-00805f9b34fb',
characteristicUUID: '00001002-0000-1000-8000-00805f9b34fb',
}).then(function(result) {
...
});
I tried to read/write to those characteristics with a Java application and it's working so I guess this is a plugin issue ? Can you help me with that if it is ?
I use Nativescript with Angular and the phone that connects to the device is on Android 12.
Thanks in advance !
Metadata
Metadata
Assignees
Labels
No labels