• 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

54.17
/server/src/hardware/output/pairoutput.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 "pairoutput.hpp"
23
#include "outputcontroller.hpp"
24
#include "../../core/attributes.hpp"
25
#include "../../core/method.tpp"
26
#include "../../core/objectproperty.tpp"
27

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

50
  Attributes::addObjectEditor(setValue, false);
8✔
51
  m_interfaceItems.add(setValue);
8✔
52

53
  m_interfaceItems.add(onValueChanged);
8✔
54
}
8✔
55

UNCOV
56
void PairOutput::updateValue(OutputPairValue newValue)
×
57
{
58
  value.setValueInternal(newValue);
×
UNCOV
59
  if(newValue != OutputPairValue::Undefined)
×
60
  {
UNCOV
61
    fireEvent(onValueChanged, newValue, shared_ptr<PairOutput>());
×
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