107-Arduino-Cyphal
107-Arduino-Cyphal copied to clipboard
Add the ability to prioritize sending messages
⚡ 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:
- Add the ability to set priority through the publisher/subscriber/client/server constructor.
- Pass priority as a parameter to the publish() method and others.