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

Reading a characteristic doesn't work. #54

Open
bWanShiTong opened this issue May 12, 2024 · 0 comments
Open

Reading a characteristic doesn't work. #54

bWanShiTong opened this issue May 12, 2024 · 0 comments

Comments

@bWanShiTong
Copy link

When adding characteristic with uuid 0x2a29 which is uuid for manufactured name string and other primary services read doesn't work.

Code for service:

fn device_information() -> Service {
    let (write, mut read) = channel(1);

    tokio::spawn(async move {
        while let Some(data) = read.next().await {
            dbg!(&data);
            match data {
                Event::ReadRequest(read) => {
                    read.response
                        .send(Response::Success("WHOOP Inc.".as_bytes().to_owned()))
                        .expect("Error sending");
                }
                Event::WriteRequest(_) => todo!(),
                Event::NotifySubscribe(_) => todo!(),
                Event::NotifyUnsubscribe => todo!(),
            }
        }
        todo!();
    });

    let manufacturer_name_string = Characteristic::new(
        Uuid::from_sdp_short_uuid(0x2a29 as u32),
        Properties::new(
            Some(Read(Secure::Insecure(write.clone()))),
            None,
            None,
            None,
        ),
        Some("Whoop Inc.".as_bytes().to_owned()),
        HashSet::default(),
    );
    let characteristics = [manufacturer_name_string].into_iter().collect();

    Service::new(
        Uuid::from_sdp_short_uuid(0x180A as u32),
        true,
        characteristics,
    )
}

Full code

@bWanShiTong bWanShiTong changed the title Read a characteristic doesn't work. Reading a characteristic doesn't work. May 12, 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