From 7240e0d6d2459222248a9f434163953da09cb8a4 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 5 Jul 2015 09:34:34 +0300 Subject: [PATCH] Publisher init() overload with priority argument --- libuavcan/include/uavcan/node/generic_publisher.hpp | 9 +++++++++ libuavcan/include/uavcan/node/service_client.hpp | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/libuavcan/include/uavcan/node/generic_publisher.hpp b/libuavcan/include/uavcan/node/generic_publisher.hpp index a2844e7932..60623ecbe3 100644 --- a/libuavcan/include/uavcan/node/generic_publisher.hpp +++ b/libuavcan/include/uavcan/node/generic_publisher.hpp @@ -126,6 +126,15 @@ public: return checkInit(); } + /** + * This overload allows to set the priority; otherwise it's the same. + */ + int init(TransferPriority priority) + { + setPriority(priority); + return checkInit(); + } + int publish(const DataStruct& message, TransferType transfer_type, NodeID dst_node_id, MonotonicTime blocking_deadline = MonotonicTime()) { diff --git a/libuavcan/include/uavcan/node/service_client.hpp b/libuavcan/include/uavcan/node/service_client.hpp index f2c388d3be..daea7ac7cf 100644 --- a/libuavcan/include/uavcan/node/service_client.hpp +++ b/libuavcan/include/uavcan/node/service_client.hpp @@ -324,6 +324,16 @@ public: return publisher_.init(); } + /** + * Shall be called before first use. + * This overload allows to set the priority, otherwise it's the same. + * Returns negative error code. + */ + int init(TransferPriority priority) + { + return publisher_.init(priority); + } + /** * Performs non-blocking service call. * This method transmits the service request and returns immediately.