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

traintastic / traintastic / 23401582808

22 Mar 2026 10:58AM UTC coverage: 26.237% (-0.02%) from 26.259%
23401582808

push

github

reinder
[cbus] added more message  toString's

0 of 8 new or added lines in 1 file covered. (0.0%)

158 existing lines in 3 files now uncovered.

8246 of 31429 relevant lines covered (26.24%)

182.88 hits per line

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

0.0
/server/src/hardware/protocol/cbus/iohandler/cbussimulationiohandler.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 "cbussimulationiohandler.hpp"
23
#include "../cbuskernel.hpp"
24
#include "../simulator/cbussimulator.hpp"
25

26
namespace CBUS {
27

28
SimulationIOHandler::SimulationIOHandler(Kernel& kernel, Simulator& simulator)
×
29
  : IOHandler(kernel)
30
  , m_simulator{simulator}
×
31
{
32
  m_simulator.onSend =
×
33
    [this](uint8_t canId, const Message& message)
×
34
    {
35
      // post the message, so it has some delay
UNCOV
36
      auto buffer = std::make_shared<std::byte[]>(message.size());
×
37
      std::memcpy(buffer.get(), &message, message.size());
×
UNCOV
38
      m_kernel.ioContext().post(
×
39
        [this, canId, data=std::move(buffer)]()
×
40
        {
UNCOV
41
          m_kernel.receive(canId, *reinterpret_cast<const Message*>(data.get()));
×
42
        });
×
UNCOV
43
    };
×
44
}
×
45

46
SimulationIOHandler::~SimulationIOHandler() = default;
×
47

48
void SimulationIOHandler::start()
×
49
{
UNCOV
50
  m_kernel.started();
×
UNCOV
51
}
×
52

UNCOV
53
void SimulationIOHandler::stop()
×
54
{
UNCOV
55
}
×
56

UNCOV
57
std::error_code SimulationIOHandler::send(const Message& message)
×
58
{
UNCOV
59
  m_simulator.receive(message);
×
UNCOV
60
  return {};
×
61
}
62

63
}
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