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 descriptor and attribute value to gatt_service proc macro #239

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

HaoboGu
Copy link
Contributor

@HaoboGu HaoboGu commented Mar 4, 2024

Descriptor and attribute value settings are commonly used in BLE characteristic, with this PR, they can be specified as:

#[nrf_softdevice::gatt_service(uuid = "1812")]
pub struct HidService {
    #[characteristic(
        uuid = "2A4D",
        read,
        write,
        value = "[0u8, 1u8]",
        descriptor(uuid = "2908", security = "justworks", value = "[0, 1]")
    )]
    pub data: [u8; 1],

@alexmoon
Copy link
Contributor

alexmoon commented Mar 5, 2024

Can you add an example to the examples project demonstrating how this is used?

@HaoboGu
Copy link
Contributor Author

HaoboGu commented Mar 6, 2024

Sure, will do!

@alexmoon
Copy link
Contributor

alexmoon commented Mar 6, 2024

Is it possible to allow multiple descriptors per characteristic by repeating the descriptor(...) argument?

@HaoboGu
Copy link
Contributor Author

HaoboGu commented Mar 6, 2024

It might be possible, I'm not sure.. will have a try tomorrow!

@HaoboGu
Copy link
Contributor Author

HaoboGu commented Mar 7, 2024

Multiple descriptor fields is supported. Just tested it, works fine.

@alexmoon alexmoon added this pull request to the merge queue Mar 7, 2024
Merged via the queue into embassy-rs:master with commit cdee83c Mar 7, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants