Merge changes I422445af,I9c995127 into main

* changes:
  uwb/aidl/default: Use write_all instead of write in sendUciMessage
  uwb/aidl/default: Log incoming and outgoing packet bytes
This commit is contained in:
Henri Chataing
2024-03-15 15:28:07 +00:00
committed by Gerrit Code Review

View File

@@ -241,6 +241,7 @@ impl IUwbChipAsyncServer for UwbChip {
// Read the payload bytes.
read_exact(reader.get_mut(), &mut buffer[UWB_HEADER_SIZE..]).unwrap();
log::debug!(" <-- {:?}", buffer);
client_callbacks.onUciMessage(&buffer).unwrap();
}
});
@@ -295,10 +296,13 @@ impl IUwbChipAsyncServer for UwbChip {
log::debug!("sendUciMessage");
if let State::Opened { ref mut serial, .. } = &mut *self.state.lock().await {
serial
.write(data)
.map(|written| written as i32)
.map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into())
log::debug!(" --> {:?}", data);
let result = serial
.write_all(data)
.map(|_| data.len() as i32)
.map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into());
log::debug!(" status: {:?}", result);
result
} else {
Err(binder::ExceptionCode::ILLEGAL_STATE.into())
}