diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2016-05-12 15:55:58 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2016-05-13 11:57:10 +0000 |
commit | e03b8930eab783de3da0e10e1e3ef6bc37135021 (patch) | |
tree | ba9621af82a1a1232b07f99d0ca42f981fe86d86 /src/plugins/canbus/tinycan | |
parent | 78eb4438fd65fe4539b414db91dbc2dd7696434a (diff) |
CAN: Give some methods and variables shorter names
... that better express their purpose.
Change-Id: I2a725e755695df2eab2b11289b44d90a81012f04
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/plugins/canbus/tinycan')
-rw-r--r-- | src/plugins/canbus/tinycan/tinycanbackend.cpp | 29 | ||||
-rw-r--r-- | src/plugins/canbus/tinycan/tinycanbackend_p.h | 6 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp index 530959a..43640cc 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(); @@ -312,21 +313,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); @@ -372,7 +373,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 |