libuav original
Dependents: UAVCAN UAVCAN_Subscriber
Publisher< DataType_ > Class Template Reference
Use this class to publish messages to the bus (broadcast, unicast, or both). More...
#include <publisher.hpp>
Inherits GenericPublisher< DataType_, DataType_ >.
Public Types | |
typedef DataType_ | DataType |
Message data type. | |
Public Member Functions | |
Publisher (INode &node, MonotonicDuration tx_timeout=getDefaultTxTimeout(), MonotonicDuration max_transfer_interval=TransferSender::getDefaultMaxTransferInterval()) | |
int | broadcast (const DataType &message) |
Broadcast the message. | |
int | broadcast (const DataType &message, TransferID tid) |
Warning: You probably don't want to use this method; it's for advanced use cases like e.g. | |
Protected Member Functions | |
int | init () |
Init method can be called prior first publication, but it's not necessary because the publisher can be automatically initialized ad-hoc. | |
int | init (TransferPriority priority) |
This overload allows to set the priority; otherwise it's the same. | |
void | allowAnonymousTransfers () |
By default, attempt to send a transfer from passive mode will result in an error ErrPassive. | |
TransferPriority | getPriority () const |
Priority of outgoing transfers. |
Detailed Description
template<typename DataType_>
class uavcan::Publisher< DataType_ >
Use this class to publish messages to the bus (broadcast, unicast, or both).
- Template Parameters:
-
DataType_ Message data type
Definition at line 18 of file publisher.hpp.
Member Typedef Documentation
typedef DataType_ DataType |
Message data type.
Definition at line 23 of file publisher.hpp.
Constructor & Destructor Documentation
Publisher | ( | INode & | node, |
MonotonicDuration | tx_timeout = getDefaultTxTimeout() , |
||
MonotonicDuration | max_transfer_interval = TransferSender::getDefaultMaxTransferInterval() |
||
) | [explicit] |
- Parameters:
-
node Node instance this publisher will be registered with. tx_timeout If CAN frames of this message are not delivered to the bus in this amount of time, they will be discarded. Default value is good enough for rather high-frequency, high-priority messages. max_transfer_interval Maximum expected transfer interval. It's absolutely safe to leave default value here. It just defines how soon the Transfer ID tracking objects associated with this message type will be garbage collected by the library if it's no longer being published.
Definition at line 38 of file publisher.hpp.
Member Function Documentation
void allowAnonymousTransfers | ( | ) | [inherited] |
By default, attempt to send a transfer from passive mode will result in an error ErrPassive.
This option allows to enable sending anonymous transfers from passive mode.
Definition at line 65 of file generic_publisher.hpp.
int broadcast | ( | const DataType & | message ) |
int broadcast | ( | const DataType & | message, |
TransferID | tid | ||
) |
Warning: You probably don't want to use this method; it's for advanced use cases like e.g.
network time synchronization. Use the overloaded method with fewer arguments instead. This overload allows to explicitly specify Transfer ID. Returns negative error code.
Definition at line 63 of file publisher.hpp.
TransferPriority getPriority | ( | ) | const [inherited] |
Priority of outgoing transfers.
Definition at line 73 of file generic_publisher.hpp.
int init | ( | ) | [inherited] |
Init method can be called prior first publication, but it's not necessary because the publisher can be automatically initialized ad-hoc.
Definition at line 124 of file generic_publisher.hpp.
int init | ( | TransferPriority | priority ) | [inherited] |
This overload allows to set the priority; otherwise it's the same.
Definition at line 132 of file generic_publisher.hpp.
Generated on Tue Jul 12 2022 17:17:37 by 1.7.2