ethercatcpp
master.h
Go to the documentation of this file.
1 /* File: master.h
2  * This file is part of the program ethercatcpp-core
3  * Program description : EtherCAT driver libraries for UNIX
4  * Copyright (C) 2017-2024 - Robin Passama (LIRMM / CNRS) Arnaud Meline
5  * (LIRMM / CNRS) Benjamin Navarro (LIRMM / CNRS). All Right reserved.
6  *
7  * This software is free software: you can redistribute it and/or modify
8  * it under the terms of the CeCILL-C license as published by
9  * the CEA CNRS INRIA, either version 1
10  * of the License, or (at your option) any later version.
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * CeCILL-C License for more details.
15  *
16  * You should have received a copy of the CeCILL-C License
17  * along with this software. If not, it can be found on the official
18  * website of the CeCILL licenses family (http://www.cecill.info/index.en.html).
19  */
30 #pragma once
31 
32 #include <ethercatcpp/device.h>
33 
34 #include <string>
35 #include <memory>
36 #include <cstdint>
37 
42 namespace ethercatcpp {
43 
50 class Master {
51 public:
55  Master();
56  Master(Master&&) = default;
57  Master(Master&) = delete;
58 
59  ~Master();
60 
61  Master& operator=(Master&&) = default;
62  Master& operator=(Master&) = delete;
63 
70  void add(Device& device);
71 
76  void init();
77 
81  void end();
82 
87  void print_slave_info();
88 
94  void set_primary_interface(const std::string& interface_primary);
95 
102  void set_redundant_interface(const std::string& interface_redundant);
103 
113  void set_dc_compensate_shift_time(int32_t shift_time);
114 
120  bool next_cycle();
121 
127  bool is_redundant() const;
128 
129 private:
130  class Impl;
131  std::unique_ptr<Impl> impl_; // PImpl to use EtherCAT soem
132 };
133 } // namespace ethercatcpp
ethercatcpp::Master::Master
Master()
Constructor of Master class.
ethercatcpp::Master::set_dc_compensate_shift_time
void set_dc_compensate_shift_time(int32_t shift_time)
Set the DC compensate shift time.
ethercatcpp::Master::end
void end()
Close all interface(s) (ethernet and EtherCAT)
ethercatcpp::Master::set_redundant_interface
void set_redundant_interface(const std::string &interface_redundant)
Set the secondary (redundant) network interface to the EtherCAT system (Master)
device.h
Header file for Device class.
ethercatcpp::Master::is_redundant
bool is_redundant() const
Tell whether the master is configured in redundant mode.
ethercatcpp::Master
This class define The EtherCAT Master.
Definition: master.h:50
ethercatcpp::Master::next_cycle
bool next_cycle()
Launch next ethercat communication cycle.
ethercatcpp::Master::~Master
~Master()
ethercatcpp::Master::set_primary_interface
void set_primary_interface(const std::string &interface_primary)
Set the primary network interface to the EtherCAT system (Master)
ethercatcpp::Device
This abstract class define an EtherCAT device.
Definition: device.h:49
ethercatcpp
ethercatcpp::Master::add
void add(Device &device)
Add a new device to the global Ethercat bus. The order of addition must match the hardware order....
ethercatcpp::Master::impl_
std::unique_ptr< Impl > impl_
Definition: master.h:130
ethercatcpp::Master::init
void init()
Initializes network interface(s) then detect and match all devices on hardware bus.
ethercatcpp::Master::print_slave_info
void print_slave_info()
Print all devices informations from EtherCAT system (Master) datas.
ethercatcpp::Master::operator=
Master & operator=(Master &&)=default