comparison server/ts.py @ 82:0f7c005b3f87

move server config into config.py
author Matt Johnston <matt@ucc.asn.au>
date Wed, 11 Jul 2012 22:50:23 +0800
parents c5ad12670cae
children 51d889ad39a3
comparison
equal deleted inserted replaced
81:4a2a82d6302c 82:0f7c005b3f87
1 #!/usr/bin/env python2.7 1 #!/usr/bin/env python2.7
2 2
3 BTADDR = "00:12:03:27:70:88"
4 SLEEP_TIME = 5
5 # time that the bluetooth takes to get going? 3 # time that the bluetooth takes to get going?
6 EXTRA_WAKEUP = 0 4 EXTRA_WAKEUP = 0
7 5
8 FETCH_TRIES = 3 6 FETCH_TRIES = 3
9 7
177 utils.cheap_daemon() 175 utils.cheap_daemon()
178 176
179 while True: 177 while True:
180 sock = None 178 sock = None
181 try: 179 try:
182 sock = get_socket(BTADDR) 180 sock = get_socket(config.BTADDR)
183 except Exception, e: 181 except Exception, e:
184 print>>sys.stderr, "Error connecting:" 182 print>>sys.stderr, "Error connecting:"
185 traceback.print_exc(file=sys.stderr) 183 traceback.print_exc(file=sys.stderr)
186 sleep_time = SLEEP_TIME 184 sleep_time = config.SLEEP_TIME
187 if sock: 185 if sock:
188 next_wake = None 186 next_wake = None
189 try: 187 try:
190 next_wake_interval = do_comms(sock) 188 next_wake_interval = do_comms(sock)
191 next_wake_time = time.time() + next_wake_interval 189 next_wake_time = time.time() + next_wake_interval