Loading system/gd/rust/linux/stack/src/bluetooth_gatt.rs +1 −1 Original line number Diff line number Diff line Loading @@ -989,7 +989,7 @@ impl BtifGattClientCallbacks for BluetoothGatt { let client = self.context_map.get_by_uuid(&app_uuid.uu); if client.is_none() { warn!("Warning: Client not registered for UUID {:?}", app_uuid.uu); warn!("Warning: Client not registered for UUID {}", app_uuid); return; } Loading system/gd/rust/linux/stack/src/uuid.rs +14 −7 Original line number Diff line number Diff line //! Collection of Profile UUIDs and helpers to use them. use std::collections::{HashMap, HashSet}; use std::fmt::{Display, Formatter}; use bt_topshim::btif::Uuid128Bit; use bt_topshim::btif::{Uuid, Uuid128Bit}; // List of profile uuids pub const A2DP_SINK: &str = "0000110B-0000-1000-8000-00805F9B34FB"; Loading Loading @@ -69,6 +70,17 @@ pub enum Profile { CoordinatedSet, } /// Wraps a reference of Uuid128Bit, which is the raw array of bytes of UUID. /// This is useful in implementing standard Rust traits which can't be implemented directly on /// built-in types (Rust's Orphan Rule). pub struct UuidWrapper<'a>(pub &'a Uuid128Bit); impl<'a> Display for UuidWrapper<'a> { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { Uuid::format(&self.0, f) } } pub struct UuidHelper { /// A list of enabled profiles on the system. These may be modified by policy. pub enabled_profiles: HashSet<Profile>, Loading Loading @@ -150,12 +162,7 @@ impl UuidHelper { /// Converts a UUID byte array into a formatted string. pub fn to_string(uuid: &Uuid128Bit) -> String { return String::from(format!("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15])); UuidWrapper(&uuid).to_string() } /// Converts a well-formatted UUID string to a UUID byte array. Loading system/gd/rust/topshim/src/btif.rs +19 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use crate::topstack::get_dispatchers; use num_traits::cast::{FromPrimitive, ToPrimitive}; use std::cmp; use std::convert::TryFrom; use std::fmt::{Debug, Formatter, Result}; use std::fmt::{Debug, Display, Formatter, Result}; use std::mem; use std::os::raw::c_char; use std::sync::{Arc, Mutex}; Loading Loading @@ -312,6 +312,24 @@ impl TryFrom<Vec<u8>> for Uuid { } } impl Uuid { /// Formats this UUID to a human-readable representation. pub fn format(uuid: &Uuid128Bit, f: &mut Formatter) -> Result { write!(f, "{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]) } } impl Display for Uuid { fn fmt(&self, f: &mut Formatter) -> Result { Uuid::format(&self.uu, f) } } /// All supported Bluetooth properties after conversion. #[derive(Debug, Clone)] pub enum BluetoothProperty { Loading Loading
system/gd/rust/linux/stack/src/bluetooth_gatt.rs +1 −1 Original line number Diff line number Diff line Loading @@ -989,7 +989,7 @@ impl BtifGattClientCallbacks for BluetoothGatt { let client = self.context_map.get_by_uuid(&app_uuid.uu); if client.is_none() { warn!("Warning: Client not registered for UUID {:?}", app_uuid.uu); warn!("Warning: Client not registered for UUID {}", app_uuid); return; } Loading
system/gd/rust/linux/stack/src/uuid.rs +14 −7 Original line number Diff line number Diff line //! Collection of Profile UUIDs and helpers to use them. use std::collections::{HashMap, HashSet}; use std::fmt::{Display, Formatter}; use bt_topshim::btif::Uuid128Bit; use bt_topshim::btif::{Uuid, Uuid128Bit}; // List of profile uuids pub const A2DP_SINK: &str = "0000110B-0000-1000-8000-00805F9B34FB"; Loading Loading @@ -69,6 +70,17 @@ pub enum Profile { CoordinatedSet, } /// Wraps a reference of Uuid128Bit, which is the raw array of bytes of UUID. /// This is useful in implementing standard Rust traits which can't be implemented directly on /// built-in types (Rust's Orphan Rule). pub struct UuidWrapper<'a>(pub &'a Uuid128Bit); impl<'a> Display for UuidWrapper<'a> { fn fmt(&self, f: &mut Formatter) -> std::fmt::Result { Uuid::format(&self.0, f) } } pub struct UuidHelper { /// A list of enabled profiles on the system. These may be modified by policy. pub enabled_profiles: HashSet<Profile>, Loading Loading @@ -150,12 +162,7 @@ impl UuidHelper { /// Converts a UUID byte array into a formatted string. pub fn to_string(uuid: &Uuid128Bit) -> String { return String::from(format!("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15])); UuidWrapper(&uuid).to_string() } /// Converts a well-formatted UUID string to a UUID byte array. Loading
system/gd/rust/topshim/src/btif.rs +19 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use crate::topstack::get_dispatchers; use num_traits::cast::{FromPrimitive, ToPrimitive}; use std::cmp; use std::convert::TryFrom; use std::fmt::{Debug, Formatter, Result}; use std::fmt::{Debug, Display, Formatter, Result}; use std::mem; use std::os::raw::c_char; use std::sync::{Arc, Mutex}; Loading Loading @@ -312,6 +312,24 @@ impl TryFrom<Vec<u8>> for Uuid { } } impl Uuid { /// Formats this UUID to a human-readable representation. pub fn format(uuid: &Uuid128Bit, f: &mut Formatter) -> Result { write!(f, "{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]) } } impl Display for Uuid { fn fmt(&self, f: &mut Formatter) -> Result { Uuid::format(&self.uu, f) } } /// All supported Bluetooth properties after conversion. #[derive(Debug, Clone)] pub enum BluetoothProperty { Loading