Skip to content

Commit

Permalink
Add MTU property to Characteristic (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmoon authored Sep 13, 2023
1 parent cfc9363 commit 1bad12c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bluer-tools/src/gattcat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ impl DiscoverOpts {
};
println!(" Characteristic {char_id}");

print_if_some(6, "MTU", char.mtu().await.ok(), "bytes");

let flags = char.flags().await?;
print_if_some(6, "Flags", Some(char_flags_to_vec(&flags).join(", ")), "");
if flags.read {
Expand Down
11 changes: 11 additions & 0 deletions bluer/src/gatt/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,17 @@ define_properties!(
dbus: (CHARACTERISTIC_INTERFACE, "Value", Vec<u8>, MANDATORY),
get: (cached_value, v => {v.to_owned()}),
);

/// The maximum transmission unit for the characteristic.
///
/// This is the maximum amount of data that can be sent or received
/// in a single packet for this characteristic. Longer data may be
/// able to be sent or received using long procedures when available.
property(
Mtu, usize,
dbus: (CHARACTERISTIC_INTERFACE, "MTU", u16, MANDATORY),
get: (mtu, v => { (*v).into() }),
);
}
);

Expand Down

0 comments on commit 1bad12c

Please sign in to comment.