summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/socketcan/libsocketcan.h
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2016-08-11 20:19:06 +0200
committerAndré Hartmann <aha_1980@gmx.de>2019-02-22 18:47:37 +0000
commit6ddb74e8165fc9658ab57ff5a3e09eb23ad9c69e (patch)
tree3944ab8ed5c5523d30e2f25bee7946447fe3484b /src/plugins/canbus/socketcan/libsocketcan.h
parenteb85cebadb546dafe7c87db931164491ad5cca89 (diff)
SocketCAN: Set and get bitrate by loading libsocketcan dynamically
Can be extended for further functions from this library also. [ChangeLog][Plugins][SocketCAN] If libsocketcan is available, the CAN bus bitrate can be get and set at runtime. Fixes: QTBUG-54296 Change-Id: Ie677ddb5cf4ee9f99927973d837ef7a2810a2b37 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/plugins/canbus/socketcan/libsocketcan.h')
-rw-r--r--src/plugins/canbus/socketcan/libsocketcan.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/plugins/canbus/socketcan/libsocketcan.h b/src/plugins/canbus/socketcan/libsocketcan.h
new file mode 100644
index 0000000..91229ee
--- /dev/null
+++ b/src/plugins/canbus/socketcan/libsocketcan.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Andre Hartmann <aha_1980@gmx.de>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtSerialBus module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef LIBSOCKETCAN_H
+#define LIBSOCKETCAN_H
+
+#include <QtCore/qglobal.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QString;
+
+class LibSocketCan final
+{
+public:
+ explicit LibSocketCan(QString *errorString = nullptr);
+
+ bool start(const QString &interface);
+ bool stop(const QString &interface);
+ bool restart(const QString &interface);
+
+ quint32 bitrate(const QString &interface) const;
+ bool setBitrate(const QString &interface, quint32 bitrate);
+};
+
+QT_END_NAMESPACE
+
+#endif // LIBSOCKETCAN_H