I am going to build a serial communication application with PhAB. I need a window to show the received data, which widget should I use?
Is there any example of serial communication avialable? Thanks very much!
I suggest you to make a separate “server” that communicates with the hardware (a resource manager), and dedicate the graphical application only to show the data received by it… So the app send a msg to the RM, the RM implements the serial communication and when it has the data from somewhere, then it Reply with it to your graphical app.
IMHO I don’t think is a good idea to communicate “directly” with hardware from you graphical app… Maybe in the future more apps or other proceeses will need to communicate with the same hardware and if you have that intermediary “server”, it will be very easy to synchronize all the clients you need…
Thank you juanplacco,
your suggestion is a very good idea, but I am a newbie of QNX, so it is difficult for me to write a RM…
hum… It is no so difficult to write a RM since it is very well documented.
Anyway, I sent you a code, which I hope is helpful.
To get started writing and reading to/from the serial port, you can just use standars open/read/write functions… like
fd = open( “/dev/ser1”, O_RDONLY );
size_read = read( fd, buffer, sizeof( buffer ) );
To set the configuration of the stream you can do it from the console with stty command. For example:
stty baud=9600 bits=8 stopb=1 par=none < /dev/ser1
Ok, “I can only show you the door, you’re the one that has to walk through it” (Morpheus)
You can also code your I/O functions from your graphical app if you want to have an easier start…
Thank you so much JM!! It is must be helpful (but I should figure out how to use it first ). I am reading the RM document now.
By the way, I am using a self-host QNX neutrino 6.4 now, there is no IDE with it. so is there any problem for writing RM?
Not at all. You can write a full RM with vi editor.
Anyway, maybe you can start, developing your application with AppBuilder and interface with your hardware from there as start point.
You can’t throw vi at a newbees, you’ll kill their spirits lol! You can try workspace, far less powerful but less intimidating
hey mario… you are right…
As far as I’m concerned, I can live with med since vedit is unfortunately no longer available…
Juan, thanks for code, very useful (message passing).
thanks guys…I think I’d better use ped…the workspace is not available, need to be installed first…
ped, you got to be kidding?
…I am full of shame at lack of knowledge about this. Because I use ped for edit the code of the project in PhAB. So I though it could be working…or I need to install the workspace?
I think you must install workspace. Also med is a good choice if you want a text mode fast editor with syntax highlighting but no undo and not so powerfull… ws is pretty slow for my taste, but better choice than ped in all respects…
You can also edit from windows if you want, of course.
I prefer to download jed, the emacs clone.
It’s a very good text editor with text highlighting, undo etc. It’s available from the 3rd party repository and is a snap to install. It’s so useful that I can’t understand why it doesn’t ship with QNX.
Because there is already vi
ok…there are many choices…
It would work but an editor without undo to do programming is kind of painful.
Hi, I just downloaded a workspace(version:0.5C for x86) from the workspace homepage, how can I install it? This is a .qpr file.
I am using QNX6.4. Can it be installed on 6.4?
By the way, there are 4 files after I decompressed it.
Well…I though I can install it by using “qnxinstall”, but I just find it has been removed from 6.4…So I cannot help…sorry…
May be someone who have installed it before will reply us soon, keep our attention on this web