summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/tinycan
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/canbus/tinycan')
-rw-r--r--src/plugins/canbus/tinycan/tinycan.pro10
-rw-r--r--src/plugins/canbus/tinycan/tinycanbackend.cpp29
-rw-r--r--src/plugins/canbus/tinycan/tinycanbackend_p.h6
3 files changed, 21 insertions, 24 deletions
diff --git a/src/plugins/canbus/tinycan/tinycan.pro b/src/plugins/canbus/tinycan/tinycan.pro
index 3c3a9ab..ab6a58b 100644
--- a/src/plugins/canbus/tinycan/tinycan.pro
+++ b/src/plugins/canbus/tinycan/tinycan.pro
@@ -2,19 +2,15 @@ TARGET = qttinycanbus
QT = core-private serialbus
-PUBLIC_HEADERS += \
- tinycanbackend.h
-
-PRIVATE_HEADERS += \
+HEADERS += \
+ tinycanbackend.h \
tinycanbackend_p.h \
tinycan_symbols_p.h
SOURCES += main.cpp \
tinycanbackend.cpp
-OTHER_FILES = plugin.json
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
+DISTFILES = plugin.json
PLUGIN_TYPE = canbus
PLUGIN_EXTENDS = serialbus
diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp
index 88edf25..f1d7c5c 100644
--- a/src/plugins/canbus/tinycan/tinycanbackend.cpp
+++ b/src/plugins/canbus/tinycan/tinycanbackend.cpp
@@ -72,10 +72,11 @@ Q_GLOBAL_STATIC(QList<TinyCanBackendPrivate *>, qChannels)
static QMutex channelsGuard(QMutex::NonRecursive);
-class OutgoingEventNotifier : public QTimer
+class WriteNotifier : public QTimer
{
+ // no Q_OBJECT macro!
public:
- OutgoingEventNotifier(TinyCanBackendPrivate *d, QObject *parent)
+ WriteNotifier(TinyCanBackendPrivate *d, QObject *parent)
: QTimer(parent)
, dptr(d)
{
@@ -85,7 +86,7 @@ protected:
void timerEvent(QTimerEvent *e) override
{
if (e->timerId() == timerId()) {
- dptr->canWriteNotification();
+ dptr->startWrite();
return;
}
QTimer::timerEvent(e);
@@ -105,7 +106,7 @@ static void DRV_CALLBACK_TYPE canRxEventCallback(quint32 index, TCanMsg *frame,
QMutexLocker lock(&channelsGuard);
foreach (TinyCanBackendPrivate *p, *qChannels()) {
if (p->channelIndex == int(index)) {
- p->canReadNotification();
+ p->startRead();
return;
}
}
@@ -115,7 +116,7 @@ TinyCanBackendPrivate::TinyCanBackendPrivate(TinyCanBackend *q)
: q_ptr(q)
, isOpen(false)
, channelIndex(INDEX_INVALID)
- , outgoingEventNotifier(nullptr)
+ , writeNotifier(nullptr)
{
startupDriver();
@@ -323,21 +324,21 @@ void TinyCanBackendPrivate::enableWriteNotification(bool enable)
{
Q_Q(TinyCanBackend);
- if (outgoingEventNotifier) {
+ if (writeNotifier) {
if (enable) {
- if (!outgoingEventNotifier->isActive())
- outgoingEventNotifier->start();
+ if (!writeNotifier->isActive())
+ writeNotifier->start();
} else {
- outgoingEventNotifier->stop();
+ writeNotifier->stop();
}
} else if (enable) {
- outgoingEventNotifier = new OutgoingEventNotifier(this, q);
- outgoingEventNotifier->setInterval(0);
- outgoingEventNotifier->start();
+ writeNotifier = new WriteNotifier(this, q);
+ writeNotifier->setInterval(0);
+ writeNotifier->start();
}
}
-void TinyCanBackendPrivate::canWriteNotification()
+void TinyCanBackendPrivate::startWrite()
{
Q_Q(TinyCanBackend);
@@ -384,7 +385,7 @@ bool TinyCanBackendPrivate::enableReadNotification()
}
// this method is called from the different thread!
-void TinyCanBackendPrivate::canReadNotification()
+void TinyCanBackendPrivate::startRead()
{
Q_Q(TinyCanBackend);
diff --git a/src/plugins/canbus/tinycan/tinycanbackend_p.h b/src/plugins/canbus/tinycan/tinycanbackend_p.h
index bc0f385..14630dd 100644
--- a/src/plugins/canbus/tinycan/tinycanbackend_p.h
+++ b/src/plugins/canbus/tinycan/tinycanbackend_p.h
@@ -71,9 +71,9 @@ public:
void setupChannel(const QString &interfaceName);
void setupDefaultConfigurations();
void enableWriteNotification(bool enable);
- void canWriteNotification();
+ void startWrite();
bool enableReadNotification();
- void canReadNotification();
+ void startRead();
void startupDriver();
void cleanupDriver();
@@ -82,7 +82,7 @@ public:
TinyCanBackend * const q_ptr;
bool isOpen;
int channelIndex;
- QTimer *outgoingEventNotifier;
+ QTimer *writeNotifier;
};
QT_END_NAMESPACE