• 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/aspectoutput.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 "aspectoutput.hpp"
23
#include "outputcontroller.hpp"
24
#include "../../core/attributes.hpp"
25
#include "../../core/method.tpp"
26
#include "../../core/objectproperty.tpp"
27
#include "../../utils/inrange.hpp"
28

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

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

UNCOV
54
  m_interfaceItems.add(onValueChanged);
×
55
}
×
56

57
void AspectOutput::updateValue(int16_t newValue)
×
58
{
UNCOV
59
  value.setValueInternal(newValue);
×
UNCOV
60
  fireEvent(onValueChanged, newValue, shared_ptr<AspectOutput>());
×
UNCOV
61
  fireEvent(onValueChangedGeneric, shared_ptr<Output>());
×
UNCOV
62
}
×
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