• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

traintastic / traintastic / 24288605255

11 Apr 2026 06:17PM UTC coverage: 25.599% (-2.4%) from 27.99%
24288605255

push

github

web-flow
Merge pull request #222 from traintastic/cbus

Added CBUS/VLCB hardware support

169 of 3369 new or added lines in 99 files covered. (5.02%)

5 existing lines in 4 files now uncovered.

8300 of 32423 relevant lines covered (25.6%)

178.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/server/src/hardware/input/input.hpp
1
/**
2
 * This file is part of Traintastic,
3
 * see <https://github.com/traintastic/traintastic>.
4
 *
5
 * Copyright (C) 2019-2026 Reinder Feenstra
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program 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
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 */
21

22
#ifndef TRAINTASTIC_SERVER_HARDWARE_INPUT_INPUT_HPP
23
#define TRAINTASTIC_SERVER_HARDWARE_INPUT_INPUT_HPP
24

25
#include "../../core/nonpersistentobject.hpp"
26
#include <optional>
27
#include <set>
28
#include "inputlocation.hpp"
29
#include "../../core/property.hpp"
30
#include "../../core/objectproperty.hpp"
31
#include "../../core/event.hpp"
32
#include "../../enum/tristate.hpp"
33
#include "../../enum/simulateinputaction.hpp"
34

35
#ifdef interface
36
  #undef interface // interface is defined in combaseapi.h
37
#endif
38

39
class InputController;
40

41
class Input : public NonPersistentObject
42
{
43
  friend class InputController;
44

45
  CLASS_ID("input")
×
46

47
  private:
48
    std::set<std::shared_ptr<Object>> m_usedBy; //!< Objects that use the input.
49

50
  protected:
51
    void updateValue(TriState _value);
52

53
  public:
54
    static constexpr uint32_t addressMinDefault = std::numeric_limits<uint32_t>::min();
55
    static constexpr uint32_t addressMaxDefault = std::numeric_limits<uint32_t>::max();
56

57
    ObjectProperty<InputController> interface;
58
    Property<InputChannel> channel;
59
    Property<uint32_t> address;
60
    Property<uint32_t> node;
61
    Property<TriState> value;
62
    Event<bool, const std::shared_ptr<Input>&> onValueChanged;
63

64
    Input(std::shared_ptr<InputController> inputController, InputChannel channel_, std::optional<uint32_t> node_, uint32_t address_);
65

NEW
66
    InputLocation location() const
×
67
    {
NEW
68
      return inputLocation(channel, node, address);
×
69
    }
70

71
    void simulateChange(SimulateInputAction action);
72
};
73

74
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc