aboutsummaryrefslogtreecommitdiff
path: root/smartpensyncer.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2020-04-12 00:45:32 +0200
committerJavier <dev.git@javispedro.com>2020-04-12 01:24:39 +0200
commit5cb277888995edecfafd83fed4cf2bd510052a4b (patch)
tree9c94054e59035eece0e34e8be10ee77769b1d9e4 /smartpensyncer.h
parent7f3d796c50b1855e690f74b35fd35798142ceb35 (diff)
downloadscribiu-5cb277888995edecfafd83fed4cf2bd510052a4b.tar.gz
scribiu-5cb277888995edecfafd83fed4cf2bd510052a4b.zip
port to qt5, libusb 1.0, and openobex 1.7
Diffstat (limited to 'smartpensyncer.h')
-rw-r--r--smartpensyncer.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/smartpensyncer.h b/smartpensyncer.h
index ea31917..9dae5c0 100644
--- a/smartpensyncer.h
+++ b/smartpensyncer.h
@@ -19,6 +19,7 @@
#ifndef SMARTPENSYNCER_H
#define SMARTPENSYNCER_H
+#include <atomic>
#include <QtCore/QThread>
#include <QtCore/QDir>
#include "smartpen.h"
@@ -26,20 +27,20 @@
class SmartpenSyncer : public QThread
{
Q_OBJECT
+
public:
explicit SmartpenSyncer(const Smartpen::Address &addr, QObject *parent = 0);
~SmartpenSyncer();
Smartpen::Address penAddress() const;
- QString penName() const;
-
bool hasErrors() const;
signals:
- void penNameChanged();
+ void gotPenName(const QString &name);
public slots:
void abort();
+ void reset();
private:
void run();
@@ -48,13 +49,16 @@ private:
bool syncPaperReplay(Smartpen::PenTime lastSync, const Smartpen::ChangeReport &change);
bool extractZip(QByteArray &zipData, QDir &dir);
+private slots:
+ void handleLinkError(const QString &msg);
+
private:
- Smartpen::Address _addr;
- Smartpen *_pen;
- bool _errored;
- bool _aborted;
+ const Smartpen::Address _addr;
+ std::atomic<bool> _errored;
+ std::atomic<bool> _aborted;
- QString _penSerial;
+ // To be used only from this thread
+ Smartpen *_pen;
QString _penName;
QDir _penDataDir;
};