New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating BLE data for GATT Characteristics #915
Comments
Just to make sure I understand things correctly: the parameter to When compared to the simple |
A corollary is that maybe |
Yes, that all sounds good. I'd iterate through the structure in a similar way to setServices, but then if you can't find the relevant UUID just throw an error. For now it would be easier to just ignore any non-'value' entries, and it has the benefit that a user could keep the structure they had used previously, update the value element, and re-use it. |
Good idea. |
I just pushed some changes that fix issues related to setServices. It's work doing a pull because it might save you some problems when debugging :) |
I just pulled the changes thanks! |
Did you ever have any luck with this, or should I push on with it? |
Sorry, I should have touched base before I went on holiday. I am currently away until the end of the month and I don't have my dev boards with me. I still had a few issues with the code I had written before I left but, for the most part, the call to |
I think I am going to need a little help here... I pushed some working code on my repo: master...ddm:issue-915 The remaining thing to implement is getting the proper characteristic handle (cf. Otherwise, |
Thanks for that! All I can see is sd_ble_gatts_attr_get - you might be able to iterate through the handles checking their UUIDs? Realistically there should be <10 handles, so iteration wouldn't be the end of the world. |
From what I understand |
Yes, you'd have to try out all the handles (they're sequential I think?) until you got an error message, checking each one until you got the right UUID. Otherwise, yes - I guess it'd be a matter of storing the mapping somewhere. |
Hopefully this is the correct way to do it: #933 Keeping the mapping seems unnecessary at this point unless the calls to |
I think #933 mostly addresses the issue but indication (aka. notification+ACK) support is still missing. Adding |
Also, I should test tomorrow if updates without notification work properly. |
Yes, a PR for that would be great - I'm fine with just mentioning this issue in it. Would that involve calling some JS code when the ACK was received as well? Just one extra question - while looking at the API, did you find a nice way of removing attributes? As it is, |
I'll check if an 'onAck' callback is possible to implement, but it is not strictly necessary to act on the ACK from JS. I haven't found a good way to modify services and characteristics after they have been defined. The following line in the documentation makes me think there are some limitations to rearranging things after the initial setup: "It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time)." |
Thanks - don't worry about the ack too much - it might be possible to do it in the same way as the write handler, but to be honest the callbacks could probably do with a bit of work. |
MVP support for indication is available in #935. I'll keep an eye out for ways to modify the attribute table but I don't have high hopes. |
Thanks! I just made a new bug for the setServices issue: #936 Something needs to be done, because if you do As you say, I doubt we can modify, but I'd hope that the attribute table could be wiped clean - even if that involved resetting the softdevice. |
Fixed :) |
See here:
http://forum.espruino.com/conversations/292530/#comment13202382
Looks like
NRF.updateServices({ ... })
is the easiest/least confusing for users.The text was updated successfully, but these errors were encountered: