2017-04-27 20:24:53 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-06-10 15:03:26 +03:00
|
|
|
#ifndef CONFIGUREDIVECOMPUTERTHREADS_H
|
|
|
|
#define CONFIGUREDIVECOMPUTERTHREADS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QThread>
|
|
|
|
#include "libdivecomputer.h"
|
|
|
|
#include "devicedetails.h"
|
|
|
|
|
2015-01-20 22:40:49 +01:00
|
|
|
class DeviceThread : public QThread {
|
2014-06-10 15:03:26 +03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-01-20 22:40:49 +01:00
|
|
|
DeviceThread(QObject *parent, device_data_t *data);
|
|
|
|
virtual void run() = 0;
|
2014-06-10 15:03:26 +03:00
|
|
|
signals:
|
|
|
|
void error(QString err);
|
2015-01-20 22:40:51 +01:00
|
|
|
void progress(int value);
|
2015-01-20 22:40:49 +01:00
|
|
|
protected:
|
2014-06-10 15:03:26 +03:00
|
|
|
device_data_t *m_data;
|
2015-01-20 22:40:51 +01:00
|
|
|
void progressCB(int value);
|
|
|
|
static void event_cb(dc_device_t *device, dc_event_type_t event, const void *data, void *userdata);
|
2014-06-10 15:03:26 +03:00
|
|
|
};
|
|
|
|
|
2015-01-20 22:40:49 +01:00
|
|
|
class ReadSettingsThread : public DeviceThread {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ReadSettingsThread(QObject *parent, device_data_t *data);
|
|
|
|
void run();
|
|
|
|
signals:
|
|
|
|
void devicedetails(DeviceDetails *newDeviceDetails);
|
|
|
|
};
|
|
|
|
|
|
|
|
class WriteSettingsThread : public DeviceThread {
|
2014-06-10 15:03:26 +03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-06-10 18:25:25 +03:00
|
|
|
WriteSettingsThread(QObject *parent, device_data_t *data);
|
|
|
|
void setDeviceDetails(DeviceDetails *details);
|
2015-01-20 22:40:49 +01:00
|
|
|
void run();
|
2014-12-28 20:56:58 -08:00
|
|
|
|
2014-06-10 15:03:26 +03:00
|
|
|
private:
|
|
|
|
DeviceDetails *m_deviceDetails;
|
|
|
|
};
|
|
|
|
|
2015-01-20 22:40:49 +01:00
|
|
|
class FirmwareUpdateThread : public DeviceThread {
|
2014-06-23 18:16:27 +03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
|
2015-01-20 22:40:49 +01:00
|
|
|
void run();
|
2014-12-28 20:56:58 -08:00
|
|
|
|
2014-06-23 18:16:27 +03:00
|
|
|
private:
|
|
|
|
QString m_fileName;
|
|
|
|
};
|
|
|
|
|
2015-01-20 22:40:49 +01:00
|
|
|
class ResetSettingsThread : public DeviceThread {
|
2014-10-18 00:33:47 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ResetSettingsThread(QObject *parent, device_data_t *data);
|
2015-01-20 22:40:49 +01:00
|
|
|
void run();
|
2014-10-18 00:33:47 +02:00
|
|
|
};
|
|
|
|
|
2014-06-10 15:03:26 +03:00
|
|
|
#endif // CONFIGUREDIVECOMPUTERTHREADS_H
|