mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 03:33:33 +08:00
INode class. Publisher, Subscriber, ServiceServer, ServiceClient now accept INode in constructor instead of the bunch of independent params. Self NodeID now being configured via setNodeID() method instead of constructor param
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <uavcan/node/abstract_node.hpp>
|
||||
#include <uavcan/util/lazy_constructor.hpp>
|
||||
|
||||
struct TestNode : public uavcan::INode
|
||||
{
|
||||
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * 8, uavcan::MemPoolBlockSize> pool;
|
||||
uavcan::PoolManager<1> poolmgr;
|
||||
uavcan::MarshalBufferProvider<> buffer_provider;
|
||||
uavcan::OutgoingTransferRegistry<8> otr;
|
||||
uavcan::Scheduler scheduler;
|
||||
|
||||
TestNode(uavcan::ICanDriver& can_driver, uavcan::ISystemClock& clock_driver, uavcan::NodeID self_node_id)
|
||||
: otr(poolmgr)
|
||||
, scheduler(can_driver, poolmgr, clock_driver, otr)
|
||||
{
|
||||
poolmgr.addPool(&pool);
|
||||
setNodeID(self_node_id);
|
||||
}
|
||||
|
||||
uavcan::PoolManager<1>& getAllocator() { return poolmgr; }
|
||||
uavcan::Scheduler& getScheduler() { return scheduler; }
|
||||
const uavcan::Scheduler& getScheduler() const { return scheduler; }
|
||||
uavcan::IMarshalBufferProvider& getMarshalBufferProvider() { return buffer_provider; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user