Make sure that BaseWorker deletes the thread when is finished.

Implemented ClientManager so it can manage the usb and wireless threads.
Impelmented better mutex logic on CmaClient.
Execute the cma events in a different thread so the event listener is
available.
Code refactoring.
Fix memory leaks in threads.
Updated readme.
This commit is contained in:
codestation
2013-08-25 01:40:14 -04:30
parent dfdd79e850
commit 92f4572814
29 changed files with 523 additions and 411 deletions

37
clientmanager.h Normal file
View File

@@ -0,0 +1,37 @@
#ifndef CLIENTMANAGER_H
#define CLIENTMANAGER_H
#include "database.h"
#include <QObject>
#include <QThread>
class ClientManager : public QObject
{
Q_OBJECT
public:
explicit ClientManager(QObject *parent = 0);
void start();
void stop();
private:
int thread_count;
QMutex mutex;
Database db;
QThread *usb_thread;
QThread *wireless_thread;
signals:
void deviceConnected(QString);
void deviceDisconnected();
void receivedPin(int);
void stopped();
private slots:
void refreshDatabase();
void threadStopped();
};
#endif // CLIENTMANAGER_H