Determine size of event_data in esp_event_handler
Posted: Thu Jan 25, 2024 7:54 pm
I'm using an eventloop to distribute events accross my system, and I really love this system. I'ts perfect for decoupling dependencies between parts of the system and its helped me a lot.
One thing i dont understand is that, when posting an event, you provide a pointer to the event data, and the size of the data. But when an event_handler gets called, it is only provided with a pointer to the (copy of) the event_data and there is no way to determine the size of the data.
Now mostly this isnt a problem as most of the events I use have a known, fixed size data, but now I need to allow for a dynamically sized data structure (BLE advertisements to be precise) and it will be very hard to handle the event if I don't know the data-size in the event_handler...
Anybody else struggling with this problem? Or am I doning something wrong / overlooking something?
Any help is appreciated
One thing i dont understand is that, when posting an event, you provide a pointer to the event data, and the size of the data. But when an event_handler gets called, it is only provided with a pointer to the (copy of) the event_data and there is no way to determine the size of the data.
Now mostly this isnt a problem as most of the events I use have a known, fixed size data, but now I need to allow for a dynamically sized data structure (BLE advertisements to be precise) and it will be very hard to handle the event if I don't know the data-size in the event_handler...
Anybody else struggling with this problem? Or am I doning something wrong / overlooking something?
Any help is appreciated