-
|
I am developing a class Scanner extends BLEClient {
...
onServices(services: Service[]) {
services[0]?.discoverAllCharacteristics()
}
onCharacteristics(characteristics: Characteristic[]) {
characteristics.forEach((characteristic) => {
characteristic.enableNotifications()
})
}
onCharacteristicNotificationEnabled(characteristic: Characteristic) {
trace(`[characteristicNotificationEnabled]:${characteristic.uuid.toString()}\n`)
}
...
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
|
I apologize for being slow to look into this.
On ESP32, the Moddable SDK uses the NimBLE APIs. This implementation is here in the SDK. The use of How can I reproduce the problem you are seeing? |
Beta Was this translation helpful? Give feedback.
-
Cool. I remember Sony's first steps into this kind of product. I didn't realize that they had continued.
Perfect. Thank you! |
Beta Was this translation helpful? Give feedback.
-
|
I added logging of all NimBLE failure codes to the BLE Client in debug builds. That gives all the information we have about the failure. As a rule, we don't include lots of explanation in exceptions because doing so accurately can require quite a bit of code - and misleading guidance can be worse than none. I'm open to suggestions. Perhaps a comment in the C source code where the exception is thrown? That will be visible to developers in xsbug and requires no additional code. |
Beta Was this translation helpful? Give feedback.
Great investigation! So, the problem is mostly configuration. The NimBLE stack must be configured to queue only up to 4 outgoing messages.
I think the pragmatic solution is that the
enableNotifications()call should throw when the request fails; today it ignores the returned error. That would tell you that there is a problem, rather than failing silently. Then you can either change thesdkconfigto increase the number of queued requests or change your code to issue the requests serially, as you did above.An alternate solution is to implement a queue in the Moddable SDK BLE bindings. However, that is a lot of code and complexity that doesn't seem justified here, given that this issue is r…