GCC Code Coverage Report


Directory: ./
File: ecapp/AnalogInputType.h
Date: 2026-09-03 16:05:57
Exec Total Coverage
Lines: 2 2 100.0%
Branches: 0 0 -%

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_ANALOGINPUTTYPE_H
24 #define ECAPP_ANALOGINPUTTYPE_H
25
26 /****************************************************************************/
27
28 #include "ecapp/Capability.h"
29 #include "ecapp_export.h"
30
31 /****************************************************************************/
32
33 namespace EcApp {
34
35 enum class AnalogInputType {
36 PlusMinus10V,
37 PlusMinus20mA,
38 ZeroTo10V,
39 ZeroTo20mA,
40 FourTo20mA,
41 };
42
43 /** Capability interface for analog input devices with a switchable
44 * measuring range (e.g. EL3074, EPP3184). Not every SubDevice implements
45 * this -- use EcApp::capability<SwitchableInputType>(device), which
46 * throws UnsupportedCapability for a device that doesn't. Even a device
47 * that does implement it may still refuse a specific channel at runtime
48 * (a mixed-capability terminal, or a fixed-range channel on an
49 * otherwise switchable one) by throwing UnsupportedCapability from
50 * setInputType() itself. */
51 2 class ECAPP_EXPORT SwitchableInputType
52 {
53 public:
54 2 virtual ~SwitchableInputType() = default;
55
56 /** Pushes the requested range to the slave via SDO immediately.
57 * Must be called before the master is activated. */
58 virtual void setInputType(unsigned int channel, AnalogInputType) = 0;
59 };
60
61 } // namespace EcApp
62
63 #endif // ECAPP_ANALOGINPUTTYPE_H
64
65 /****************************************************************************/
66