| Directory: | ./ |
|---|---|
| File: | src/Transmission.cpp |
| Date: | 2025-11-14 14:56:08 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 4 | 18 | 22.2% |
| Branches: | 1 | 13 | 7.7% |
| 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 | case ManualPoll: | ||
| 37 | default: | ||
| 38 | ✗ | return {PdCom::poll_mode}; | |
| 39 | 6 | case Event: | |
| 40 | 6 | return {PdCom::event_mode}; | |
| 41 | ✗ | case Continuous: | |
| 42 | ✗ | 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 |