I experience major data loss on Raspi when subscribing to characteristic. My goal is to push through about 48000 bytes but I loose data at random places. The code I use is the following:
class A {
...
this.waitForData();
setTimeout(async () => {
await this.signUpForCharacteristic()
resolve()
}, 250)
waitForData() {
let swinger = this
var counter = 0
this.characteristic.on('data', (data, isNotification) => {
counter = counter + data.length
let arr = [Buffer.from(swinger.downloadedData), data];
swinger.downloadedData = Buffer.concat(arr);
process.stdout.write(`Data received: [${counter}] [${isNotification}] [${swinger.downloadedData.length}] ${common.toHexString(data)}\x1B[0G`);
});
}
async signUpForCharacteristic() {
common.logger.info('Subscribing to notification')
return new Promise((resolve, failure) => {
this.characteristic.notify(true,error => {
if (error == null) {
common.logger.info('Subscribed to notification')
resolve()
}
else {
common.logger.info(`Could not subscribe to notification: ${error.toString()}`)
failure(error)
}
})
})
}
}
Few bytes are missing. Using bluepy all data arrives perfectly 10 out 10 so it is not a hardware related issue. Also the peripheral works flawless with my mobile applications. Only Noble plays this with me.
Do you have any suggestions?
I experience major data loss on Raspi when subscribing to characteristic. My goal is to push through about 48000 bytes but I loose data at random places. The code I use is the following:
Few bytes are missing. Using bluepy all data arrives perfectly 10 out 10 so it is not a hardware related issue. Also the peripheral works flawless with my mobile applications. Only Noble plays this with me. Do you have any suggestions?