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:
Pavel Kirienko
2014-03-14 19:54:27 +04:00
parent 15cbf96378
commit 613efa49b9
22 changed files with 211 additions and 181 deletions
+31
View File
@@ -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; }
};