/[anoncvs]/projects/dispense2/sql-edition/servers/VendingMachine.py


UCC Code Repository

Diff of /projects/dispense2/sql-edition/servers/VendingMachine.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by cameron, Sun Aug 1 07:00:15 2004 UTC revision 1.12 by cameron, Sun Aug 1 08:21:01 2004 UTC
# Line 2  Line 2 
2  import re  import re
3  from CRC import do_crc  from CRC import do_crc
4  from select import select  from select import select
5  import socket  import socket, logging
6    
7  asynchronous_responses = [      '400', '401', # door open/closed  asynchronous_responses = [      '400', '401', # door open/closed
8                                  '610',        # switches changed                                  '610',        # switches changed
# Line 42  class VendingMachine: Line 42  class VendingMachine:
42                          try:                          try:
43                                  s = self.rfh.read(1)                                  s = self.rfh.read(1)
44                          except socket.error:                          except socket.error:
                                 print "Blah, seems DEC server has fallen over"  
45                                  raise VendingException('failed to read input from vending machine')                                  raise VendingException('failed to read input from vending machine')
46                          if s == '': raise VendingException('nothing read!')                          if s == '': raise VendingException('nothing read!')
47                          if s == '\n' or s == '\r':                          if s == '\n' or s == '\r':
# Line 97  class VendingMachine: Line 96  class VendingMachine:
96                  elif code[0] == '2':                  elif code[0] == '2':
97                          self.events.append((KEY, int(code[1:3])))                          self.events.append((KEY, int(code[1:3])))
98                  else:                  else:
99                          sys.stderr.write('WARNING: Unhandled event! (%s %s)\n'%(code,text))                          logging.warning('Unhandled event! (%s %s)\n'%(code,text))
100    
101          def authed_message(self, message):          def authed_message(self, message):
102                  if self.challenge == None:                  if self.challenge == None:

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26