Go to the documentation of this file.
9 #include <VirtualRobot/Robot.h>
131 virtual const std::vector<std::shared_ptr<SubDeviceInterface>>
getSubDevices()
const;
138 template <
typename Device>
139 std::shared_ptr<DeviceInterface>
142 return std::make_shared<Device>(config, robot);
146 template <
typename SlaveI,
typename Slave>
155 if (Slave::isSlaveIdentifierAccepted(slave.getSlaveIdentifier()))
157 Slave* upcastedSlave =
dynamic_cast<Slave*
>(&slave);
159 if (upcastedSlave and upcastedSlave->getSlaveIdentifier().serialNumber == serialNo)
163 if (concreteSlave ==
nullptr or
dynamic_cast<SlaveI*
>(concreteSlave) ==
nullptr)
165 concreteSlave = upcastedSlave;
166 return Result::assigned;
169 return Result::alreadyAssigned;
174 return Result::unknown;
virtual ~DeviceInterface()
Brief description of class SlaveInterface.
virtual void postSwitchToOp()
Hook for executing code after the bus has successfully switched into the Op-State.
virtual TryAssignResult tryAssign(SlaveInterface &slave)=0
Method called by the EtherCAT bus to try to assign slaves to functional devices.
virtual std::string getClassName() const =0
virtual ~SubDeviceInterface()
virtual void postSwitchToSafeOp()
Hook for executing code after the bus has successfully switched into the SafeOp-State.
@ unknown
Used if the slave is unknown to this device. (Expected)
DeviceInterface::TryAssignResult tryAssignUsingSerialNo(SlaveI &slave, Slave *&concreteSlave, std::uint32_t serialNo)
Brief description of class DeviceInterface.
@ assigned
Used if the slave was adpoted by this device. (Expected)
@ slavesMissing
Used if slaves are missing. (Error)
std::shared_ptr< Value > value()
DeviceInterface(const std::string &name)
@ alreadyAssigned
Used if the slave was already adopted before. (Error)
SubDeviceInterface(const std::string &name)
@ ok
Used if assignments were successful. (Expected)
virtual const std::vector< std::shared_ptr< SubDeviceInterface > > getSubDevices() const
std::vector< std::shared_ptr< SubDeviceInterface > > subDevices
virtual AllAssignedResult onAllAssigned()=0
Method called by the EtherCAT bus after all slaves have been assigned.
std::shared_ptr< DeviceInterface > createDevice(hardware_config::DeviceConfig &config, const VirtualRobot::RobotPtr &robot)
std::shared_ptr< class Robot > RobotPtr