SlaveInterface.cpp
Go to the documentation of this file.
1 #include "SlaveInterface.h"
2 
3 #include "Bus.h"
5 
7 {
8 
10  slaveIdentifier(slaveIdentifier)
11  {
12  }
13 
14  /**
15  * This returns the slave number of the slave on the bus +1 because slave 0 is the master
16  * @return index in ec_slave array
17  */
18  std::uint16_t
20  {
21  return static_cast<std::uint16_t>(slaveIdentifier.slaveIndex);
22  }
23 
24  bool
26  {
27  return not hasError();
28  }
29 
30  const SlaveIdentifier&
32  {
33  return slaveIdentifier;
34  }
35 
36  void
37  SlaveInterface::setName(const std::string& name)
38  {
40  }
41 
42  void
43  SlaveInterface::setParentDeviceName(const std::string& name)
44  {
46  }
47 
48  void
50  {
51  ARMARX_CHECK_IS_NULL(this->errorRegistersDevice);
53  this->errorRegistersDevice = errorRegistersDevice;
54  }
55 
58  {
60  return this->errorRegistersDevice;
61  }
62 
63 } // namespace armarx::control::ethercat
armarx::control::ethercat::SlaveInterface::slaveIdentifier
SlaveIdentifier slaveIdentifier
Definition: SlaveInterface.h:136
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:37
armarx::control::ethercat::SlaveInterface::getErrorRegistersDevice
SlaveErrorRegistersDevicePtr getErrorRegistersDevice() const
Definition: SlaveInterface.cpp:57
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:66
armarx::control::ethercat::SlaveIdentifier
The SlaveIdentifier class is a POD-type representing a unique set of values identifying an EtherCAT s...
Definition: SlaveIdentifier.h:52
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:55
armarx::control::ethercat::SlaveInterface::getSlaveIdentifier
const SlaveIdentifier & getSlaveIdentifier() const
Definition: SlaveInterface.cpp:31
armarx::control::ethercat::SlaveInterface::errorRegistersDevice
SlaveErrorRegistersDevicePtr errorRegistersDevice
Definition: SlaveInterface.h:137
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:49
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:25
armarx::control::ethercat::SlaveInterface::setParentDeviceName
void setParentDeviceName(const std::string &name)
Definition: SlaveInterface.cpp:43
armarx::control::ethercat::SlaveInterface::SlaveInterface
SlaveInterface(const SlaveIdentifier &slaveIdentifier)
Definition: SlaveInterface.cpp:9
SlaveInterface.h
SlaveErrorRegistersDevice.h
armarx::control::ethercat::SlaveIdentifier::slaveIndex
std::int16_t slaveIndex
The index of the slave on the bus.
Definition: SlaveIdentifier.h:70
armarx::control::ethercat::SlaveErrorRegistersDevicePtr
std::shared_ptr< SlaveErrorRegistersDevice > SlaveErrorRegistersDevicePtr
Definition: SlaveInterface.h:18
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:19