×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    21

    signal finished from qprocess in my thread can not emited

    Hi All,

    anybody can tell me what is wrong with my code below, i execute jar file on my thread using qprocess for each accepted incoming connection from client, jar file can execute successfully but after qproccess finished, signal finished could not be emitted. Here are my code:

    --------------------------------------------------------------
    Code:
    MoBEE.cpp
    
    .................................................................................
    
    void MoBEE::incomingConnection(int socketDescriptor)
    {
        ConnectionThread *thread = new ConnectionThread(socketDescriptor);
        connect(thread, SIGNAL(message(const QString&)), SIGNAL(message(const QString&)));
        connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
        thread->start();
    }
    .............................................................................
    
    ===========================================================================
    connectionthread.cpp
    ............................................
    
    ConnectionThread::ConnectionThread(int socketDescriptor, QObject* parent)
    : QThread(parent), socketDescriptor(socketDescriptor)
    {
        connect(&processSift, SIGNAL(finished(int, QProcess::ExitStatus)),
                    this, SLOT(processFinishedSift(int, QProcess::ExitStatus)));
        connect(&processSift, SIGNAL(error(QProcess::ProcessError)),
                    this, SLOT(processErrorSift(QProcess::ProcessError)));
    }
    
    void ConnectionThread::processFinishedSift(int exitCode,
                                         QProcess::ExitStatus exitStatus)
    {
        if (exitStatus == QProcess::CrashExit) {
            qDebug("Conversion program crashed");
        } else if (exitCode != 0) {
            qDebug("Conversion failed");
        } else {
            qDebug("Sift Process was done successfully");
        }
    
    }
    
    void ConnectionThread::processErrorSift(QProcess::ProcessError error)
    {
        if (error == QProcess::FailedToStart) {
            qDebug("Conversion program not found");
        }
    }
    
    void ConnectionThread::processSiftClient(QString imsi)
    {
              sourceFile = "/home/emge/matching.jar";
              targetFile="";
    
              qDebug("Process Sift is running....");
              QStringList args;
    
              
              args << "-jar" << sourceFile ;
              
              processSift.execute("java -jar /home/emge/matching.jar /home/emge "+imsi);
    
              if(processSift.waitForFinished(30*1000))
              {
                  qDebug("Process Sift was done....");
              }
    
    
    }
    
    void ConnectionThread::run()
    {
        QTcpSocket tcpSocket;
    
        if (!tcpSocket.setSocketDescriptor(socketDescriptor))
        {
            emit message("ERROR: "+ tcpSocket.errorString());
            return;
        }
    
        QByteArray error;
        QString peerHostName = tcpSocket.peerAddress().toString();
        emit message("INFO: "+ peerHostName + " connected.");
        
        QString dt = QDateTime::currentDateTime().toString(Qt::ISODate)+"Helloo Hii";
        tcpSocket.write(dt.toUtf8());
    
        if(tcpSocket.waitForReadyRead(10*1000))
        {
            QByteArray reply = tcpSocket.readAll();
            emit message("Application Client with imsi number: "+ reply +" was ready to be served");
            emit message("Sift Process is being executed for imsi number " +reply);
            imsi = reply;
    
            processSiftClient(imsi);
        }
    
        
    
    }
    .........................................................................
    =========================================================================
    Anyone can tell me how to make signal emitting properly on the QThread.

    Thank Before.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: signal finished from qprocess in my thread can not emited

    Are you talking about QThread::finished or QProcess::finished?

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    21

    Re: signal finished from qprocess in my thread can not emited

    Hi Divanov,

    I'm talking about QProcess::finished, by the way my problem was solved by perform any changing in my subclass of QThread and my MoBEE class.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: signal finished from qprocess in my thread can not emited

    Quote Originally Posted by srf.hidayat View Post
    Hi Divanov,

    I'm talking about QProcess::finished, by the way my problem was solved by perform any changing in my subclass of QThread and my MoBEE class.
    I didn't get what was the problem and how did you manage to solve it, but it's nice to know it's resolved now!

  5. #5
    Registered User
    Join Date
    Nov 2011
    Posts
    3

    Re: signal finished from qprocess in my thread can not emited

    Quote Originally Posted by divanov View Post
    I didn't get what was the problem and how did you manage to solve it, but it's nice to know it's resolved now!
    Could you please elaborate how you managed to solve this issue ? i am facing same issue

Similar Threads

  1. S60 5th ed emulator startup failed
    By hony in forum Symbian Tools & SDKs
    Replies: 8
    Last Post: 2009-08-11, 21:12
  2. Why don't S60 emulator loading?
    By K.John in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 9
    Last Post: 2009-08-11, 11:03
  3. Replies: 7
    Last Post: 2009-03-21, 18:54
  4. emulator startup failed
    By hony in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-11-11, 06:07
  5. Replies: 1
    Last Post: 2008-05-28, 13:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×