/[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.15 by dagobah, Sun Dec 12 06:54:41 2004 UTC revision 1.16 by mtearle, Tue Apr 5 09:55:01 2005 UTC
# Line 3  import re Line 3  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, logging  import socket, logging
6    from time import time, sleep
7    
8  asynchronous_responses = [      '400', '401', # door open/closed  asynchronous_responses = [      '400', '401', # door open/closed
9                                  '610',        # switches changed                                  '610',        # switches changed
# Line 12  asynchronous_responses = [     '400', '401', Line 13  asynchronous_responses = [     '400', '401',
13  DOOR = 1  DOOR = 1
14  SWITCH = 2  SWITCH = 2
15  KEY = 3  KEY = 3
16    TICK = 4
17    
18  class VendingException(Exception): pass  class VendingException(Exception): pass
19    
# Line 160  class VendingMachine: Line 162  class VendingMachine:
162                                  timeout = 0                                  timeout = 0
163                          else:                          else:
164                                  break                                  break
165                  if len(self.events) == 0: return None                  if len(self.events) == 0: return (TICK, time())
166                  ret = self.events[0]                  ret = self.events[0]
167                  del self.events[0]                  del self.events[0]
168                  return ret                  return ret

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

Managed by UCC Webmasters ViewVC Help
Powered by ViewVC 1.1.26