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

traintastic / traintastic / 26124759034

19 May 2026 08:54PM UTC coverage: 25.552% (-0.003%) from 25.555%
26124759034

push

github

reinder
[cbus] added CAN ID setting, defaults to 0x7A (122), official assignment is pending

0 of 21 new or added lines in 5 files covered. (0.0%)

1 existing line in 1 file now uncovered.

8436 of 33015 relevant lines covered (25.55%)

176.82 hits per line

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

0.0
/server/src/hardware/interface/cbus/cbussettings.cpp
1
/**
2
 * This file is part of Traintastic,
3
 * see <https://github.com/traintastic/traintastic>.
4
 *
5
 * Copyright (C) 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 "cbussettings.hpp"
23
#include "../../protocol/cbus/cbusconst.hpp"
24
#include "../../../core/attributes.hpp"
25
#include "../../../utils/displayname.hpp"
26
#include "../../../utils/unit.hpp"
27

28
CBUSSettings::CBUSSettings(Object& _parent, std::string_view parentPropertyName)
×
29
  : SubObject(_parent, parentPropertyName)
30
  , engineKeepAlive{this, "engine_keep_alive", engineKeepAliveDefault, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
31
  , dccAccessorySwitchTime{this, "dcc_accessory_switch_time", dccAccessorySwitchTimeDefault, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
NEW
32
  , canId{this, "can_id", CBUS::CanId::TRAINTASTIC, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
33
  , shortEventNodeNumber{this, "short_event_node_number", 0, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
34
  , hubEnabled{this, "hub_enabled", false, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
35
  , hubLocalhostOnly{this, "hub_localhost_only", true, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
36
  , hubPort{this, "hub_port", CBUS::defaultTCPPort, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
37
  , debugLogRXTX{this, "debug_log_rx_tx", false, PropertyFlags::ReadWrite | PropertyFlags::Store}
×
38
{
39
  Attributes::addMinMax(engineKeepAlive, engineKeepAliveMin, engineKeepAliveMax);
×
40
  Attributes::addUnit(engineKeepAlive, Unit::seconds);
×
41
  m_interfaceItems.add(engineKeepAlive);
×
42

43
  Attributes::addMinMax(dccAccessorySwitchTime, dccAccessorySwitchTimeMin, dccAccessorySwitchTimeMax);
×
44
  Attributes::addStep(dccAccessorySwitchTime, dccAccessorySwitchTimeStep);
×
45
  Attributes::addUnit(dccAccessorySwitchTime, Unit::milliSeconds);
×
46
  m_interfaceItems.add(dccAccessorySwitchTime);
×
47

NEW
48
  Attributes::addMinMax(canId, CBUS::CanId::range());
×
NEW
49
  m_interfaceItems.add(canId);
×
50

UNCOV
51
  m_interfaceItems.add(shortEventNodeNumber);
×
52

53
  m_interfaceItems.add(hubEnabled);
×
54

55
  m_interfaceItems.add(hubLocalhostOnly);
×
56

57
  m_interfaceItems.add(hubPort);
×
58

59
  Attributes::addDisplayName(debugLogRXTX, DisplayName::Hardware::debugLogRXTX);
×
60
  //Attributes::addGroup(debugLogRXTX, Group::debug);
61
  m_interfaceItems.add(debugLogRXTX);
×
62
}
×
63

64
CBUS::Config CBUSSettings::config() const
×
65
{
66
  return CBUS::Config{
67
    .engineKeepAlive = std::chrono::seconds(engineKeepAlive),
×
68
    .dccAccessorySwitchTime = std::chrono::milliseconds(dccAccessorySwitchTime),
×
NEW
69
    .canId = canId,
×
70
    .shortEventNodeNumber = shortEventNodeNumber,
×
71
    .hubEnabled = hubEnabled,
×
72
    .hubLocalhostOnly = hubLocalhostOnly,
×
73
    .hubPort = hubPort,
×
74
    .debugLogRXTX = debugLogRXTX,
×
75
  };
×
76
}
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