Directory: | ./ |
---|---|
File: | src/Transmission.cpp |
Date: | 2024-08-07 15:18:03 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 4 | 16 | 25.0% |
Branches: | 1 | 12 | 8.3% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /***************************************************************************** | ||
2 | * | ||
3 | * Copyright (C) 2022 Florian Pose <fp@igh.de> | ||
4 | * | ||
5 | * This file is part of the QtPdCom library. | ||
6 | * | ||
7 | * The QtPdCom library is free software: you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU Lesser General Public License as published by | ||
9 | * the Free Software Foundation, either version 3 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | * The QtPdCom library is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | ||
15 | * License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public License | ||
18 | * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "Transmission.h" | ||
23 | |||
24 | #include <QString> | ||
25 | |||
26 | #include <sstream> | ||
27 | |||
28 | using namespace QtPdCom; | ||
29 | |||
30 | /****************************************************************************/ | ||
31 | |||
32 | 6 | PdCom::Transmission Transmission::toPdCom() const | |
33 | { | ||
34 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
6 | switch (mode_) { |
35 | ✗ | case Poll: | |
36 | default: | ||
37 | ✗ | return { PdCom::poll_mode }; | |
38 | 6 | case Event: | |
39 | 6 | return { PdCom::event_mode }; | |
40 | ✗ | case Continuous: | |
41 | ✗ | return { std::chrono::duration<double>(interval_) }; | |
42 | } | ||
43 | } | ||
44 | |||
45 | /****************************************************************************/ | ||
46 | |||
47 | ✗ | QString Transmission::toString() const | |
48 | { | ||
49 | ✗ | switch (mode_) { | |
50 | ✗ | case Poll: | |
51 | default: | ||
52 | ✗ | return QString("poll(%1)").arg(interval_); | |
53 | ✗ | case Event: | |
54 | ✗ | return QString("event"); | |
55 | ✗ | case Continuous: | |
56 | ✗ | return QString("cont(%1)").arg(interval_); | |
57 | } | ||
58 | } | ||
59 | |||
60 | /****************************************************************************/ | ||
61 |