| 1 | // Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com> | 
|---|---|
| 2 | // Copyright (C) 2017 The Qt Company Ltd. | 
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 4 | |
| 5 | #ifndef PEAKCANBACKEND_P_H | 
| 6 | #define PEAKCANBACKEND_P_H | 
| 7 | |
| 8 | #include "peakcanbackend.h" | 
| 9 | #include "peakcan_symbols_p.h" | 
| 10 | |
| 11 | #if defined(Q_OS_WIN32) | 
| 12 | # include <qt_windows.h> | 
| 13 | #else | 
| 14 | // other stuff | 
| 15 | #endif | 
| 16 | |
| 17 | // | 
| 18 | // W A R N I N G | 
| 19 | // ------------- | 
| 20 | // | 
| 21 | // This file is not part of the Qt API. It exists purely as an | 
| 22 | // implementation detail. This header file may change from version to | 
| 23 | // version without notice, or even be removed. | 
| 24 | // | 
| 25 | // We mean it. | 
| 26 | // | 
| 27 | |
| 28 | QT_BEGIN_NAMESPACE | 
| 29 | |
| 30 | class QSocketNotifier; | 
| 31 | class QWinEventNotifier; | 
| 32 | class QTimer; | 
| 33 | |
| 34 | class PeakCanBackendPrivate | 
| 35 | { | 
| 36 | Q_DECLARE_PUBLIC(PeakCanBackend) | 
| 37 | public: | 
| 38 | PeakCanBackendPrivate(PeakCanBackend *q); | 
| 39 | |
| 40 | bool open(); | 
| 41 | void close(); | 
| 42 | bool setConfigurationParameter(QCanBusDevice::ConfigurationKey key, const QVariant &value); | 
| 43 | void setupChannel(const QByteArray &interfaceName); | 
| 44 | void setupDefaultConfigurations(); | 
| 45 | QString systemErrorString(TPCANStatus errorCode); | 
| 46 | void startWrite(); | 
| 47 | void startRead(); | 
| 48 | bool verifyBitRate(int bitrate); | 
| 49 | |
| 50 | PeakCanBackend * const q_ptr; | 
| 51 | |
| 52 | bool isFlexibleDatarateEnabled = false; | 
| 53 | bool isOpen = false; | 
| 54 | TPCANHandle channelIndex = PCAN_NONEBUS; | 
| 55 | QTimer *writeNotifier = nullptr; | 
| 56 | |
| 57 | #if defined(Q_OS_WIN32) | 
| 58 | QWinEventNotifier *readNotifier = nullptr; | 
| 59 | HANDLE readHandle = INVALID_HANDLE_VALUE; | 
| 60 | #else | 
| 61 | QSocketNotifier *readNotifier = nullptr; | 
| 62 | int readHandle = -1; | 
| 63 | #endif | 
| 64 | }; | 
| 65 | |
| 66 | QT_END_NAMESPACE | 
| 67 | |
| 68 | #endif // PEAKCANBACKEND_P_H | 
| 69 | 
