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

traintastic / traintastic / 22823086659

08 Mar 2026 02:30PM UTC coverage: 26.831% (+0.06%) from 26.774%
22823086659

push

github

reinder
[cbus] renamed CBUSAccessory(Short) to Long/Short event and added node setting for Long events.

0 of 15 new or added lines in 2 files covered. (0.0%)

1909 existing lines in 38 files now uncovered.

8230 of 30674 relevant lines covered (26.83%)

186.8 hits per line

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

0.0
/server/src/hardware/output/singleoutput.cpp
1
/**
2
 * This file is part of Traintastic,
3
 * see <https://github.com/traintastic/traintastic>.
4
 *
5
 * Copyright (C) 2024-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 "singleoutput.hpp"
23
#include "outputcontroller.hpp"
24
#include "../../core/attributes.hpp"
25
#include "../../core/method.tpp"
26
#include "../../core/objectproperty.tpp"
27

UNCOV
28
SingleOutput::SingleOutput(std::shared_ptr<OutputController> outputController, OutputChannel channel_, std::optional<uint32_t> node_, uint32_t address_)
×
29
  : AddressOutput(std::move(outputController), channel_, OutputType::Pair, node_, address_)
×
30
  , value{this, "value", TriState::Undefined, PropertyFlags::ReadOnly | PropertyFlags::StoreState | PropertyFlags::ScriptReadOnly}
×
31
  , setValue{*this, "set_value", MethodFlags::ScriptCallable,
×
32
      [this](bool newValue)
×
33
      {
UNCOV
34
        if(interface)
×
35
        {
36
          if(hasNode)
×
37
          {
UNCOV
38
            return interface->setOutputValue(channel, OutputNodeAddress(node, address), toTriState(newValue));
×
39
          }
UNCOV
40
          return interface->setOutputValue(channel, OutputAddress(address), toTriState(newValue));
×
41
        }
42
        return false;
×
43
      }}
UNCOV
44
  , onValueChanged{*this, "on_value_changed", EventFlags::Scriptable}
×
45
{
46
  Attributes::addObjectEditor(value, false);
×
UNCOV
47
  Attributes::addValues(value, TriStateValues);
×
48
  m_interfaceItems.add(value);
×
49

UNCOV
50
  Attributes::addObjectEditor(setValue, false);
×
51
  m_interfaceItems.add(setValue);
×
52

53
  m_interfaceItems.add(onValueChanged);
×
54
}
×
55

56
void SingleOutput::updateValue(TriState _value)
×
57
{
UNCOV
58
  value.setValueInternal(_value);
×
59
  if(value != TriState::Undefined)
×
60
  {
UNCOV
61
    fireEvent(onValueChanged, value == TriState::True, shared_ptr<SingleOutput>());
×
UNCOV
62
    fireEvent(onValueChangedGeneric, shared_ptr<Output>());
×
63
  }
UNCOV
64
}
×
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