As far as I understand it, HID works a bit like this:
That all takes a bunch of time though, so even if you get the connected event I guess the HID might not have been initialised enough that a call to the NRF HID function would actually work.
What happens if you leave a reasonable delay (5 seconds?) between connecting and trying to send any HID packets?
Also, when you're getting that error, is your Mac actually showing the device as a HID device? Or does it show it as a normal serial device?
Are you calling setServices or setAdvertising more than once at all? I guess that could mess things up too - if the services change then the CCCD numbers might change, and that could confuse the computer.
© Espruino, powered by microcosm.
Report a problem