SlaveInterface.cpp
Go to the documentation of this file.
1 #include "SlaveInterface.h"
2 
3 #include "Bus.h"
5 
6 
8 {
9 
11  slaveIdentifier(slaveIdentifier)
12  {
13  }
14 
15  /**
16  * This returns the slave number of the slave on the bus +1 because slave 0 is the master
17  * @return index in ec_slave array
18  */
19  std::uint16_t
21  {
22  return static_cast<std::uint16_t>(slaveIdentifier.slaveIndex);
23  }
24 
25 
26  bool
28  {
29  return not hasError();
30  }
31 
32 
33  const SlaveIdentifier&
35  {
36  return slaveIdentifier;
37  }
38 
39 
40  void
41  SlaveInterface::setName(const std::string& name)
42  {
44  }
45 
46  void
47  SlaveInterface::setParentDeviceName(const std::string& name)
48  {
50  }
51 
52  void
54  {
55  ARMARX_CHECK_IS_NULL(this->errorRegistersDevice);
57  this->errorRegistersDevice = errorRegistersDevice;
58  }
59 
62  {
64  return this->errorRegistersDevice;
65  }
66 
67 } // namespace armarx::control::ethercat
armarx::control::ethercat::SlaveInterface::slaveIdentifier
SlaveIdentifier slaveIdentifier
Definition: SlaveInterface.h:137
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::control::ethercat::SlaveInterface::setName
virtual void setName(const std::string &name)
Definition: SlaveInterface.cpp:41
armarx::control::ethercat::SlaveInterface::getErrorRegistersDevice
SlaveErrorRegistersDevicePtr getErrorRegistersDevice() const
Definition: SlaveInterface.cpp:61
armarx::control::ethercat::SlaveIdentifier::setParentDeviceName
bool setParentDeviceName(const std::string &parentDeviceName)
Sets the name of the parent device of a slave identifier.
Definition: SlaveIdentifier.cpp:67
armarx::control::ethercat::SlaveIdentifier
The SlaveIdentifier class is a POD-type representing a unique set of values identifying an EtherCAT s...
Definition: SlaveIdentifier.h:53
armarx::control::ethercat::SlaveIdentifier::setName
bool setName(const std::string &name)
Sets the slave name of a SlaveIdentifier and returns whether the new name fits together with the pare...
Definition: SlaveIdentifier.cpp:56
armarx::control::ethercat::SlaveInterface::getSlaveIdentifier
const SlaveIdentifier & getSlaveIdentifier() const
Definition: SlaveInterface.cpp:34
armarx::control::ethercat::SlaveInterface::errorRegistersDevice
SlaveErrorRegistersDevicePtr errorRegistersDevice
Definition: SlaveInterface.h:138
Bus.h
ARMARX_CHECK_IS_NULL
#define ARMARX_CHECK_IS_NULL(ptr)
This macro evaluates whether ptr is null and if it turns out to be false it will throw an ExpressionE...
Definition: ExpressionException.h:194
armarx::control::ethercat::SlaveInterface::setErrorRegistersDevice
void setErrorRegistersDevice(SlaveErrorRegistersDevicePtr errorRegistersDevice)
Definition: SlaveInterface.cpp:53
armarx::control::ethercat::SlaveInterface::hasError
virtual bool hasError()=0
This function indicates if there is a error or Problem with this slave.
armarx::control::ethercat
Definition: Bus.cpp:24
armarx::control::ethercat::SlaveInterface::handleErrors
virtual bool handleErrors()
This tries to clear oder fix the errors or problems of the slave or just gives detailed information a...
Definition: SlaveInterface.cpp:27
armarx::control::ethercat::SlaveInterface::setParentDeviceName
void setParentDeviceName(const std::string &name)
Definition: SlaveInterface.cpp:47
armarx::control::ethercat::SlaveInterface::SlaveInterface
SlaveInterface(const SlaveIdentifier &slaveIdentifier)
Definition: SlaveInterface.cpp:10
SlaveInterface.h
SlaveErrorRegistersDevice.h
armarx::control::ethercat::SlaveIdentifier::slaveIndex
std::int16_t slaveIndex
The index of the slave on the bus.
Definition: SlaveIdentifier.h:71
armarx::control::ethercat::SlaveErrorRegistersDevicePtr
std::shared_ptr< SlaveErrorRegistersDevice > SlaveErrorRegistersDevicePtr
Definition: SlaveInterface.h:19
armarx::control::ethercat::SlaveInterface::getSlaveNumber
std::uint16_t getSlaveNumber() const
This returns the slave number of the slave on the bus +1 because slave 0 is the master.
Definition: SlaveInterface.cpp:20