Skip to content
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

Add support for variable length charactersitics #149

Open
petekubiak opened this issue Oct 25, 2024 · 2 comments
Open

Add support for variable length charactersitics #149

petekubiak opened this issue Oct 25, 2024 · 2 comments

Comments

@petekubiak
Copy link
Collaborator

Currently, characteristic data is treated as a fixed size byte array. This means that characteristics with variable length data are not fully supported.

If a characteristic is defined as a heapless::Vec, the entire struct will be sent (metadata and payload) regardless of the current length of the data inside. On receiving, it is likely that a write command will be rejected unless a byte array matching the exact size of the heapless::Vec in memory is received.

nrf-softdevice interprets characteristics with the Vec type as variable length, and will only send bytes corresponding to the current length of the vector on transmission. On reception, it will read in a variable number of bytes and update the length an contents of the characteristic's vector accordingly.

I think it's worth implementing the same functionality in TrouBLE.

@lulf
Copy link
Member

lulf commented Oct 25, 2024

I think #133 would also allow this maybe in a more efficient way?

@petekubiak
Copy link
Collaborator Author

Ah interesting. In all honesty when I first read #133 I didn't have enough knowledge of TrouBLE to properly absorb the extent of the changes. I'll give it another look now I've had a few more weeks' exposure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants