Changed directory structure and renamed applications

- autopilot -> drone_controller
- rtsp_ai_player -> ai_controller
- added top level qmake project file
- updated documentation
- moved small demo applications from tmp/ to misc/
This commit is contained in:
Tuomas Järvinen
2024-10-19 14:44:34 +02:00
parent 54b7dc41ca
commit 45c19baa45
94 changed files with 149 additions and 204 deletions
+39
View File
@@ -0,0 +1,39 @@
#include <QCoreApplication>
#include <QUdpSocket>
#include <QHostAddress>
#include <QThread>
#include <QJsonObject>
#include <QJsonDocument>
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
if (argc != 2) {
qDebug() << "Give port number of server as only parameter";
return 1;
}
QUdpSocket udpSocket;
quint16 receiverPort = atoi(argv[1]);
for (int i = 0; i < 10000000 ; i++) {
QJsonObject json;
json["value"] = i;
QJsonDocument jsonDoc(json);
QByteArray datagram = jsonDoc.toJson();
qint64 bytesSent = udpSocket.writeDatagram(datagram, QHostAddress("127.0.0.1"), receiverPort);
if (bytesSent == -1) {
qWarning("Failed to send the datagram: %s", qPrintable(udpSocket.errorString()));
return 1;
}
else {
qDebug("Datagram sent successfully");
}
QThread::msleep(100);
}
return 0;
}