Public Types | Public Member Functions | Protected Attributes | List of all members
rokubimini::ethercat::RokubiminiEthercatBusManager Class Reference

Inherits from RokubiminiBusManager. It's used for managing the Ethercat buses. More...

#include <RokubiminiEthercatBusManager.hpp>

Inheritance diagram for rokubimini::ethercat::RokubiminiEthercatBusManager:
Inheritance graph
[legend]

Public Types

using BusMap = std::unordered_map< std::string, std::unique_ptr< rokubimini::soem_interface::EthercatBusBase >>
 

Public Member Functions

bool addEthercatBus (rokubimini::soem_interface::EthercatBusBase *bus)
 Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer. More...
 
bool addEthercatBus (std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > bus)
 Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer. More...
 
bool addRokubiminiToBus (RokubiminiEthercat *rokubimini, rokubimini::soem_interface::EthercatBusBase *bus, const std::shared_ptr< setup::RokubiminiEthercat > &rokubiminiEthercatSetup) const
 Adds a Rokubimini to Bus. More...
 
std::unique_ptr< rokubimini::soem_interface::EthercatBusBaseextractBusByName (const std::string &name)
 Returns an owning bus pointer. The manager is now not managing this bus anymore. More...
 
BusMap extractBuses ()
 Extracts all buses from the manager. The manager is now not managing any buses anymore. More...
 
rokubimini::soem_interface::EthercatBusBasegetBusByName (const std::string &name) const
 Returns a non owning bus pointer. The manager still manages all the buses. More...
 
bool loadSetup (std::vector< std::shared_ptr< rokubimini::Rokubimini >> &rokubiminis) override
 Loads the Rokubimini Setups. More...
 
void readAllBuses () override
 Calls update read on all busses. More...
 
 RokubiminiEthercatBusManager ()=default
 
void setBussesOperational ()
 Sets all busses to operational state. More...
 
void setBussesPreOperational ()
 Sets all busses to pre operational state. More...
 
void setBussesSafeOperational ()
 Sets all busses to safe operational state. More...
 
void setConfigMode () override
 
void setRunMode () override
 
void shutdownAllBuses () override
 Calls shutdown on all busses. More...
 
bool startupAllBuses ()
 Starts up all busses and puts them in operational mode. More...
 
bool startupCommunication () override
 Starts up all busses. More...
 
void waitForState (const uint16_t state, const uint16_t slave=0, const std::string &busName="", const unsigned int maxRetries=40, const double retrySleep=0.001)
 Waits for the slave to reach a state. More...
 
void writeToAllBuses () override
 Calls update write on all busses. More...
 
 ~RokubiminiEthercatBusManager () override=default
 
- Public Member Functions inherited from rokubimini::RokubiminiBusManager
virtual void addRokubiminiSetupToList (const std::shared_ptr< setup::Rokubimini > &rokubiminiSetup)
 
virtual bool addRokubiminiToBus (Rokubimini *rokubimini, const std::shared_ptr< setup::Rokubimini > &rokubiminiSetup) const
 
std::vector< std::shared_ptr< setup::Rokubimini > > getRokubiminiSetups ()
 
 RokubiminiBusManager ()
 
virtual ~RokubiminiBusManager ()=default
 

Protected Attributes

BusMap buses_
 Map with all the Ethercat buses available. More...
 
std::recursive_mutex busMutex_
 Mutex prohibiting simultaneous access to EtherCAT bus manager. More...
 
- Protected Attributes inherited from rokubimini::RokubiminiBusManager
std::vector< std::shared_ptr< setup::Rokubimini > > attachedRokubiminiSetups_
 

Detailed Description

Inherits from RokubiminiBusManager. It's used for managing the Ethercat buses.

Definition at line 32 of file RokubiminiEthercatBusManager.hpp.

Member Typedef Documentation

Definition at line 35 of file RokubiminiEthercatBusManager.hpp.

Constructor & Destructor Documentation

rokubimini::ethercat::RokubiminiEthercatBusManager::RokubiminiEthercatBusManager ( )
default
rokubimini::ethercat::RokubiminiEthercatBusManager::~RokubiminiEthercatBusManager ( )
overridedefault

Member Function Documentation

bool rokubimini::ethercat::RokubiminiEthercatBusManager::addEthercatBus ( rokubimini::soem_interface::EthercatBusBase bus)

Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer.

Parameters
busRaw bus ptr
Returns
True if bus has been added successfully

Definition at line 80 of file RokubiminiEthercatBusManager.cpp.

bool rokubimini::ethercat::RokubiminiEthercatBusManager::addEthercatBus ( std::unique_ptr< rokubimini::soem_interface::EthercatBusBase bus)

Adds an ethercat bus to the manager. The manager takes ownership of the bus pointer.

Parameters
busUnique bus ptr
Returns
True if bus has been added successfully

Definition at line 101 of file RokubiminiEthercatBusManager.cpp.

bool rokubimini::ethercat::RokubiminiEthercatBusManager::addRokubiminiToBus ( RokubiminiEthercat rokubimini,
rokubimini::soem_interface::EthercatBusBase bus,
const std::shared_ptr< setup::RokubiminiEthercat > &  rokubiminiEthercatSetup 
) const

