39 #include <forward_list>
84 bool start(
const std::string busname,
const std::string& baudrate);
94 bool start(
const std::string busname,
const unsigned baudrate);
120 void receive_loop(std::atomic<bool>& running);
121 void received_message(
const Message& m);
123 static const bool debug =
false;
125 std::atomic<bool> m_running{
false};
126 std::thread m_loop_thread;
129 std::vector<MessageReceivedCallback> m_receive_callbacks;
130 mutable std::mutex m_receive_callbacks_mutex;
132 static const bool m_cleanup_futures =
true;
133 std::forward_list<std::future<void>> m_callback_futures;
134 mutable std::mutex m_callback_futures_mutex;
136 static const bool m_lock_send =
true;
137 mutable std::mutex m_send_mutex;
This class implements the CanOpen SDO protocol.
This class implements the CanOpen PDO protocol.
void send(const Message &message)
Sends a message.
NMT nmt
The NMT sub-protocol.
PDO pdo
The PDO sub-protocol.
This class implements the CanOpen NMT protocol.
This class implements the Core of KaCanOpen It communicates with the CAN driver, sends CAN messages a...
std::function< void(const Message &) > MessageReceivedCallback
Type of a message receiver function Important: Never call register_receive_callback() from within (->...
void stop()
Stops the receive loop and closes the driver.
SDO sdo
The SDO sub-protocol.
bool start(const std::string busname, const std::string &baudrate)
Opens CAN driver and starts CAN message receive loop.
void register_receive_callback(const MessageReceivedCallback &callback)
Registers a callback function which is called when a message has been received.
This struct represents a CANOpen message.