When handling a ReadRequest, neither can the user see the the MTU, nor is it checked whether the value passed in is short enough:
while let Some(event) = rx.next().await {
match event {
Event::ReadRequest(read_request) => {
read_request
.response
.send(Response::Success(something().to_vec()))
.unwrap();
}
}
}
On the gatt-api side, the MTU is part of the ReadValue method as an option. I did not find the error behavior documented, but my observation is that responding with more bytes than the MTU indicates just leads to transmission of a truncated response, whereas I think good practice in Rust would be to indicate this through an error.
When handling a ReadRequest, neither can the user see the the MTU, nor is it checked whether the value passed in is short enough:
On the gatt-api side, the MTU is part of the ReadValue method as an option. I did not find the error behavior documented, but my observation is that responding with more bytes than the MTU indicates just leads to transmission of a truncated response, whereas I think good practice in Rust would be to indicate this through an error.