Results 1 to 7 of 7

Thread: QRetmoteObject communication

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default QRetmoteObject communication

    I can successfully create an Android service and use qRO to pass data from the service to my app... great!

    However, I cannot seem to get this to work.

    My app acts at the 'source' and the service acts as the 'client'. I need to pass some data from my app to the service once I start the service. I have tried using a SIGNAL from the 'source' to the 'client', which compiles and runs, but the SIGNAL does not appear to be received by the 'client'. I also tried using a PROP, but once I add that to my .rep, I get all sorts of errors... so the SIGNAL method seems to be my best option.

    In my .rep, I have

    Qt Code:
    1. SLOT(server_slot(bool clientState));
    2. SIGNAL(setBgFlagSignal(bool bgFlag));
    To copy to clipboard, switch view to plain text mode 

    In my App:

    Qt Code:
    1. connect(this,SIGNAL(updateBgFlag(bool)), &gpsObj, SLOT(server_slot(bool)));
    2. bool bgFlag = false;
    3. emit updateBgFlag(bgFlag);
    To copy to clipboard, switch view to plain text mode 

    My Remote Object has this:

    Qt Code:
    1. void GpsRemoteObject::server_slot(bool clientState)
    2. {
    3. qDebug() << "State set to: " << clientState;
    4. appIsForeground = !clientState;
    5. emit setBgFlagSignal(clientState);
    6. qDebug() << "Foreground set to: " << appIsForeground;
    7. }
    To copy to clipboard, switch view to plain text mode 

    My Client (service):

    Qt Code:
    1. repNode.connectToNode(QUrl(QStringLiteral("local:gpsremote"))); // connect with remote host node
    2. ptr.reset(repNode.acquire<GPSRemoteObjectReplica>()); // acquire replica of source from host node
    3. QObject::connect(ptr.data(), SIGNAL(setBgFlagSignal(bool)),this,SLOT(setBgFlag(bool)));
    4.  
    5. void Worker::setBgFlag(bool bgFlag) {
    6. qDebug() << "1234 bgFlag set: " << bgFlag;
    7. appIsBackground = bgFlag;
    8. }
    To copy to clipboard, switch view to plain text mode 

    What I am not seeing... is appIsBackground being set in the setBgFlag SLOT...

    Any ideas why?

    The Client (service) passes data to the Source (and then to my app) without issues... Pretty much just the reverse of what I'm trying above. Works flawlessly.

    --Sam
    Last edited by scgrant327; 26th August 2019 at 16:14.

Similar Threads

  1. Communication with USB
    By prasenjit in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2010, 00:19
  2. Qt and .Net communication
    By soniaerm in forum Qt Programming
    Replies: 0
    Last Post: 22nd April 2010, 06:37
  3. Example of SSL communication
    By Morea in forum Qt Programming
    Replies: 4
    Last Post: 25th January 2009, 23:41
  4. USB communication
    By M. Bashir in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2008, 02:56
  5. Communication Help Pls
    By munna in forum Newbie
    Replies: 1
    Last Post: 25th May 2006, 13:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.