QtPdCom  1.5.2
PdConnection.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 2018-2021 Wilhelm Hagemeister<hm@igh.de>
4 * 2018-2022 Florian Pose <fp@igh.de>
5 * 2018-2024 Bjarne von Horn <vh@igh.de>
6 *
7 * This file is part of the QtPdCom library.
8 *
9 * The QtPdCom library is free software: you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation, either version 3 of the License,
12 * or (at your option) any later version.
13 *
14 * The QtPdCom library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the QtPdCom Library. If not, see
21 * <http://www.gnu.org/licenses/>.
22 *
23 ****************************************************************************/
24
25#pragma once
26
27#include <QObject>
28#include <QQmlEngine>
29#include <QtPdCom1/Process.h>
31#include <pdcom5/Selector.h>
32
33namespace QtPdCom {
34
35class ScalarSubscriber;
36
38{
39 Q_GADGET
40 QML_VALUE_TYPE(pdConnection)
41 QML_ADDED_IN_VERSION(1, 4)
42
43 Q_PROPERTY(QtPdCom::Process *process READ getProcess WRITE setProcess)
44 Q_PROPERTY(QString path READ getPath WRITE setPath)
45 Q_PROPERTY(QVariant period READ getTransmissionVariant WRITE
47
48 Q_PROPERTY(double offset READ getOffset WRITE setOffset)
49 Q_PROPERTY(double scale READ getScale WRITE setScale)
50 Q_PROPERTY(double tau READ getTau WRITE setTau)
51
52 public:
53 PdConnection() = default;
54
55 QtPdCom::Process *getProcess() const;
56 QString getPath() const { return path_; }
57 QVariant getTransmissionVariant() const;
59 double getOffset() const { return offset_; }
60 double getScale() const { return scale_; }
61 double getTau() const { return tau_; }
62
63 PdCom::Selector getSelector(bool *ok = nullptr) const;
64 QString getPathWithoutLocation() const;
65
66 bool setVariable(
67 ScalarSubscriber &subscriber,
68 bool ignore_selector = false);
69
70 private:
72 void setPath(QString);
73 void setTransmission(QVariant);
74 void setOffset(double);
75 void setScale(double);
76 void setTau(double);
77
79 QString path_;
81 double offset_ = 0.0;
82 double scale_ = 1.0;
83 double tau_ = 0.0;
84};
85
86} // namespace QtPdCom
Definition PdConnection.h:38
QString getPathWithoutLocation() const
Definition PdConnection.cpp:131
void setScale(double)
Definition PdConnection.cpp:91
void setTransmission(QVariant)
Definition PdConnection.cpp:73
double offset_
Definition PdConnection.h:81
double getOffset() const
Definition PdConnection.h:59
void setTau(double)
Definition PdConnection.cpp:96
void setOffset(double)
Definition PdConnection.cpp:86
double getTau() const
Definition PdConnection.h:61
QString path
Definition PdConnection.h:44
QVariant getTransmissionVariant() const
Definition PdConnection.cpp:52
PdCom::Selector getSelector(bool *ok=nullptr) const
Definition PdConnection.cpp:101
bool setVariable(ScalarSubscriber &subscriber, bool ignore_selector=false)
Definition PdConnection.cpp:144
QtPdCom::Transmission transmission_
Definition PdConnection.h:80
QtPdCom::Process * process
Definition PdConnection.h:43
double tau
Definition PdConnection.h:50
double getScale() const
Definition PdConnection.h:60
QString path_
Definition PdConnection.h:79
QString getPath() const
Definition PdConnection.h:56
double tau_
Definition PdConnection.h:83
void setProcess(QtPdCom::Process *)
Definition PdConnection.cpp:42
double scale
Definition PdConnection.h:49
QtPdCom::Process * process_
Definition PdConnection.h:78
Transmission getTransmission() const
Definition PdConnection.h:58
double scale_
Definition PdConnection.h:82
void setPath(QString)
Definition PdConnection.cpp:47
double offset
Definition PdConnection.h:48
QVariant period
Definition PdConnection.h:46
QtPdCom::Process * getProcess() const
Definition PdConnection.cpp:34
PdCom::Process implementation for Qt.
Definition Process.h:72
Subscriber of a single scalar value.
Definition ScalarSubscriber.h:40
Transmission mode for subscriptions.
Definition Transmission.h:86
Definition BroadcastModel.h:32
constexpr struct QtPdCom::event_mode_tag event_mode