Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to transporting signals through the network to make a daemon-gui program pair?

how to transporting signals through the network to make a daemon-gui program pair?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 287 Views
  • 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.
  • C Offline
    C Offline
    cdwijs
    wrote on last edited by aha_1980
    #1

    Hi All,

    I would like to build software that is daemon-gui. The daemon runs all the business logic. The gui is the user interface. Both programs connect true a network socket.

    I would like to know if there's a standard way to send and receive signals via the network socket between daemon and gui.

    As a trial project, I would like to rebuild this program as a client-server program pair: https://github.com/cdwijs/Tenma_data_logger.git
    This program receives measurements from 2 multimeters, and saves them into a file. The program has the following objects (from top to bottom):
    main (RS232DATALOGGER)
    TENMA data interpreter (2 instances)
    RS232 (With a button "Connect")
    RS232Settings

    Now I'm thinking about making the following protocol to remote control this application. For instance, if I want to press the "connect" button on the top serial port of the GUI, It would send the following string to the daemon:
    "Main.temna#0.rs232.connect=true"
    The socketconnection receives it, and sends this string to the main program:
    "temna#0.rs232.connect=true"
    The main program sends the following string to the first instance of temna:
    "rs232.connect=true"
    Temna then sends this string to Rs232:
    "connect=true"
    Rs232 the opens the serial port

    If the daemon then receives a message from the serial port, the green LED in the GUI should flash, so it would send the following string:
    "Main.temna#0.rs232.RxLed=true"
    The socketconnection receives it, and sends this string to the main program:
    "temna#0.rs232.RxLed=true"
    The main program sends the following string to the first instance of temna:
    "rs232.RxLed=true"
    Temna then sends this string to Rs232:
    "RxLed=true"
    And Rs232 then turns on the RX LED (and starts a timer to turn it off again)

    The above approach has some problems:

    1. It's string based, so it takes a lot of processing power.
    2. The strings are long, so for large programs this can generate a lot of network traffic
    3. There's no guarantee about the datatypes in the signals.
    4. The GUI and the sever have to agree on the string used to communicate.

    Is there a better mechanism for transporting signals through the network?

    Cheers,
    Cedric

    [Edit aha_1980: Fixed typo in title]

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

      Hi
      You could have a look at
      https://doc.qt.io/qt-5.11/qtremoteobjects-index.html
      Not sure it fits 100% for your use case but the remote part of your description does sound like
      RPC-ish.

      1 Reply Last reply
      2

      • Login

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