Hello,
I think that I don’t exactly understand how I should work with transfer-ID when using Libcanard. I have read official repository, specification v1.0 and several open source libraries and repositories (like 107-Arduino-UAVCAN). But there is still one little question: should I create unique transfer-ID for each subject? In the official example of Libcanard one can find this comment:
...
++my_message_transfer_id; // The transfer-ID shall be incremented after every transmission on this subject.
...
But in this example only one message is transferring. So suppose that if I have 3 publishing functions:
void publishHeartbeat(CanardInstance* const canard, const uint32_t uptime);
void publishTemperature(CanardInstance* const canard, float temperature);
void publishSpeed(CanardInstance* const canard, float speed);
Should I create static variable for storing transfer-ID counter in each of this functions ?
Also is it correct that Libcanard takes care of the transfer-ID overflow (modulo 32)? If yes then is it necessary for user to do something like this (ArduinoUAVCAN.cpp):
CanardTransferID ArduinoUAVCAN::getNextTransferId(CanardPortID const port_id)
{
CanardTransferID const next_transfer_id = (_tx_transfer_map.count(port_id) > 0) ? ((_tx_transfer_map[port_id] + 1) % CANARD_TRANSFER_ID_MAX) : 0;
_tx_transfer_map[port_id] = next_transfer_id;
return next_transfer_id;
}
Thanks in advance.