Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix (NetworkEvents lib) remove checks for duplicated event handlers (#…
…10376) * lib Network: add cpp syntax to structs * [Network] deprecate NetworkEvents::removeEvent() for std::function callbacks removing event callback via std::function pointer does not work as expected for lambdas (issue #10365) here mark NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX) as deprecated in favor of removing by callback's id for NetworkEvents::onEvent remove checking for dublicate event handler, this does not work for lambdas too remove NetworkEvents::find methods as unnecessary move cbEventList container inside the class declare NetworkEventCbList_t as a cpp struct with constructor, allows using std::vector.emplace() when adding new items to container optimize NetworkEvents::remove() calls to use erase-remove idiom for std::vector * [Network] hide event task under private member of NetworkEvents class prevent checkForEvent loop to be callable from outside the task's thread * refactor(NetworkEvents) code polishing and comments - rename NetworkEvents::cbEventList as private member NetworkEvents_cbEventList - NetworkEvents::getStatusBits() add const qualifier - turn statics into constexpr - add indexes to enum::arduino_event_id_t to make events indexing consistent for SOCs with/without WiFi also leave some index gaps to minimize renumbering on adding new events - add doxygen help to NetworkEvents:: methods - declare NetworkEvents::eventName() as static, that could be used without creating class scope - potential mem leak in postEvent * refactor(NetworkEvents) add (optional) mutex lock for container operations provide thread safety for dual core SoCs since std::mutex brings additional componetns of libstdc++ lib it impacts resulting image size significantly (around 50k) Might be enabled on-demand if thread-safety is required * ci(pre-commit): Apply automatic fixes * fix(spelling): Fix spelling mistakes --------- Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
- Loading branch information