So far, we've figured out how to use the PySerial library and
can implement a kind of polling interface (ie, the main
application can call a boolean method such as
Instrument.NewData() which checks if new data is available on
the serial port and then reads and processes it if
available). However, this still depends on the main routine
consciously checking for new data. If the main application
never makes this check, data piles up in the serial port
buffer and may eventually overflow.
Most GUI toolkits ahve a way to hook a callback routine (I/O
handler) to a file descriptor. The handler would get called
whenever there's input data available. That it would function
very similarly to what you describe. I know GTK and Tk both
have such a feature, but I've not been able to find such a
feature in wxPython.
The other way to do it would be to start a thread that just
does blocking reads on the serial port and uses wx.CallAfter()
to tell the main GUI thread to do something. This is what I've
had to do due to the lack of I/O handling in wxPython.
ยทยทยท
--
Grant Edwards
grante@visi.com