Neil Benn wrote:
engsol wrote:
Has anyone done a script that will rspond to the serial com port(s)
receive buffer interrupt, as opposed to polling and timeouts? Win2000 is the main interest right now.
Thanks
Norm B
Hello,
I came across this problem as when I first used PySerial, I came from a java background which has the ability to register listeners to a serial comm instance and receive interrupts (although some implementations use polling behind the scenes anyway). I don't think that pyserial has this kind of thing so I used the following :
<snip>
Tabs got screwed up here is teh code again :
def __checkSerial(self):
self.__objLock.acquire()
try:
try:
intNoChars = self.__objSerialPort.inWaiting()
if (intNoChars > 0):
strReceivedString = self.__objSerialPort.read(intNoChars)
self.newMessage(strReceivedString)
except:
raise finally:
self.__objLock.release()
Cheers,
Neil
--
Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 47 D-01307 Dresden Germany
Tel : +49 (0)351 4173 154 e-mail : [EMAIL PROTECTED] Cenix Website : http://www.cenix-bioscience.com
-- http://mail.python.org/mailman/listinfo/python-list