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. sending cmd to serial and tcpip depending on what is connected
Forum Updated to NodeBB v4.3 + New Features

sending cmd to serial and tcpip depending on what is connected

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 351 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.
  • P Offline
    P Offline
    Prasad_Socionext
    wrote on 28 Aug 2018, 13:49 last edited by
    #1

    Hi

    • I have 2 panels Serial port and Tcpip on the first TAB of a GUI.

    • GUI communicates with Hardware with serial port panel or Tcpip which can be selected using a radio button option.

    • serial port panel has its own backhand c++ files for detecting serial ports , read , write etc

    • same with tcpip.

    • both work well independently.

    0_1535463523494_cb29b0cc-3432-4b4c-bef7-ba9690fe0b91-image.png .

    0_1535463570823_ce87fc35-3d02-492c-bce4-fc094034770f-image.png

    both serial and tcp are defined as

    QQmlContext *classContext = engine.rootContext();
    classContext->setContextProperty("cpp_serial", &connect_serial_port);
    classContext->setContextProperty("cpp_tcp", &tcp); 
    

    in main.cpp

    Problem:

    1.) I need a wrapper on top of serial and tcp called cmd_do which checks the which panel (serial or tcpip is connected) and send cmd to that particular connection type.
    2.) how do it read the radio button status or property in c++.
    3.) if I define a class cmd_do which uses other classes like serial and tcpip which i have defined for the two panels mentioned above.

    Regards
    Prasad

    O 1 Reply Last reply 28 Aug 2018, 14:16
    0
    • P Prasad_Socionext
      28 Aug 2018, 13:49

      Hi

      • I have 2 panels Serial port and Tcpip on the first TAB of a GUI.

      • GUI communicates with Hardware with serial port panel or Tcpip which can be selected using a radio button option.

      • serial port panel has its own backhand c++ files for detecting serial ports , read , write etc

      • same with tcpip.

      • both work well independently.

      0_1535463523494_cb29b0cc-3432-4b4c-bef7-ba9690fe0b91-image.png .

      0_1535463570823_ce87fc35-3d02-492c-bce4-fc094034770f-image.png

      both serial and tcp are defined as

      QQmlContext *classContext = engine.rootContext();
      classContext->setContextProperty("cpp_serial", &connect_serial_port);
      classContext->setContextProperty("cpp_tcp", &tcp); 
      

      in main.cpp

      Problem:

      1.) I need a wrapper on top of serial and tcp called cmd_do which checks the which panel (serial or tcpip is connected) and send cmd to that particular connection type.
      2.) how do it read the radio button status or property in c++.
      3.) if I define a class cmd_do which uses other classes like serial and tcpip which i have defined for the two panels mentioned above.

      Regards
      Prasad

      O Offline
      O Offline
      ODБOï
      wrote on 28 Aug 2018, 14:16 last edited by
      #2

      hi,
      @Prasad_Socionext said in sending cmd to serial and tcpip depending on what is connected:

      2.) how do it read the radio button status or property in c++.

      One possible solution is to have a Q_PROPERTY bool in your 2 classes

      exemple :

      Q_PROPERTY(bool isSelected READ isSelected WRITE setIsSelected NOTIFY isSelectedChanged)
      

      then in qml :

        RadioButton {
                  text: "serial"
                  onClicked : cpp_serial.isSelected=checked
              }
      
      1 Reply Last reply
      1

      1/2

      28 Aug 2018, 13:49

      • Login

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