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

traintastic / traintastic / 23088148108

14 Mar 2026 12:40PM UTC coverage: 26.661% (-0.2%) from 26.84%
23088148108

push

github

reinder
[cbus] added input support for short/long events

0 of 133 new or added lines in 4 files covered. (0.0%)

587 existing lines in 20 files now uncovered.

8246 of 30929 relevant lines covered (26.66%)

185.83 hits per line

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

0.0
/server/src/hardware/input/monitor/inputmonitor.cpp
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
#include "inputmonitor.hpp"
23
#include "../inputcontroller.hpp"
24
#include "../input.hpp"
25
#include "../../../core/method.tpp"
26

UNCOV
27
InputMonitor::InputMonitor(InputController& controller, InputChannel channel)
×
28
  : m_controller{controller}
×
29
  , m_channel{channel}
×
30
  , addressMin{this, "address_min", m_controller.inputAddressMinMax(m_channel).first, PropertyFlags::ReadOnly | PropertyFlags::NoStore}
×
31
  , addressMax{this, "address_max", m_controller.inputAddressMinMax(m_channel).second, PropertyFlags::ReadOnly | PropertyFlags::NoStore}
×
32
  , simulateInputChange{*this, "simulate_input_change", MethodFlags::NoScript,
×
33
      [this](uint32_t address)
×
34
      {
UNCOV
35
        m_controller.inputSimulateChange(m_channel, InputAddress(address), SimulateInputAction::Toggle);
×
36
      }}
×
37
  , inputUsedChanged(*this, "input_used_changed", EventFlags::Public)
×
38
  , inputValueChanged(*this, "input_value_changed", EventFlags::Public)
×
39
{
UNCOV
40
  m_interfaceItems.add(addressMin);
×
41
  m_interfaceItems.add(addressMax);
×
42
  m_interfaceItems.add(simulateInputChange);
×
43
  m_interfaceItems.add(inputUsedChanged);
×
44
  m_interfaceItems.add(inputValueChanged);
×
45
}
×
46

UNCOV
47
std::string InputMonitor::getObjectId() const
×
48
{
UNCOV
49
  return ""; // todo
×
50
}
51

UNCOV
52
std::vector<InputMonitor::InputInfo> InputMonitor::getInputInfo() const
×
53
{
UNCOV
54
  std::vector<InputInfo> states;
×
55
  for(auto it : m_controller.inputMap())
×
56
  {
UNCOV
57
    const auto& input = *(it.second);
×
58
    states.emplace_back(InputInfo{input.address.value(), true, input.value.value()});
×
59
  }
×
60
  return states;
×
61
}
×
62

UNCOV
63
void InputMonitor::fireInputUsedChanged(uint32_t address, bool used)
×
64
{
UNCOV
65
  fireEvent(inputUsedChanged, address, used);
×
66
}
×
67

UNCOV
68
void InputMonitor::fireInputValueChanged(uint32_t address, TriState value)
×
69
{
UNCOV
70
  fireEvent(inputValueChanged, address, value);
×
71
}
×
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