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

Extend api with canardRxGetSubscription #222

Closed
serges147 opened this issue Apr 15, 2024 · 3 comments · Fixed by #224
Closed

Extend api with canardRxGetSubscription #222

serges147 opened this issue Apr 15, 2024 · 3 comments · Fixed by #224
Assignees

Comments

@serges147
Copy link
Contributor

serges147 commented Apr 15, 2024

c++ libcyphal needs api to detect already existing subscription (without "touching" one if any).
Here is proposal:

/// This function allows to check the effect of canardRxSubscribe() and canardRxUnsubscribe().
/// The return value is 1 if the specified subscription exists, 0 otherwise.
/// The return value is a negated invalid argument error if any of the input arguments are invalid.
int8_t canardRxGetSubscription(CanardInstance* const       ins,
                               const CanardTransferKind    transfer_kind,
                               const CanardPortID          port_id,
                               CanardRxSubscription* const out_subscription);
@serges147
Copy link
Contributor Author

Looks like canardRxHasSubscription() → bool is enough - we only need to check for possible double subscription for the same kind & port pair.

@pavel-kirienko
Copy link
Member

I actually wanted to mention this earlier but forgot: since we'll have to find that specific subscription in the tree anyway, should we not keep canardRxGetSubscription as it is more versatile? There are sensible use cases where one might want to find an existing subscription to modify it.

@serges147 serges147 changed the title Extend api with canardRxGetSubscription Extend api with canardRxHasSubscription May 6, 2024
@serges147
Copy link
Contributor Author

ok, I revert back to → canardRxGetSubscription

@serges147 serges147 changed the title Extend api with canardRxHasSubscription Extend api with canardRxGetSubscription May 6, 2024
@pavel-kirienko pavel-kirienko linked a pull request May 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants