Directory: | ./ |
---|---|
File: | qtpdcom/src/Transmission.cpp |
Date: | 2024-11-17 04:08:36 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 16 | 37.5% |
Branches: | 4 | 16 | 25.0% |
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 | 2 | PdCom::Transmission Transmission::toPdCom() const | |
33 | { | ||
34 |
3/5✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
2 | switch (mode_) { |
35 | 1 | case Poll: | |
36 | default: | ||
37 | 1 | return { PdCom::poll_mode }; | |
38 | ✗ | case Event: | |
39 | ✗ | return { PdCom::event_mode }; | |
40 | 1 | case Continuous: | |
41 |
1/2✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | 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 |