Adds a Rokubimini to Bus.

This method is used for adding a Rokubimini Ethercat instance to the Ethercat Bus. This method also adds the EthercatSlave pointer to the Rokubimini Ethercat implementation.

Parameters
rokubiminiThe RokubiminiEthercat instance.
busThe bus to which the RokubiminiEthercat will be attached.
rokubiminiEthercatSetupThe Rokubimini Ethercat Setup instance.

Definition at line 52 of file RokubiminiEthercatBusManager.cpp.

std::unique_ptr< rokubimini::soem_interface::EthercatBusBase > rokubimini::ethercat::RokubiminiEthercatBusManager::extractBusByName ( const std::string &  name)

Returns an owning bus pointer. The manager is now not managing this bus anymore.

Parameters
[in]nameThe bus name
Returns
A unique_ptr to the bus.

Definition at line 218 of file RokubiminiEthercatBusManager.cpp.

RokubiminiEthercatBusManager::BusMap rokubimini::ethercat::RokubiminiEthercatBusManager::extractBuses ( )

Extracts all buses from the manager. The manager is now not managing any buses anymore.

Returns
Bus map

Definition at line 225 of file RokubiminiEthercatBusManager.cpp.

rokubimini::soem_interface::EthercatBusBase* rokubimini::ethercat::RokubiminiEthercatBusManager::getBusByName ( const std::string &  name) const
inline

Returns a non owning bus pointer. The manager still manages all the buses.

Parameters
[in]nameThe bus name
Returns
A shared_ptr to the bus.

Definition at line 124 of file RokubiminiEthercatBusManager.hpp.

bool rokubimini::ethercat::RokubiminiEthercatBusManager::loadSetup ( std::vector< std::shared_ptr< rokubimini::Rokubimini >> &  rokubiminis)
overridevirtual

Loads the Rokubimini Setups.

This method is used for loading the Rokubimini Ethercat Setups assigned to the RokubiminiEthercatBusManager and then attaching them to the existing bus. It's given as input the vector with pointers to every rokubimini, from which the Ethercat implementation grubs the RokubiminiEthercat instances and attaches them to the bus. This is done by calling addRokubiminiToBus.

Parameters
rokubiminisThe vector holding all the pointers to the existing Rokubiminis.
Todo:
Find a better way to implement this: Right now we loop through every Rokubimini instance and check if it matches with the RokubiminiSetup instance which the BusManager has in its attachedRokubiminiSetups_. After the match has been done, the Rokubimini instance is passed to addRokubiminiToBus().

Implements rokubimini::RokubiminiBusManager.

Definition at line 7 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::readAllBuses ( )
overridevirtual

Calls update read on all busses.

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 190 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesOperational ( )

Sets all busses to operational state.

Definition at line 129 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesPreOperational ( )

Sets all busses to pre operational state.

Definition at line 139 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::setBussesSafeOperational ( )

Sets all busses to safe operational state.

Definition at line 149 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::setConfigMode ( )
overridevirtual

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 69 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::setRunMode ( )
overridevirtual

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 75 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::shutdownAllBuses ( )
overridevirtual

Calls shutdown on all busses.

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 208 of file RokubiminiEthercatBusManager.cpp.

bool rokubimini::ethercat::RokubiminiEthercatBusManager::startupAllBuses ( )

Starts up all busses and puts them in operational mode.

Returns
True if successful

Definition at line 122 of file RokubiminiEthercatBusManager.cpp.

bool rokubimini::ethercat::RokubiminiEthercatBusManager::startupCommunication ( )
overridevirtual

Starts up all busses.

Returns
True if successful

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 176 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::waitForState ( const uint16_t  state,
const uint16_t  slave = 0,
const std::string &  busName = "",
const unsigned int  maxRetries = 40,
const double  retrySleep = 0.001 
)

Waits for the slave to reach a state.

Parameters
[in]stateEthercat state
[in]slaveSlave address, 0 = all slaves
[in]busNameThe name of the bus
[in]maxRetriesThe maximum retries
[in]retrySleepThe retry sleep

Definition at line 159 of file RokubiminiEthercatBusManager.cpp.

void rokubimini::ethercat::RokubiminiEthercatBusManager::writeToAllBuses ( )
overridevirtual

Calls update write on all busses.

Reimplemented from rokubimini::RokubiminiBusManager.

Definition at line 199 of file RokubiminiEthercatBusManager.cpp.

Member Data Documentation

BusMap rokubimini::ethercat::RokubiminiEthercatBusManager::buses_
protected

Map with all the Ethercat buses available.

Definition at line 230 of file RokubiminiEthercatBusManager.hpp.

std::recursive_mutex rokubimini::ethercat::RokubiminiEthercatBusManager::busMutex_
protected

Mutex prohibiting simultaneous access to EtherCAT bus manager.

Definition at line 223 of file RokubiminiEthercatBusManager.hpp.


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


rokubimini_ethercat
Author(s):
autogenerated on Wed Mar 3 2021 03:09:16