Go to the documentation of this file.
9 #include <VirtualRobot/VirtualRobot.h>
128 virtual const std::vector<std::shared_ptr<SubDeviceInterface>>
getSubDevices()
const;
134 template <
typename Device>
135 std::shared_ptr<DeviceInterface>
138 return std::make_shared<Device>(config, robot);
141 template <
typename SlaveI,
typename Slave>
150 if (Slave::isSlaveIdentifierAccepted(slave.getSlaveIdentifier()))
152 Slave* upcastedSlave =
dynamic_cast<Slave*
>(&slave);
154 if (upcastedSlave and upcastedSlave->getSlaveIdentifier().serialNumber == serialNo)
158 if (concreteSlave ==
nullptr or
dynamic_cast<SlaveI*
>(concreteSlave) ==
nullptr)
160 concreteSlave = upcastedSlave;
161 return Result::assigned;
164 return Result::alreadyAssigned;
169 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