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
Describe the bug
The plugin is being used to connect a Bluetooth device to the mobile. It works up to setting the notification on the mobile device to check changes in the characteristics. I know this because the Bluetooth device starts blinking differently.
But when I try to write into a characteristic it's not raising the callback set on the notification. Secondly, the device should have a 3rd set of blinking when an instruction is written in a characteristic, which never happens.
For what is worth, I have set all the necessary code in a Android Java app and it works correctly, so the Bluetooth device is working correctly
To Reproduce
Steps to reproduce the behavior:
Go to connect device and choose the device
Instructions use up to here
´´´
// plugin initialize
await BleClient.initialize()
// to connect the device
await BleClient.connect(id, (deviceId) => this.onDisconnect(deviceId));
// to search in all the services and characteristics of the device and choose the right one
await BleClient.getServices(id);
// to make sure there is no other notification set on the mobile device
await BleClient.stopNotifications(deviceId, serviceId, characteristic);
// set the notification, this instruction change the blinking on the BT device, so it's working
await BleClient.startNotifications(
deviceId,
serviceId,
characteristicId,
(value) => {
console.log('current heart rate', value);
// 1st ERROR: the notification callback doesn't run
// 2nd ERROR: the notification callback doesn't run on another instruction and the 2nd blinking change never happens. Which give the idea that the written have never taken place
´´´
Expected behavior
Callback notification raise
BT device changes the set of blinking lights to acknowledge the instructions are being set correctly
Screenshots
Plugin version:
"@capacitor-community/bluetooth-le": "^6.0.1"
The text was updated successfully, but these errors were encountered:
Describe the bug
The plugin is being used to connect a Bluetooth device to the mobile. It works up to setting the notification on the mobile device to check changes in the characteristics. I know this because the Bluetooth device starts blinking differently.
But when I try to write into a characteristic it's not raising the callback set on the notification. Secondly, the device should have a 3rd set of blinking when an instruction is written in a characteristic, which never happens.
For what is worth, I have set all the necessary code in a Android Java app and it works correctly, so the Bluetooth device is working correctly
To Reproduce
Steps to reproduce the behavior:
Instructions use up to here
´´´
// plugin initialize
await BleClient.initialize()
// to connect the device
await BleClient.connect(id, (deviceId) => this.onDisconnect(deviceId));
// to search in all the services and characteristics of the device and choose the right one
await BleClient.getServices(id);
// to make sure there is no other notification set on the mobile device
await BleClient.stopNotifications(deviceId, serviceId, characteristic);
// set the notification, this instruction change the blinking on the BT device, so it's working
await BleClient.startNotifications(
deviceId,
serviceId,
characteristicId,
(value) => {
console.log('current heart rate', value);
// send the instructions to the device
const message = 'P : 2 , 3 , 5 , 6';
const arrayString = message.split(' ');
const buffer = new ArrayBuffer(arrayString.length);
const view = new DataView(buffer, 0);
for (let i = 0; i < arrayString.length; i++) {
let v;
if ( typeof arrayString[i] === 'string' && arrayString[i].charAt(1) === 'x' ) {
const hexString = arrayString[i];
const hex = hexString.replace(/^0x/, '');
v = hex.match(/[\dA-F]{2}/gi);
}
else if ( typeof arrayString[i] === 'number' ) {
v = arrayString[i];
}
else {
v = new TextEncoder().encode(arrayString[i]);
console.log('hex', arrayString[i], v);
}
view.setUint8(i,v);
}
// 1st ERROR: the notification callback doesn't run
// 2nd ERROR: the notification callback doesn't run on another instruction and the 2nd blinking change never happens. Which give the idea that the written have never taken place
´´´
Expected behavior
Screenshots
Plugin version:
The text was updated successfully, but these errors were encountered: