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 default_value and descriptor to characteristic macro #175

Open
HaoboGu opened this issue Nov 22, 2024 · 2 comments
Open

Add default_value and descriptor to characteristic macro #175

HaoboGu opened this issue Nov 22, 2024 · 2 comments
Milestone

Comments

@HaoboGu
Copy link

HaoboGu commented Nov 22, 2024

Current gatt service macro fills 0s as the AttributeData:

let store = #name_screaming.init([0; size_of::<#ty>()]);

It would be very useful if users could set the value of AttributeData.

I found the following code blocks in host-macro, it seems value and descriptor macro args are not implemented. May I ask that is there any plan to finish this?

"value" => {
return Err(Error::custom("Default value is currently unsupported").with_span(&meta.path.span()).into())
// let value = meta
// .value()
// .map_err(|_| Error::custom("value must be followed by '= [data]'. i.e. value = 'hello'".to_string()))?;
// default_value = Some(value.parse()?);
},
other => return Err(
meta.error(
format!(
"Unsupported characteristic property: '{other}'.\nSupported properties are: uuid, read, write, write_without_response, notify, indicate, value"
))),

@jamessizeland
Copy link
Collaborator

It is on the to-do list yes 😊, you're welcome to PR an implementation, but also good to know it's a wanted feature so we can prioritise it.

@jamessizeland jamessizeland added this to the 0.1 milestone Nov 22, 2024
@HaoboGu
Copy link
Author

HaoboGu commented Nov 23, 2024

yeah, this is commonly used in HID over BLE, for example, setting hid info and report map

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

2 participants