6 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
10 #include <gtest/gtest.h>
18 uavcan::protocol::NodeStatus msg;
19 msg.health = uavcan::protocol::NodeStatus::HEALTH_OK;
20 msg.mode = uavcan::protocol::NodeStatus::MODE_OPERATIONAL;
21 msg.uptime_sec = uptime_sec;
41 const uavcan::protocol::GetNodeInfo::Response& node_info)
44 std::cout << node_info << std::endl;
45 last_node_info.reset(
new uavcan::protocol::GetNodeInfo::Response(node_info));
50 std::cout <<
"NODE INFO FOR " <<
int(node_id.
get()) <<
" IS UNAVAILABLE" << std::endl;
57 std::cout <<
"NODE " <<
int(event.
node_id.
get()) <<
" STATUS CHANGE: "
58 <<
event.old_status.toString() <<
" --> " <<
event.status.toString() << std::endl;
64 std::cout << msg << std::endl;
70 TEST(NodeInfoRetriever, Basic)
80 std::cout <<
"sizeof(uavcan::ServiceClient<uavcan::protocol::GetNodeInfo>): "
90 ASSERT_LE(0, retr.
start());
98 uavcan::protocol::HardwareVersion hwver;
99 hwver.unique_id[0] = 123;
100 hwver.unique_id[4] = 213;
101 hwver.unique_id[8] = 45;
103 provider->setName(
"Ivan");
104 provider->setHardwareVersion(hwver);
106 ASSERT_LE(0, provider->startAndPublish());
209 std::cout <<
"Invalidation" << std::endl;
228 TEST(NodeInfoRetriever, MaxConcurrentRequests)
238 std::cout <<
"sizeof(uavcan::ServiceClient<uavcan::protocol::GetNodeInfo>): "
246 ASSERT_LE(0, retr.
start());
256 const unsigned MaxPendingRequests = 26;
257 const unsigned MinPendingRequestsAtFullLoad = 12;
262 for (
uint8_t node_id = 1U; node_id <= 127U; node_id++)
273 for (
int i = 0; i < 8; i++)
276 std::cout <<
"!!! SPIN " << i <<
" COMPLETE" << std::endl;