Page 1 of 1

rs232

Posted: Wed Jun 13, 2012 10:04 am
by neuling
Hi everybody,
i'm looking for a library and some examples on how to write an API under wxWidgets which can write and receive informations via rs232.

i've downloaded the latest version of wxCtb, but don't really know what to use and how i should use it.
could anybody help me?

Thanks,
neuling

Re: rs232

Posted: Wed Sep 19, 2012 7:14 am
by Elmi
For RS232 access youd don't necessarily need a wxWidgets solution (especially in case nobody knows how to use it or they are not udpated for newer wxWidgets versions), there are several platform-independent solutions out there.

I'm using this one here: https://fedorahosted.org/OpenAPC/browser/liboapc

The relevant functions are all named oapc_serial_ and should be self-explanatory.

Re: rs232

Posted: Wed Sep 19, 2012 10:48 pm
by Jive Dadson
What he said. You do not want to mix the rs232 code into the wxWidget code. The rule of thumb is to keep the interface and the implementation separate. I let a boss of me talk me into breaking that rule once, for expediency, and we both lived to rue the day. Where was I? Oh yes. RS232. It is a bear. Obtaining a platform independent API is only a first skirmish of what often proves to be a tough battle. It is the most non-standard there is. Are Rx and Tx connected? Is it null-cable? How about stop-bits? Are those connectors good? Parity? Yada, yada, @#$%ing yada. Good luck.

Re: rs232

Posted: Thu Dec 12, 2013 3:38 am
by PK
There are several setups here

Code: Select all

https://github.com/vliedel/FireSoft/tree/master/serial (cross platform)
that I have running in wxWidgets using Boost (they get along fine). All are cross-platform and some are threaded and buffered - the whole works. Very fast and reliable so far. I had to look a little further for enumerating the ports (I should not post the whole function here as it is not wxWidgets specific) see

Code: Select all

EnumSerialPorts v1.24 at http://www.naughter.com/enumser.html (Windows)
 n = scandir(sysdir, &namelist, NULL, NULL);..... (Linux)
Patrick