QtPdCom  1.4.1
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>
30 #include <QtPdCom1/Transmission.h>
31 #include <pdcom5/Selector.h>
32 
33 namespace QtPdCom {
34 
35 class 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
double getOffset() const
Definition: PdConnection.h:59
Transmission getTransmission() const
Definition: PdConnection.h:58
PdCom::Process implementation for Qt.
Definition: Process.h:70
QtPdCom::Process * process_
Definition: PdConnection.h:78
Transmission mode for subscriptions.
Definition: Transmission.h:82
QString path
Definition: PdConnection.h:44
double getScale() const
Definition: PdConnection.h:60
QVariant getTransmissionVariant() const
Definition: PdConnection.cpp:52
void setOffset(double)
Definition: PdConnection.cpp:86
Definition: BroadcastModel.h:32
void setTransmission(QVariant)
Definition: PdConnection.cpp:73
double tau
Definition: PdConnection.h:50
void setProcess(QtPdCom::Process *)
Definition: PdConnection.cpp:42
double getTau() const
Definition: PdConnection.h:61
double scale_
Definition: PdConnection.h:82
QVariant period
Definition: PdConnection.h:46
QString path_
Definition: PdConnection.h:79
QtPdCom::Process * getProcess() const
Definition: PdConnection.cpp:34
void setScale(double)
Definition: PdConnection.cpp:91
Subscriber of a single scalar value.
Definition: ScalarSubscriber.h:39
PdCom::Selector getSelector(bool *ok=nullptr) const
Definition: PdConnection.cpp:101
bool setVariable(ScalarSubscriber &subscriber, bool ignore_selector=false)
Definition: PdConnection.cpp:144
QString getPathWithoutLocation() const
Definition: PdConnection.cpp:131
QString getPath() const
Definition: PdConnection.h:56
double scale
Definition: PdConnection.h:49
QtPdCom::Process process
Definition: PdConnection.h:43
double offset
Definition: PdConnection.h:48
QtPdCom::Transmission transmission_
Definition: PdConnection.h:80
void setTau(double)
Definition: PdConnection.cpp:96
double tau_
Definition: PdConnection.h:83
Definition: PdConnection.h:37
constexpr struct QtPdCom::event_mode_tag event_mode
double offset_
Definition: PdConnection.h:81
void setPath(QString)
Definition: PdConnection.cpp:47