Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add PeripheralId new method for Android and Linux #396

Open
Yongle-Fu opened this issue Aug 23, 2024 · 0 comments
Open

add PeripheralId new method for Android and Linux #396

Yongle-Fu opened this issue Aug 23, 2024 · 0 comments

Comments

@Yongle-Fu
Copy link

Yongle-Fu commented Aug 23, 2024

pub fn to_peripheral_id(id: &str) -> PeripheralId {

    #[cfg(any(target_os = "macos", target_os = "ios"))]
    return PeripheralId::from(Uuid::parse_str(id_str).unwrap());

    #[cfg(target_os = "windows")]
    PeripheralId::from(BDAddr::from_str_delim(&id_str).unwrap())

    #[cfg(target_os = "android")]
    return PeripheralId(BDAddr::from_str_delim(&id_str).unwrap());

    #[cfg(target_os = "linux")]
    return PeripheralId::from(bluez_async::DeviceId::new(id));
}

why not provide public method

droidplug/peripheral.rs:42:25
|
42 | pub struct PeripheralId(pub(super) BDAddr);
| ^^^^^^^^^^^^^^^^^ private field

bluez-async-0.8.0/src/device.rs:22:5
|
22 | pub(crate) fn new(object_path: &str) -> Self {
| -------------------------------------------- private associated function defined here

@Yongle-Fu Yongle-Fu changed the title add PeripheralId new method for android add PeripheralId new method for Android and Linux Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant