Unsolved sending cmd to serial and tcpip depending on what is connected
-
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.
.
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 -
-
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 }