| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/***************************************************************************** |
| 2 |
|
|
* |
| 3 |
|
|
* This file is part of the ecapp library (EtherCAT application devices). |
| 4 |
|
|
* |
| 5 |
|
|
* Copyright (C) 2026 Florian Pose <fp@igh.de> |
| 6 |
|
|
* |
| 7 |
|
|
* The ecapp library is free software: you can redistribute it and/or |
| 8 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
| 9 |
|
|
* as published by the Free Software Foundation, version 3 of the |
| 10 |
|
|
* License. |
| 11 |
|
|
* |
| 12 |
|
|
* The ecapp library is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
|
|
* Lesser General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU Lesser General Public |
| 18 |
|
|
* License along with the ecapp library. If not, see |
| 19 |
|
|
* <https://www.gnu.org/licenses/>. |
| 20 |
|
|
* |
| 21 |
|
|
****************************************************************************/ |
| 22 |
|
|
|
| 23 |
|
|
#ifndef ECAPP_IOLINKMASTER_H |
| 24 |
|
|
#define ECAPP_IOLINKMASTER_H |
| 25 |
|
|
|
| 26 |
|
|
/****************************************************************************/ |
| 27 |
|
|
|
| 28 |
|
|
#include "ecapp/Capability.h" |
| 29 |
|
|
#include "ecapp_export.h" |
| 30 |
|
|
|
| 31 |
|
|
#include <string> |
| 32 |
|
|
|
| 33 |
|
|
/****************************************************************************/ |
| 34 |
|
|
|
| 35 |
|
|
namespace EcApp { |
| 36 |
|
|
|
| 37 |
|
|
class SubDevice; |
| 38 |
|
|
|
| 39 |
|
|
/** Capability interface for IO-Link master terminals (e.g. EL6224). |
| 40 |
|
|
* Unlike every other capability in ecapp, a device implementing this |
| 41 |
|
|
* has channels that are not fully known until setPortDevice() and |
| 42 |
|
|
* applyPortConfig() have run -- each port can have a different IO-Link |
| 43 |
|
|
* device plugged in, discovered/assigned at configuration time, not |
| 44 |
|
|
* baked into the terminal type the way an EL2008's 8 outputs are. |
| 45 |
|
|
* |
| 46 |
|
|
* A port's plugged device is itself a full SubDevice (see |
| 47 |
|
|
* IoLinkDevice); this interface only adds port assignment/ |
| 48 |
|
|
* configuration and access to that per-port SubDevice -- the actual |
| 49 |
|
|
* channel values are read/written through the returned SubDevice via |
| 50 |
|
|
* the usual getInput()/readInput<T>()/bindInput<T>() etc., not through |
| 51 |
|
|
* anything declared here. */ |
| 52 |
|
1 |
class ECAPP_EXPORT IoLinkMaster |
| 53 |
|
|
{ |
| 54 |
|
|
public: |
| 55 |
|
1 |
virtual ~IoLinkMaster() = default; |
| 56 |
|
|
|
| 57 |
|
|
virtual unsigned int numPorts() const = 0; |
| 58 |
|
|
|
| 59 |
|
|
/** Assigns a driver (see createIoLinkDevice(), whose name this |
| 60 |
|
|
* forwards to) to a port. Must be followed by |
| 61 |
|
|
* applyPortConfig() before the master is activated. */ |
| 62 |
|
|
virtual void |
| 63 |
|
|
setPortDevice(unsigned int port, const std::string &deviceName) = 0; |
| 64 |
|
|
|
| 65 |
|
|
/** Pushes the dynamic PDO/SDO configuration for every assigned |
| 66 |
|
|
* port to the slave, and rebuilds each assigned port's channel |
| 67 |
|
|
* list to match. Must be called once, before the master is |
| 68 |
|
|
* activated. Before this has run, port() still returns a |
| 69 |
|
|
* valid SubDevice for an assigned port, just with an empty |
| 70 |
|
|
* channel list. */ |
| 71 |
|
|
virtual void applyPortConfig() = 0; |
| 72 |
|
|
|
| 73 |
|
|
/** Throws UnknownChannel if port is out of range. Never null, |
| 74 |
|
|
* regardless of whether a device has been assigned to it yet |
| 75 |
|
|
* -- an assigned-but-not-yet-configured or unassigned port |
| 76 |
|
|
* simply has no channels. */ |
| 77 |
|
|
virtual SubDevice &port(unsigned int port) = 0; |
| 78 |
|
|
virtual const SubDevice &port(unsigned int port) const = 0; |
| 79 |
|
|
}; |
| 80 |
|
|
|
| 81 |
|
|
} // namespace EcApp |
| 82 |
|
|
|
| 83 |
|
|
#endif // ECAPP_IOLINKMASTER_H |
| 84 |
|
|
|
| 85 |
|
|
/****************************************************************************/ |
| 86 |
|
|
|