Error: Try to update device name using BleClient.write() #749
Sathishkumar-ideas2IT
started this conversation in
General
Replies: 1 comment
-
|
What does your equivalent working code look like with the Cordova BLE plugin? Also, what does the device interpret the values incorrectly as? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am attempting to change the device name with the @capacitor-community/bluetooth-le library. However, when I enter a string value, the device does not properly interpret it. It works with integer numbers.
This issue does not occur when using the Cordova BLE plugin. The same device name update works fine with Cordova but fails with this Capacitor library.
Could you please give me any suggestions?
switch (characteristic.dataType.toLowerCase()) {
case "int32_t": {
const value = parseInt(inputValue);
if (isNaN(value)) {
setError("Please enter a valid number");
return;
}
// Create a DataView for 32-bit integer
const buffer = new ArrayBuffer(4);
const dataView = new DataView(buffer);
dataView.setInt32(0, value, true); // true for little-endian
Beta Was this translation helpful? Give feedback.
All reactions