-
Notifications
You must be signed in to change notification settings - Fork 1
/
oscsender.h
56 lines (46 loc) · 1.41 KB
/
oscsender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef OSCSENDER_H
#define OSCSENDER_H
#include <QObject>
#include <QVariant>
#include <QtNetwork>
#include <QHostAddress>
/**
* @brief Sends OSC messages to a given host and port.
*
* Currently only supports unicast UDP.
*/
class OscSender : public QObject
{
Q_OBJECT
// TODO: Add portNumber property (and allow users to change it)
// TODO: Add hostAddress property (and allow users to change it)
// TODO: Support TCP
// TODO: Support multicast
// TODO: Support broadcast
// TODO: Support OSC bundles
// TODO: Support DNS resolution
public:
/**
* @brief Constructor.
* @param hostAddress
* @param port
* @param parent
*/
explicit OscSender(const QString& hostAddress, quint16 port, QObject* parent = nullptr);
/**
* @brief Sends an OSC message to the host and address that this sender is configured to send to.
* @param oscAddress OSC path /like/this
* @param arguments List of QVariant arguments of any type
*/
Q_INVOKABLE void send(const QString& oscAddress, const QVariantList& arguments);
signals:
// TODO: Add messageSent signal
// TODO: Add connected signal for TCP sender.
public slots:
private:
QUdpSocket* m_udpSocket;
QHostAddress m_hostAddress;
quint16 m_port;
void variantListToByteArray(QByteArray& outputResult, const QString& oscAddress, const QVariantList& arguments);
};
#endif // OSCSENDER_H