Skip to content

Commit

Permalink
Fix inconsistent attribute indexing in get_characteristic_value
Browse files Browse the repository at this point in the history
  • Loading branch information
one-d-wide committed Mar 5, 2024
1 parent 203c9ad commit 8d02d4e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bleps/src/async_attribute_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
{
let mut cccd = [0u8; 1];
let cccd_len =
self.get_characteristic_value((idx + 1) as u16, 0, &mut cccd[..]);
self.get_characteristic_value((idx + 2) as u16, 0, &mut cccd[..]);
if let Some(1) = cccd_len {
cccd[0] == 1
} else {
Expand Down
2 changes: 1 addition & 1 deletion bleps/src/attribute_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bleps_dedup::dedup! {
offset: u16,
buffer: &mut [u8],
) -> Option<usize> {
let att = &mut self.attributes[handle as usize];
let att = &mut self.attributes[(handle as usize) - 1];

if att.data.readable() {
att.data.read(offset as usize, buffer).ok()
Expand Down

0 comments on commit 8d02d4e

Please sign in to comment.