-
Notifications
You must be signed in to change notification settings - Fork 551
Description
Prerequisites
- I checked the documentation and FAQ without finding a solution
- I checked to make sure that this issue has not already been filed
Expected Behavior
On iOS with 3.50 calls to readcharacteristic sometimes return the value for a different characteristic. While I haven't looked at the Java I suspect it's returning the Promise early and the next iteration is then conflicting. If readCharacteristic should support parallel async calls then the internal code must have an issue, but here I am sequencing them.
It's only occurring on iOS and only sometimes but this will be down to timing/race. I've also tried the Promise patch file from the other PR. I didn't see this or have it reported by users on 3.2.* and will roll back.
Here's the code I have which will occasionally return the value for a different characteristic. I've verified with a user when it occurs the value returned for one characteristic is actually the value for another.
for (const { name, uuid } of service.characteristics
.filter(({ read }) => read)) {
const {value} = await device.readCharacteristicForService(service.uuid, uuid);
const output = ret.characteristics[name];
const buffer = decodeBase64(value);
output.bufferLength = buffer.length;
addDebug(`Read ${name} of length ${buffer.length}`);
...
Current Behavior
It's unreliable.
Library version
3.5.0
Device
iOS
Environment info
N/ASteps to reproduce
N/A
Formatted code sample or link to a repository
NoRelevant log output
N/AAdditional information
No response