mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:25:20 +00:00
UI: DriverManagerRpc: Don't use driver device.
This commit is contained in:
parent
1214581e67
commit
f8b43bbf99
@ -10,13 +10,7 @@
|
||||
#include "../util/osutil.h"
|
||||
#include "driverworker.h"
|
||||
|
||||
DriverManager::DriverManager(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_device(new Device(this)),
|
||||
m_driverWorker(new DriverWorker(m_device)) // autoDelete = true
|
||||
{
|
||||
setupWorker();
|
||||
}
|
||||
DriverManager::DriverManager(QObject *parent) : QObject(parent) { }
|
||||
|
||||
DriverManager::~DriverManager()
|
||||
{
|
||||
@ -46,8 +40,16 @@ bool DriverManager::isDeviceError() const
|
||||
return errorCode() != 0 && errorCode() != DriverCommon::userErrorCode();
|
||||
}
|
||||
|
||||
void DriverManager::setupWorker()
|
||||
bool DriverManager::isDeviceOpened() const
|
||||
{
|
||||
return device()->isOpened();
|
||||
}
|
||||
|
||||
void DriverManager::initialize()
|
||||
{
|
||||
m_device = new Device(this);
|
||||
m_driverWorker = new DriverWorker(device()); // autoDelete = true
|
||||
|
||||
QThreadPool::globalInstance()->start(driverWorker());
|
||||
}
|
||||
|
||||
@ -56,11 +58,6 @@ void DriverManager::abortWorker()
|
||||
driverWorker()->abort();
|
||||
}
|
||||
|
||||
bool DriverManager::isDeviceOpened() const
|
||||
{
|
||||
return device()->isOpened();
|
||||
}
|
||||
|
||||
bool DriverManager::openDevice()
|
||||
{
|
||||
const bool res = device()->open(DriverCommon::deviceName());
|
||||
|
@ -29,6 +29,8 @@ public:
|
||||
|
||||
virtual bool isDeviceOpened() const;
|
||||
|
||||
virtual void initialize();
|
||||
|
||||
virtual void reinstallDriver();
|
||||
virtual void uninstallDriver();
|
||||
|
||||
@ -49,12 +51,11 @@ public slots:
|
||||
protected:
|
||||
void setErrorCode(quint32 v);
|
||||
|
||||
virtual void abortWorker();
|
||||
|
||||
private:
|
||||
void updateErrorCode(bool success);
|
||||
|
||||
void setupWorker();
|
||||
void abortWorker();
|
||||
|
||||
bool writeData(quint32 code, QByteArray &buf, int size);
|
||||
|
||||
static void executeCommand(const QString &fileName);
|
||||
|
@ -181,6 +181,8 @@ void FortManager::removeDriver()
|
||||
|
||||
bool FortManager::setupDriver()
|
||||
{
|
||||
driverManager()->initialize();
|
||||
|
||||
bool ok = driverManager()->openDevice();
|
||||
|
||||
if (ok && !confManager()->validateDriver()) {
|
||||
|
@ -19,6 +19,8 @@ public:
|
||||
FortManager *fortManager() const { return m_fortManager; }
|
||||
RpcManager *rpcManager() const;
|
||||
|
||||
void initialize() override { }
|
||||
|
||||
void reinstallDriver() override;
|
||||
void uninstallDriver() override;
|
||||
|
||||
@ -28,6 +30,9 @@ public slots:
|
||||
bool openDevice() override;
|
||||
bool closeDevice() override;
|
||||
|
||||
protected:
|
||||
void abortWorker() override { }
|
||||
|
||||
private:
|
||||
bool m_isDeviceOpened : 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user