From 5d272ca4103b92122c84b50a50d8f3e377132b58 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 29 Apr 2014 13:51:30 +0400 Subject: [PATCH] Linux test: Hardpoint control from nodetool --- libuavcan_drivers/linux/test/test_nodetool.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libuavcan_drivers/linux/test/test_nodetool.cpp b/libuavcan_drivers/linux/test/test_nodetool.cpp index 25eb5a0c25..b16039522a 100644 --- a/libuavcan_drivers/linux/test/test_nodetool.cpp +++ b/libuavcan_drivers/linux/test/test_nodetool.cpp @@ -14,6 +14,7 @@ #include #include +#include namespace { @@ -189,6 +190,20 @@ void executeCommand(const uavcan_linux::NodePtr& node, const std::string& cmd, uavcan_linux::BlockingServiceClient client(*node); std::cout << call(client, node_id, uavcan::protocol::GetTransportStats::Request()) << std::endl; } + else if (cmd == "hardpoint") + { + uavcan::equipment::hardpoint::Command msg; + msg.command = std::stoi(args.at(0)); + auto pub = node->makePublisher(); + if (node_id.isBroadcast()) + { + (void)pub->broadcast(msg); + } + else + { + (void)pub->unicast(msg, node_id); + } + } else { std::cout << "Invalid command" << std::endl;