From 7c68ac2942ef924313e2611c5ea1a69dafa0e044 Mon Sep 17 00:00:00 2001 From: Viktor Kopp Date: Sat, 16 Nov 2024 22:27:24 +0100 Subject: [PATCH 1/2] rm unused mcudpsocket Signed-off-by: Viktor Kopp --- src/CMakeLists.txt | 1 - src/mcudpsocket.cpp | 65 --------------------------------------------- src/mcudpsocket.h | 42 ----------------------------- src/project.h | 21 --------------- src/src.pro | 1 - 5 files changed, 130 deletions(-) delete mode 100644 src/mcudpsocket.cpp delete mode 100644 src/mcudpsocket.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0397328f..30b215dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,6 @@ add_executable(dlt-viewer dltmsgqueue.cpp dltfileindexerthread.cpp dltfileindexerdefaultfilterthread.cpp - mcudpsocket.cpp sortfilterproxymodel.cpp searchform.h searchform.cpp diff --git a/src/mcudpsocket.cpp b/src/mcudpsocket.cpp deleted file mode 100644 index 94b98b0a..00000000 --- a/src/mcudpsocket.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "mcudpsocket.h" -#include - -/* -extern "C" -{ - -} -*/ -/** - * @licence app begin@ - * Copyright (C) 2011-2012 BMW AG - * - * This file is part of COVESA Project Dlt Viewer. - * - * Contributions are licensed to the COVESA Alliance under one or more - * Contribution License Agreements. - * - * \copyright - * This Source Code Form is subject to the terms of the - * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with - * this file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * \file mcudpsocket.cpp - * Gernot Wirschal 23.01.2019 - * This file was added to solve a QT problem when joining UDP multicast - * group on Windows in case a specific incoming interface has to be seleted. - * @licence end@ - */ - -#ifdef WIN32 -#pragma comment(lib, "wsock32.lib") -#include -#include -#include -#include // needed because of ip_mreq -#else -#include /* for read(), close() */ -#include /* for gettimeofday() */ -#include // needed because of ip_mreq -#endif - -MCUdpSocket::MCUdpSocket() -{ -} - -MCUdpSocket::~MCUdpSocket() -{ -} - -bool MCUdpSocket::joinMulticastGroup(QString multicast, QString receiveadapter) -{ - struct ip_mreq mreq; - socketdescriptor = this->socketDescriptor(); - snprintf(mcast,16,"%s",multicast.toStdString().c_str()); - snprintf(eth,16,"%s",receiveadapter.toStdString().c_str()); - mreq.imr_multiaddr.s_addr = inet_addr(mcast); - mreq.imr_interface.s_addr =inet_addr(eth); - result = setsockopt(socketdescriptor, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq)); - - if ( result == 0) - return true; - else - return false; -} diff --git a/src/mcudpsocket.h b/src/mcudpsocket.h deleted file mode 100644 index 90f8304f..00000000 --- a/src/mcudpsocket.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @licence app begin@ - * Copyright (C) 2011-2012 BMW AG - * - * This file is part of COVESA Project Dlt Viewer. - * - * Contributions are licensed to the COVESA Alliance under one or more - * Contribution License Agreements. - * - * \copyright - * This Source Code Form is subject to the terms of the - * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with - * this file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * \file mcudpsocket.h - * For further information see http://www.covesa.global/. - * @licence end@ - */ - -#ifndef MCUDPSOCKET_H -#define MCUDPSOCKET_H -#include - - -class MCUdpSocket : public QUdpSocket -{ - Q_OBJECT - -public: - explicit MCUdpSocket(); - ~MCUdpSocket(); - bool joinMulticastGroup(QString multicast, QString receiveadapter); - -private: - char mcast[17]; - char eth[17]; - int result; - qintptr socketdescriptor; - -}; - -#endif // MCUDPSOCKET_H diff --git a/src/project.h b/src/project.h index b4f3fbb9..46842089 100644 --- a/src/project.h +++ b/src/project.h @@ -21,14 +21,12 @@ #define PROJECT_H -#include "qdlt.h" #include "plugintreewidget.h" #include "qdltipconnection.h" #include "qdltserialconnection.h" #include "qdltplugin.h" #include "qdltsettingsmanager.h" - #include #include #include @@ -38,29 +36,10 @@ #include #include -#if defined(_MSC_VER) #include -#else -#include -#endif - -#include "settingsdialog.h" -#include "mcudpsocket.h" - -extern "C" -{ - -} -#include "plugininterface.h" - -#define DLT_VIEWER_BUFFER_SIZE 256000 -#define RCVBUFSIZE 128000 /* Size of receive buffer */ #define RECONNECT_TIMEOUT 3 - - - enum dlt_item_type { ecu_type = QTreeWidgetItem::UserType, application_type, context_type, filter_type, plugin_type }; class EcuItem : public QTreeWidgetItem diff --git a/src/src.pro b/src/src.pro index ee4bfd03..a3918dd1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -149,7 +149,6 @@ SOURCES += main.cpp \ dltmsgqueue.cpp \ dltfileindexerthread.cpp \ dltfileindexerdefaultfilterthread.cpp \ - mcudpsocket.cpp \ # Show these headers in the project HEADERS += mainwindow.h \ From 6f9925f8a364d207598802fe6c95334185ffaa19 Mon Sep 17 00:00:00 2001 From: Viktor Kopp Date: Fri, 1 Nov 2024 21:08:55 +0100 Subject: [PATCH 2/2] add clang-format settings file No enforcement, just as a tool and reference for those who want to have convenient and consistent way to format their code. Signed-off-by: Viktor Kopp --- .clang-format | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..7631cd1a --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +--- +BasedOnStyle: LLVM +ColumnLimit: 100 +IndentWidth: 4 +...