Closed oyren closed 1 year ago
Added the feature to reject received data in the on_write
callback.
Please check.
Thank you, i appreciate your work.
The change to "simply" don't set the new value (if the reject flag is set to true
) is already quite useful for me and works as expected.
Disclaimer: Here's what I wanted to note/suggest, but as it turns out, I don't understand the spec [1] (maybe you have more knowledge in this field).
However, an even better solution (IMHO) would be to report an error code like specified in the BLE spec (if possible).
For example, i could report the error code 0x0105
(Insufficient authentication) or 0x010D
Invalid value size.
But as mentioned above, it seems like i have some missing information here, since i don't see the bridge between the spec error codes ([1] page 370) and the codes listed here.
[1] BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 1, Part F (Revision Date: 2021-07-13)
Thanks for your comment. I am not familiar with error codes either, but I found an answer that be helpful. https://stackoverflow.com/questions/74394100/how-to-respond-to-ble-gatt-write-request-with-invalid-attribute-value
Currently, even if a request is rejected, a success response is returned. I will make a partial change to the specification to allow rejection with an error code.
Thanks, the link was very helpful.
Appreciated
NimBLE-Arduino has the possibility to set a maximum length of bytes which a characteristic supports (https://h2zero.github.io/NimBLE-Arduino/class_nim_b_l_e_characteristic.html#aa32224e69115e9ba60ac614e8f37a871`max_length`), i don't see this possibility here.
In my opinion it would be useful to reject some kind of values. Or is there an option to reject values e.g. in the
on_write
callback which i have overlooked?Thanks in advance.
WDYT? Btw. thanks for this crate.