Skip to content

Commit 05fe344

Browse files
committed
added X32HOST envvar for connection string
1 parent 082cb52 commit 05fe344

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

app/oscudpsocket.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "oscudpsocket.h"
22

3-
OscUdpSocket::OscUdpSocket(QObject *parent) : QObject(parent), sendQueue(new QQueue<QByteArray*>()), sendTimer(new QTimer())
3+
OscUdpSocket::OscUdpSocket(QObject *parent) : QObject(parent), sendQueue(new QQueue<QByteArray*>()), sendTimer(new QTimer()), hostAddr(QString())
44
{
55

66
}
@@ -18,6 +18,18 @@ void OscUdpSocket::initSocket()
1818

1919
connect(udpSocket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
2020
connect(sendTimer, SIGNAL(timeout()), this, SLOT(processSendQueue()));
21+
22+
if(this->hostAddr == "") {
23+
this->hostAddr = "172.16.1.100";
24+
25+
QString envHost = QString(qgetenv("X32HOST"));
26+
if(envHost != "") {
27+
qDebug() << "Using envvar X32HOST for target address";
28+
this->hostAddr = envHost;
29+
}
30+
31+
qDebug() << "Setting connection Address to: " << this->hostAddr;
32+
}
2133
}
2234

2335
// useless !
@@ -57,7 +69,7 @@ void OscUdpSocket::processSendQueue()
5769

5870
assert(this->udpSocket != nullptr);
5971

60-
qint64 bytesWritten = this->udpSocket->writeDatagram(*data, QHostAddress("172.16.1.100"), 10023);
72+
qint64 bytesWritten = this->udpSocket->writeDatagram(*data, QHostAddress(this->hostAddr), 10023);
6173

6274
// qint64 bytesWritten = udpSocket->write(*data);
6375
if(bytesWritten < 0) {

app/oscudpsocket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class OscUdpSocket : public QObject
3737

3838
QQueue<QByteArray*>* sendQueue;
3939
QTimer* sendTimer;
40+
QString hostAddr;
4041

4142
signals:
4243
void datagramReady(QNetworkDatagram datagram);

0 commit comments

Comments
 (0)