Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Wait for QCopChannel Receive event

Wait for QCopChannel Receive event

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 688 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kashif
    wrote on last edited by
    #1

    Hi,

    Following is the scenario:

    1> During application execution, at a point(a) my application sends some data to QCopChannel
    2> Application needs to wait for acknowledgement
    3> Process rest of the operation after acknowledgement
    

    Is there any way to get the required results? I have codded the following but facing two issues:
    1> Receiver does not receive data.
    2> My application is hang in this state.

        orvOk_R2 = false;
        SendMsgR1();
    
        while ( !orvOk_R2 )    //orvOk_R2 will be true if get R2 message received
        {
            //Wait for R2 
        }
    

    If i only use "SendMsgR1();" the receiver is receiving correct message.

    PS, I am working on QTopiaapplication.

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Bad idea, your blocking the event loop from processing events.

      You should rather use something like a state machine and the received to go further in your logic.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 2 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

        Bad idea, your blocking the event loop from processing events.

        You should rather use something like a state machine and the received to go further in your logic.

        K Offline
        K Offline
        Kashif
        wrote on last edited by
        #3

        Hi @SGaist,

        I don't have much expertise to to use StateMachine api. I use the following code and its working but here I can not verify if the correct acknowledgement is received or its a bad acknowledgement.

            QEventLoop loop;
            QTimer timer;
            connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
            timer.start(1000);
            loop.exec();
        

        Any simple solution instead?

        Thanks

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Bad idea, your blocking the event loop from processing events.

          You should rather use something like a state machine and the received to go further in your logic.

          K Offline
          K Offline
          Kashif
          wrote on last edited by
          #4

          Hi @SGaist,
          I modified the code slightly and it worked, here is the code snippet for your expert advise:

              while ( !orvOk_R2 )
              {
                  //Wait for R2 from AFC or timeout
                  SendMsgR1();
                  QEventLoop loop;
                  QTimer timer;
                  connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
                  timer.start(1000);
                  loop.exec();
              }
          

          Thanks

          Pablo J. RoginaP 1 Reply Last reply
          0
          • K Kashif

            Hi @SGaist,
            I modified the code slightly and it worked, here is the code snippet for your expert advise:

                while ( !orvOk_R2 )
                {
                    //Wait for R2 from AFC or timeout
                    SendMsgR1();
                    QEventLoop loop;
                    QTimer timer;
                    connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
                    timer.start(1000);
                    loop.exec();
                }
            

            Thanks

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @Kashif if your issue is solved, please don't forget to mark your post as such. Thanks

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved