Add registration callback to close the PIN dialog properly.
This commit is contained in:
@@ -82,7 +82,7 @@ void ClientManager::start()
|
|||||||
connect(wireless_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
|
connect(wireless_thread, SIGNAL(finished()), this, SLOT(threadStopped()));
|
||||||
connect(wireless_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
|
connect(wireless_thread, SIGNAL(finished()), client, SLOT(deleteLater()));
|
||||||
|
|
||||||
connect(client, SIGNAL(deviceConnected(QString)), &pinForm, SLOT(hide()));
|
connect(client, SIGNAL(pinComplete()), &pinForm, SLOT(hide()));
|
||||||
connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
|
connect(client, SIGNAL(deviceConnected(QString)), this, SIGNAL(deviceConnected(QString)));
|
||||||
connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
|
connect(client, SIGNAL(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
|
||||||
connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
|
connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
#include <QTime>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
@@ -79,10 +80,13 @@ void CmaClient::connectWireless()
|
|||||||
wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
|
wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
|
||||||
typedef CmaClient CC;
|
typedef CmaClient CC;
|
||||||
|
|
||||||
|
QTime now = QTime::currentTime();
|
||||||
|
qsrand(now.msec());
|
||||||
|
|
||||||
qDebug() << "Starting wireless_thread:" << QThread::currentThreadId();
|
qDebug() << "Starting wireless_thread:" << QThread::currentThreadId();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if((vita = VitaMTP_Get_First_Wireless_Vita(&host, 0, CC::cancelCallback, CC::deviceRegistered, CC::generatePin)) != NULL) {
|
if((vita = VitaMTP_Get_First_Wireless_Vita(&host, 0, CC::cancelCallback, CC::deviceRegistered, CC::generatePin, CC::registrationComplete)) != NULL) {
|
||||||
processNewConnection(vita);
|
processNewConnection(vita);
|
||||||
} else {
|
} else {
|
||||||
Sleeper::msleep(2000);
|
Sleeper::msleep(2000);
|
||||||
@@ -125,6 +129,12 @@ void CmaClient::processNewConnection(vita_device_t *device)
|
|||||||
sema.release();
|
sema.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CmaClient::registrationComplete()
|
||||||
|
{
|
||||||
|
qDebug("Registration completed");
|
||||||
|
emit this_object->pinComplete();
|
||||||
|
}
|
||||||
|
|
||||||
int CmaClient::deviceRegistered(const char *deviceid)
|
int CmaClient::deviceRegistered(const char *deviceid)
|
||||||
{
|
{
|
||||||
qDebug("Got connection request from %s", deviceid);
|
qDebug("Got connection request from %s", deviceid);
|
||||||
|
@@ -51,6 +51,7 @@ private:
|
|||||||
static int deviceRegistered(const char *deviceid);
|
static int deviceRegistered(const char *deviceid);
|
||||||
static int generatePin(wireless_vita_info_t *info, int *p_err);
|
static int generatePin(wireless_vita_info_t *info, int *p_err);
|
||||||
static int cancelCallback();
|
static int cancelCallback();
|
||||||
|
static void registrationComplete();
|
||||||
|
|
||||||
CmaBroadcast broadcast;
|
CmaBroadcast broadcast;
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ private:
|
|||||||
signals:
|
signals:
|
||||||
void newEvent(vita_event_t event);
|
void newEvent(vita_event_t event);
|
||||||
void receivedPin(QString, int);
|
void receivedPin(QString, int);
|
||||||
|
void pinComplete();
|
||||||
void deviceDetected();
|
void deviceDetected();
|
||||||
void deviceConnected(QString);
|
void deviceConnected(QString);
|
||||||
void deviceDisconnected();
|
void deviceDisconnected();
|
||||||
|
Reference in New Issue
Block a user