From e8e0653022328367aadd1b835275980a277eaf7b Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sun, 7 Jun 2015 17:28:37 +0300 Subject: [PATCH] INode::injectTxFrame() --- .../include/uavcan/node/abstract_node.hpp | 27 +++++++++++++++++++ .../include/uavcan/transport/dispatcher.hpp | 1 + 2 files changed, 28 insertions(+) diff --git a/libuavcan/include/uavcan/node/abstract_node.hpp b/libuavcan/include/uavcan/node/abstract_node.hpp index 026cb65c57..a9c80466d9 100644 --- a/libuavcan/include/uavcan/node/abstract_node.hpp +++ b/libuavcan/include/uavcan/node/abstract_node.hpp @@ -86,6 +86,33 @@ public: { return getScheduler().spinOnce(); } + + /** + * This method allows to directly transmit a raw CAN frame circumventing the whole UAVCAN stack. + * Mandatory parameters: + * + * @param frame CAN frame to be transmitted. + * + * @param tx_deadline The frame will be discarded if it could not be transmitted by this time. + * + * @param iface_mask This bitmask allows to select what CAN interfaces this frame should go into. + * Example: + * - 1 - the frame will be sent only to iface 0. + * - 4 - the frame will be sent only to iface 2. + * - 3 - the frame will be sent to ifaces 0 and 1. + * + * Optional parameters: + * + * @param qos Quality of service. Please refer to the CAN IO manager for details. + * + * @param flags CAN IO flags. Please refer to the CAN driver API for details. + */ + int injectTxFrame(const CanFrame& frame, MonotonicTime tx_deadline, uint8_t iface_mask, + CanTxQueue::Qos qos = CanTxQueue::Volatile, + CanIOFlags flags = 0) + { + return getDispatcher().getCanIOManager().send(frame, tx_deadline, MonotonicTime(), iface_mask, qos, flags); + } }; } diff --git a/libuavcan/include/uavcan/transport/dispatcher.hpp b/libuavcan/include/uavcan/transport/dispatcher.hpp index d179b32193..9a277e4f2a 100644 --- a/libuavcan/include/uavcan/transport/dispatcher.hpp +++ b/libuavcan/include/uavcan/transport/dispatcher.hpp @@ -196,6 +196,7 @@ public: ISystemClock& getSystemClock() { return sysclock_; } const CanIOManager& getCanIOManager() const { return canio_; } + CanIOManager& getCanIOManager() { return canio_; } const TransferPerfCounter& getTransferPerfCounter() const { return perf_; } TransferPerfCounter& getTransferPerfCounter() { return perf_; }