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()), 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(deviceDisconnected()), this, SIGNAL(deviceDisconnected()));
 | 
			
		||||
    connect(client, SIGNAL(refreshDatabase()), this, SLOT(refreshDatabase()));
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QImage>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QUrl>
 | 
			
		||||
 | 
			
		||||
@@ -79,10 +80,13 @@ void CmaClient::connectWireless()
 | 
			
		||||
    wireless_host_info_t host = {NULL, NULL, NULL, QCMA_REQUEST_PORT};
 | 
			
		||||
    typedef CmaClient CC;
 | 
			
		||||
 | 
			
		||||
    QTime now = QTime::currentTime();
 | 
			
		||||
    qsrand(now.msec());
 | 
			
		||||
 | 
			
		||||
    qDebug() << "Starting wireless_thread:" << QThread::currentThreadId();
 | 
			
		||||
 | 
			
		||||
    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);
 | 
			
		||||
        } else {
 | 
			
		||||
            Sleeper::msleep(2000);
 | 
			
		||||
@@ -125,6 +129,12 @@ void CmaClient::processNewConnection(vita_device_t *device)
 | 
			
		||||
    sema.release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CmaClient::registrationComplete()
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Registration completed");
 | 
			
		||||
    emit this_object->pinComplete();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int CmaClient::deviceRegistered(const char *deviceid)
 | 
			
		||||
{
 | 
			
		||||
    qDebug("Got connection request from %s", deviceid);
 | 
			
		||||
 
 | 
			
		||||
@@ -51,6 +51,7 @@ private:
 | 
			
		||||
    static int deviceRegistered(const char *deviceid);
 | 
			
		||||
    static int generatePin(wireless_vita_info_t *info, int *p_err);
 | 
			
		||||
    static int cancelCallback();
 | 
			
		||||
    static void registrationComplete();
 | 
			
		||||
 | 
			
		||||
    CmaBroadcast broadcast;
 | 
			
		||||
 | 
			
		||||
@@ -67,6 +68,7 @@ private:
 | 
			
		||||
signals:
 | 
			
		||||
    void newEvent(vita_event_t event);
 | 
			
		||||
    void receivedPin(QString, int);
 | 
			
		||||
    void pinComplete();
 | 
			
		||||
    void deviceDetected();
 | 
			
		||||
    void deviceConnected(QString);
 | 
			
		||||
    void deviceDisconnected();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user