You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a characteristic that is a string. If I use nRF Connect and Write value as text, and leave the New value field empty and Send, I get feedback from my write event handler for the characteristic receives a non-blank string:
The value received by the callback happens to be a string that has length 1 and contains just the first letter of the previously initialized value of the characteristic. This seems like new behavior / a bug to me. What do you think?
Incidentally, that's the same result I get from my own app instead of nRF connect, which uses the @capacitor-community/bluetooth-le plugin and does this:
import { BleClient, RequestBleDeviceOptions, numbersToDataView } from '@capacitor-community/bluetooth-le';
...
// value is a string to be sent
const bytes: number[] = value.split('').map(v => v.charCodeAt(0));
const dv = numbersToDataView(bytes);
await BleClient.write(deviceId, _service, _characteristic, dv, {timeout});
... to be clear, this used to work just fine.
The text was updated successfully, but these errors were encountered:
My workaround is to change my app to append a null terminator explicitly:
import { BleClient, RequestBleDeviceOptions, numbersToDataView } from '@capacitor-community/bluetooth-le';
...
// value is a string to be sent
const bytes: number[] = value.split('').map(v => v.charCodeAt(0));
bytes.push(0x00); // ADDED THIS LINE
const dv = numbersToDataView(bytes);
await BleClient.write(deviceId, _service, _characteristic, dv, {timeout});
I have a characteristic that is a string. If I use nRF Connect and Write value as text, and leave the New value field empty and Send, I get feedback from my write event handler for the characteristic receives a non-blank string:
The value received by the callback happens to be a string that has length 1 and contains just the first letter of the previously initialized value of the characteristic. This seems like new behavior / a bug to me. What do you think?
Incidentally, that's the same result I get from my own app instead of nRF connect, which uses the @capacitor-community/bluetooth-le plugin and does this:
... to be clear, this used to work just fine.
The text was updated successfully, but these errors were encountered: