This class represents a master node. It listens for new slaves and provides access to them via get_slaves(). More...
#include <master.h>
Public Member Functions | |
Master () | |
Constructor. Creates Core instance and adds NMT listener for new devices. | |
Master (const Master &)=delete | |
Copy constructor deleted because of callbacks with self-references. | |
Master (Master &&)=delete | |
Move constructor deleted because of callbacks with self-references. | |
~Master () | |
Destructor. | |
bool | start (const std::string busname, const std::string &baudrate) |
Starts master and creates Core. More... | |
bool | start (const std::string busname, const unsigned baudrate) |
Starts master and creates Core. More... | |
void | stop () |
Stops master and core. | |
size_t | num_devices () const |
Returns the number of slave devices in the network. More... | |
Device & | get_device (size_t index) const |
Returns a reference to a slave device object. More... | |
Public Attributes | |
Core | core |
Core instance. | |
This class represents a master node. It listens for new slaves and provides access to them via get_slaves().
Device & kaco::Master::get_device | ( | size_t | index | ) | const |
Returns a reference to a slave device object.
index | Index of the device. Must be smaller than num_devices(). |
Definition at line 84 of file master.cpp.
size_t kaco::Master::num_devices | ( | ) | const |
Returns the number of slave devices in the network.
Definition at line 80 of file master.cpp.
bool kaco::Master::start | ( | const std::string | busname, |
const std::string & | baudrate | ||
) |
Starts master and creates Core.
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". |
Definition at line 51 of file master.cpp.
bool kaco::Master::start | ( | const std::string | busname, |
const unsigned | baudrate | ||
) |
Starts master and creates Core.
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". |
Definition at line 63 of file master.cpp.