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

traintastic / traintastic / 24288605255

11 Apr 2026 06:17PM UTC coverage: 25.599% (-2.4%) from 27.99%
24288605255

push

github

web-flow
Merge pull request #222 from traintastic/cbus

Added CBUS/VLCB hardware support

169 of 3369 new or added lines in 99 files covered. (5.02%)

5 existing lines in 4 files now uncovered.

8300 of 32423 relevant lines covered (25.6%)

178.31 hits per line

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

0.0
/server/src/hardware/interface/cbus/cbussessionlist.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 "cbussessionlist.hpp"
23
#include "cbussessionlisttablemodel.hpp"
24

NEW
25
CBUSSessionList::CBUSSessionList(Object& parent_, std::string_view parentPropertyName)
×
NEW
26
  : SubObject(parent_, parentPropertyName)
×
27
{
NEW
28
}
×
29

NEW
30
TableModelPtr CBUSSessionList::getModel()
×
31
{
NEW
32
  return std::make_shared<CBUSSessionListTableModel>(*this);
×
33
}
34

NEW
35
CBUSSessionList::iterator CBUSSessionList::findEngine(uint16_t address, bool isLongAddress)
×
36
{
NEW
37
  return std::find_if(m_sessions.begin(), m_sessions.end(),
×
NEW
38
    [address, isLongAddress](const auto& item)
×
39
    {
NEW
40
      return item.address == address && item.isLongAddress == isLongAddress;
×
NEW
41
    });
×
42
}
43

NEW
44
CBUSSessionList::iterator CBUSSessionList::findSession(uint8_t session)
×
45
{
NEW
46
  return std::find_if(m_sessions.begin(), m_sessions.end(),
×
NEW
47
    [session](const auto& item)
×
48
    {
NEW
49
      return item.session && *item.session == session;
×
NEW
50
    });
×
51
}
52

NEW
53
void CBUSSessionList::add(Session&& session)
×
54
{
NEW
55
  m_sessions.emplace_back(std::move(session));
×
56

NEW
57
  const auto rowCount = static_cast<uint32_t>(m_sessions.size());
×
NEW
58
  for(auto& model : m_models)
×
59
  {
NEW
60
    model->setRowCount(rowCount);
×
61
  }
NEW
62
}
×
63

NEW
64
void CBUSSessionList::clear()
×
65
{
NEW
66
  m_sessions.clear();
×
NEW
67
  for(auto& model : m_models)
×
68
  {
NEW
69
    model->setRowCount(0);
×
70
  }
NEW
71
}
×
72

NEW
73
void CBUSSessionList::rowChanged(uint32_t row)
×
74
{
NEW
75
  for(auto& model : m_models)
×
76
  {
NEW
77
    model->rowsChanged(row, row);
×
78
  }
NEW
79
}
×
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