Help in displaying info

Hello all!
Currently I have a program which is able to communicate with a
laptop(running on windows)by a serial port. When a button is pressed
on the GUI(created by QNX’s phAB), some text will appear on the
hyperterminal of the laptop. When letter q is pressed on the laptop,
the whole program terminates else the program will continue running.
Now my question is how do I display text which is typed on the laptop
to be displayed on the QNX’s GUI? What command and which type of
widget should I use to capture this info?

Thanks in advance!

You obviously have the serial port open so you can write from the GUI to the laptop. The opposite is required to go the other way. This gets a little weirder tho because you are going to need to watch both the serial port and Photon for incoming events. A couple approachs are available and without understanding the larger picture it is hard to suggest the best approach.

You need to block on two different things and that doesn’t work by itself. One approach is to use two threads, one handling the serial port and the other handling Photon. The problem with this approach is the complexity introduced by the two threads communicating with each other and the other is Photon is not really thread safe, so all your photon calls need to be guarded by PtEnter/PtLeave calls.

Depending upon what you are trying to do, you could also just create a PtAddFdHandler and have it deal with IO as required - probably the easiest approach if it works for you.

Once you have read the data, you just display it in a PtLabel or PtText widget as appropriate for your app. Hope this helps…

Rick…

Hello Rick!

I went to the help file to look for “PtAddFtHandler” and no entries were returned. Now with no guide, how do I actually use the function you described?

Thanks in advance.

Hello Rick!

I went to the help file to look for “PtAddFtHandler” and no entries were returned. Now with no guide, how do I actually use the function you described?

Thanks in advance.

It’s PtAddFdHandler (not Ft but Fd like in File Descriptor). Use the index if the search doesn’t work.

.
Try PtAppAddFd()

PtAddFdHandler() was prolly an older variant from QNX 4.x days.