We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9543620 commit 0a3a9daCopy full SHA for 0a3a9da
src/connections/ble_handler.rs
@@ -277,7 +277,13 @@ impl BleHandler {
277
pub async fn write_to_radio(&self, buffer: &[u8]) -> Result<(), Error> {
278
self.radio
279
// TODO: remove the skipping of the first 4 bytes
280
- .write(&self.toradio_char, &buffer[4..], WriteType::WithResponse)
+ .write(
281
+ &self.toradio_char,
282
+ buffer.get(4..).ok_or(Error::InvalidaDataSize {
283
+ data_length: buffer.len(),
284
+ })?,
285
+ WriteType::WithResponse,
286
+ )
287
.await
288
.map_err(|e: btleplug::Error| {
289
Error::InternalStreamError(InternalStreamError::StreamWriteError {
0 commit comments