From 9d36eef359bce9f755c047abfc8a3a1aa0cff93c Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 15 Jul 2014 14:18:22 +0400 Subject: [PATCH] Fixed timeouts in uavcan_linux::BlockingServiceClient --- .../linux/include/uavcan_linux/helpers.hpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libuavcan_drivers/linux/include/uavcan_linux/helpers.hpp b/libuavcan_drivers/linux/include/uavcan_linux/helpers.hpp index c5ead370dd..7c252f2909 100644 --- a/libuavcan_drivers/linux/include/uavcan_linux/helpers.hpp +++ b/libuavcan_drivers/linux/include/uavcan_linux/helpers.hpp @@ -67,9 +67,21 @@ public: * Returns negative error code. */ int blockingCall(uavcan::NodeID server_node_id, const typename DataType::Request& request) + { + return blockingCall(server_node_id, request, Super::getDefaultRequestTimeout()); + } + + /** + * Performs a blocking service call using the specified timeout. Please consider using default timeout instead. + * Use @ref getResponse() to get the actual response. + * Returns negative error code. + */ + int blockingCall(uavcan::NodeID server_node_id, const typename DataType::Request& request, + uavcan::MonotonicDuration timeout) { const auto SpinDuration = uavcan::MonotonicDuration::fromMSec(2); setup(); + Super::setRequestTimeout(timeout); const int call_res = Super::call(server_node_id, request); if (call_res >= 0) { @@ -85,18 +97,6 @@ public: return call_res; } - /** - * Performs a blocking service call using the specified timeout. Please consider using default timeout instead. - * Use @ref getResponse() to get the actual response. - * Returns negative error code. - */ - int blockingCall(uavcan::NodeID server_node_id, const typename DataType::Request& request, - uavcan::MonotonicDuration timeout) - { - Super::setRequestTimeout(timeout); - return blockingCall(server_node_id, request); - } - /** * Whether the last blocking call was successful. */