Motion Master
Loading...
Searching...
No Matches
Public Member Functions | List of all members
VirtualDeviceManager Class Reference

#include <virtual_device_manager.h>

Public Member Functions

 VirtualDeviceManager (Notifier &notifier)
 
 ~VirtualDeviceManager ()
 
bool init ()
 Initialize the Virtual Device Manager. More...
 
size_t start ()
 Start the EtherCAT master. More...
 
void stop ()
 Stop the EtherCAT master. More...
 
bool is_restart_required ()
 Check if VDM restart is required. More...
 
void set_restart_required (bool restart_required)
 Mark the VDM as restart required. More...
 
size_t restart ()
 Restart the EtherCAT master. More...
 
int32_t execute (uint64_t pending_signals) const
 Execute the main loop of the Virtual Device Manager. More...
 
bool is_running () const
 Check if VDM is running. More...
 
bool is_initialized () const
 Check if VDM has successfully initialized. More...
 
int get_responding_device_count () const
 Get the count of currently responding devices. More...
 
const std::map< uint32_t, VirtualDevice * > & get_devices () const
 Get all available virtual devices. More...
 
VirtualDeviceget_device (uint32_t address) const
 Get a virtual device pointer by its ID. More...
 
bool stop_devices ()
 Used to "stop" all of the available devices before certain operations. More...
 
bool disable_devices (bool blocking=false)
 Used to "disable" all of the available devices before certain operations. More...
 
void clear ()
 Remove all of the available devices. More...
 
void setMonitorMachinePtr (void *pMM)
 

Constructor & Destructor Documentation

◆ VirtualDeviceManager()

VirtualDeviceManager::VirtualDeviceManager ( Notifier notifier)
explicit

◆ ~VirtualDeviceManager()

VirtualDeviceManager::~VirtualDeviceManager ( )

Member Function Documentation

◆ clear()

void VirtualDeviceManager::clear ( )

Remove all of the available devices.

◆ disable_devices()

bool VirtualDeviceManager::disable_devices ( bool  blocking = false)

Used to "disable" all of the available devices before certain operations.

For instance, all of the EtherCAT devices need to be switched to PREOP

Attention
Must be implemented as non-blocking!
Returns
true if all of the devices are disabled, false otherwise

◆ execute()

int32_t VirtualDeviceManager::execute ( uint64_t  pending_signals) const

Execute the main loop of the Virtual Device Manager.

Parameters
pending_signalsnumber of time intervals that passed since the last call to this function
Returns
error if any

◆ get_device()

VirtualDevice * VirtualDeviceManager::get_device ( uint32_t  address) const

Get a virtual device pointer by its ID.

Parameters
addressdevice address
Returns
a pointer to the requested device if available, or nullptr if not

◆ get_devices()

const std::map< uint32_t, VirtualDevice * > & VirtualDeviceManager::get_devices ( ) const

Get all available virtual devices.

Returns
a map of (pointers to) all available devices

◆ get_responding_device_count()

int VirtualDeviceManager::get_responding_device_count ( ) const

Get the count of currently responding devices.

Returns
number of responding devices

◆ init()

bool VirtualDeviceManager::init ( )

Initialize the Virtual Device Manager.

Returns
true if initialization is successful, false otherwise
Exceptions
runtimeerror
Attention
Limit the address range in order to avoid confusing the device address with the device (chain) position

◆ is_initialized()

bool VirtualDeviceManager::is_initialized ( ) const

Check if VDM has successfully initialized.

Returns
true if successfully initialized, false otherwise

◆ is_restart_required()

bool VirtualDeviceManager::is_restart_required ( )

Check if VDM restart is required.

Used to enable outside objects check whether the VDM should be restarted

◆ is_running()

bool VirtualDeviceManager::is_running ( ) const

Check if VDM is running.

Returns
true if currently running, false otherwise

◆ restart()

size_t VirtualDeviceManager::restart ( )

Restart the EtherCAT master.

Returns
the number of available devices

◆ set_restart_required()

void VirtualDeviceManager::set_restart_required ( bool  restart_required)

Mark the VDM as restart required.

Used to enable outside objects set whether the VDM should be restarted

Parameters
restart_requiredmark as restart required

◆ setMonitorMachinePtr()

void VirtualDeviceManager::setMonitorMachinePtr ( void *  pMM)
inline

◆ start()

size_t VirtualDeviceManager::start ( )

Start the EtherCAT master.

Returns
the number of available devices

◆ stop()

void VirtualDeviceManager::stop ( )

Stop the EtherCAT master.

Parameters
send_notificationssend stopping notifications to clients

◆ stop_devices()

bool VirtualDeviceManager::stop_devices ( )

Used to "stop" all of the available devices before certain operations.

For instance, all of the CiA402 devices need to be (quick) stopped before stopping the VDM itself

Attention
Must be implemented as non-blocking!
Returns
true if all of the devices have been stopped, false otherwise

The documentation for this class was generated from the following files: