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

View File

@@ -6,6 +6,7 @@
#include "baseworker.h"
#include <QObject>
#include <QSemaphore>
#include <vitamtp.h>
@@ -13,16 +14,15 @@ class CmaEvent : public BaseWorker
{
Q_OBJECT
public:
explicit CmaEvent(vita_device_t *s_device, vita_event_t s_event, QObject *parent = 0);
explicit CmaEvent(vita_device_t *s_device, QObject *parent = 0);
static Database *db;
static Database db;
private:
uint16_t processAllObjects(CMAObject *parent, uint32_t handle);
void vitaEventSendObject(vita_event_t *event, int eventId);
void vitaEventSendObjectMetadata(vita_event_t *event, int eventId);
void vitaEventSendNumOfObject(vita_event_t *event, int eventId);
void vitaEventCancelTask(vita_event_t *event, int eventId);
void vitaEventSendHttpObjectFromURL(vita_event_t *event, int eventId);
void vitaEventUnimplementated(vita_event_t *event, int eventId);
void vitaEventSendObjectStatus(vita_event_t *event, int eventId);
@@ -39,10 +39,17 @@ private:
void vitaEventSendCopyConfirmationInfo(vita_event_t *event, int eventId);
void vitaEventSendObjectMetadataItems(vita_event_t *event, int eventId);
void vitaEventSendNPAccountInfo(vita_event_t *event, int eventId);
void vitaEventRequestTerminate(vita_event_t *event, int eventId);
void processEvent();
bool isActive();
void setDevice(vita_device_t *device);
vita_device_t *device;
vita_event_t t_event;
bool is_active;
QMutex mutex;
QMutex active;
QSemaphore sema;
static metadata_t g_thumbmeta;
@@ -53,7 +60,8 @@ signals:
public slots:
void process();
void setEvent(vita_event_t event);
void stop();
};
#endif // CMAEVENT_H