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

connection: added a more intelligent callback API #46

Merged
merged 4 commits into from
May 21, 2024

Conversation

ThomasDebrunner
Copy link
Contributor

@ThomasDebrunner ThomasDebrunner commented Mar 28, 2024

This allows to filter for message ID, system ID and component ID when registerin callbacks like so:

        connection->addMessageCallback("TEST_MESSAGE", [&callback_called_promise](const Message &message) {
           // do something
        });

}, on_message, std::function<void(const std::exception_ptr&)>{});
}

CallbackHandle addMessageCallback(const std::string &message_name, const std::function<void(const mav::Message&)> &on_message,
Copy link
Member

@GuillaumeLaine GuillaumeLaine Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not overload this to take an on_error exception handler too?

Copy link
Member

@GuillaumeLaine GuillaumeLaine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not well versed with libmav but great quality of life improvement on the surface 👍

@ThomasDebrunner ThomasDebrunner force-pushed the intelligent-callbacks branch 4 times, most recently from 514235f to 93e10d6 Compare May 21, 2024 09:51
@ThomasDebrunner ThomasDebrunner force-pushed the intelligent-callbacks branch from 93e10d6 to 501d97d Compare May 21, 2024 09:59
@ThomasDebrunner ThomasDebrunner marked this pull request as ready for review May 21, 2024 10:59
@ThomasDebrunner ThomasDebrunner merged commit e7544fb into main May 21, 2024
4 checks 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