I timed every step as you said, the service discovery takes most of the time, up to 4 seconds.
Bonding does make a difference but below one second and since it's apparently necessary to do before doing anything else, I'll leave that in for now (when I moved it to later in the code, it didn't work anymore).
When I have the primaryService, the characteristics take about 300ms each, and maybe I can even shorten that by just using getCharacteristics and directly assinging both instead of looking for both indivitually. But this is also small compared to the time it takes for the primaryService.
Is there any way to "cache" the primaryService for later use (and store it in a JSON or something like that)?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I timed every step as you said, the service discovery takes most of the time, up to 4 seconds.
Bonding does make a difference but below one second and since it's apparently necessary to do before doing anything else, I'll leave that in for now (when I moved it to later in the code, it didn't work anymore).
When I have the primaryService, the characteristics take about 300ms each, and maybe I can even shorten that by just using getCharacteristics and directly assinging both instead of looking for both indivitually. But this is also small compared to the time it takes for the primaryService.
Is there any way to "cache" the primaryService for later use (and store it in a JSON or something like that)?