107-Arduino-Cyphal icon indicating copy to clipboard operation
107-Arduino-Cyphal copied to clipboard

Add the ability to prioritize sending messages

Open bakul14 opened this issue 1 year ago • 5 comments

⚡ Feature Request

It is necessary to implement setting the priority subject and service messages, since this feature is available in libcanard. Here is a piece of implementation of the publish(T const & msg) method. Priority is not a parameter and it is set to CanardPriorityNominal.

template<typename T>
bool Publisher<T>::publish(T const & msg)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
  CanardTransferMetadata const transfer_metadata =
  {
   .priority       = CanardPriorityNominal,
    .transfer_kind  = CanardTransferKindMessage,
    .port_id        = _port_id,
    .remote_node_id = CANARD_NODE_ID_UNSET,
    .transfer_id    = _transfer_id++,
  };
#pragma GCC diagnostic pop

There are 2 possible solutions:

  1. Add the ability to set priority through the publisher/subscriber/client/server constructor.
  2. Pass priority as a parameter to the publish() method and others.

bakul14 avatar Jul 03 '24 11:07 bakul14

I am willing to merge a high quality pull request providing this functionality using the first approach.

aentinger avatar Jul 03 '24 11:07 aentinger

Okay, it's good. I am ready to check your PR

bakul14 avatar Jul 03 '24 15:07 bakul14

I am willing to receive your PR ;)

aentinger avatar Jul 03 '24 15:07 aentinger

Ive performed a local commit and am ready to show it, I need write rights to this repository

bakul14 avatar Jul 03 '24 21:07 bakul14

@bakul14 that's not how it works. You need to fork this repository, push your changes there, then send a pull request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

image

pavel-kirienko avatar Jul 03 '24 21:07 pavel-kirienko