| Directory: | ./ |
|---|---|
| File: | qtpdcom/src/Transmission.cpp |
| Date: | 2025-11-23 04:09:59 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 6 | 18 | 33.3% |
| Branches: | 4 | 17 | 23.5% |
| 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 | case ManualPoll: | ||
| 37 | default: | ||
| 38 | 1 | return {PdCom::poll_mode}; | |
| 39 | ✗ | case Event: | |
| 40 | ✗ | return {PdCom::event_mode}; | |
| 41 | 1 | case Continuous: | |
| 42 |
1/2✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | return {std::chrono::duration<double>(interval_)}; |
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | /****************************************************************************/ | ||
| 47 | |||
| 48 | ✗ | QString Transmission::toString() const | |
| 49 | { | ||
| 50 | ✗ | switch (mode_) { | |
| 51 | ✗ | case Poll: | |
| 52 | default: | ||
| 53 | ✗ | return QString("poll(%1)").arg(interval_); | |
| 54 | ✗ | case ManualPoll: | |
| 55 | ✗ | return QString("manual_poll"); | |
| 56 | ✗ | case Event: | |
| 57 | ✗ | return QString("event"); | |
| 58 | ✗ | case Continuous: | |
| 59 | ✗ | return QString("cont(%1)").arg(interval_); | |
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | /****************************************************************************/ | ||
| 64 |