-
Notifications
You must be signed in to change notification settings - Fork 148
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
When creating endpoints allow passing in user data #17
Comments
Is your end goal to just have a user_data or like a led_handle (similar to the current button_handle) and use it in the driver? Or do you have some other requirement/use-case with the user_data as a part of the endpoint? |
When I create 8 identical end points I need some mechanism to tell which copy of my internal data is associated with the end point. In the existing samples this is not an issue because you aren't creating multiple, identical endpoints - there is a single data structure. A handle and user data pointer are basically the same thing. I'm trying to store a pointer to the data structure I allocated to support each copy of the end point. I've allocated 8 copies of this structure, how do I associate them with the end points? If don't want to use a loop and search my structures for matching endpoint numbers, better to let me store a handle/user_pointer in your endpoint structure. |
Thanks! This is useful and will be applicable in many of the usecases. We have added a provision to pass user data to the endpoints |
In our keypad I need to create eight identical endpoints containing: dimmable_light, switch and generic switch. So when I am iterating in app_driver_attribute_set_defaults I need to be able to map the endpoint to a pointer into my data structure. This will let me pass the same pointer into the triplets of (light, switch, generic_sw) and associate them with each other.
Do clusters need user data?
You could also allow passing in a function pointers. This could be eliminated if the attributes stored function pointers.
Then call like this:
app_driver_light_set_temperature(userdata, value)
app_driver_attribute_set_defaults() could then move into the esp_matter library.
The text was updated successfully, but these errors were encountered: