This class implements the Core of KaCanOpen It communicates with the CAN driver, sends CAN messages and listens for incoming CAN messages. You can access CanOpen sub- protocols using public members nmt, sdo and pdo.
More...
#include <core.h>
|
| Core () |
| Constructor.
|
|
| ~Core () |
| Destructor.
|
|
| Core (const Core &)=delete |
| Copy constructor deleted because of mutexes.
|
|
bool | start (const std::string busname, const std::string &baudrate) |
| Opens CAN driver and starts CAN message receive loop. More...
|
|
bool | start (const std::string busname, const unsigned baudrate) |
| Opens CAN driver and starts CAN message receive loop. More...
|
|
void | stop () |
| Stops the receive loop and closes the driver. More...
|
|
void | send (const Message &message) |
| Sends a message. More...
|
|
void | register_receive_callback (const MessageReceivedCallback &callback) |
| Registers a callback function which is called when a message has been received. More...
|
|
This class implements the Core of KaCanOpen It communicates with the CAN driver, sends CAN messages and listens for incoming CAN messages. You can access CanOpen sub- protocols using public members nmt, sdo and pdo.
All methods except start() and stop() are thread-safe.
- Examples:
- examples/core.cpp.
Definition at line 59 of file core.h.
Registers a callback function which is called when a message has been received.
Definition at line 137 of file core.cpp.
void kaco::Core::send |
( |
const Message & |
message | ) |
|
Sends a message.
Definition at line 243 of file core.cpp.
bool kaco::Core::start |
( |
const std::string |
busname, |
|
|
const std::string & |
baudrate |
|
) |
| |
Opens CAN driver and starts CAN message receive loop.
- Parameters
-
busname | Name of the bus which will be passed to the CAN driver, e.g. slcan0 |
baudrate | Baudrate as a string which will be passed to the CAN driver. Most drivers from the CanFestival project accept the following values: "1M", "500K", "125K", "100K", "50K", "20K", "10K" and "5K". |
- Returns
- true if successful
- Examples:
- examples/core.cpp.
Definition at line 84 of file core.cpp.
bool kaco::Core::start |
( |
const std::string |
busname, |
|
|
const unsigned |
baudrate |
|
) |
| |
Opens CAN driver and starts CAN message receive loop.
- Parameters
-
busname | Name of the bus which will be passed to the CAN driver, e.g. slcan0 |
baudrate | Baudrate in 1/s. The value will be passed to the CAN driver in string representation. Attention: For full compatibility with CanFestival drivers, values > 1000000 are postfixed with "M" and values > 1000 are postfixed with "K". E.g. 1000000->"1M", 500000->"500K" and 5000->"5K". |
- Returns
- true if successful
Definition at line 102 of file core.cpp.
void kaco::Core::stop |
( |
| ) |
|
Stops the receive loop and closes the driver.
Definition at line 112 of file core.cpp.
The documentation for this class was generated from the following files: