From: Mitchell Pomery Date: Sat, 14 Mar 2015 07:18:48 +0000 (+0800) Subject: Last few changes, confirmed working on vending machine X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=408301a90eee6116aefdd39ead7d9365a22f4a2d;p=uccvend-vendserver.git Last few changes, confirmed working on vending machine --- diff --git a/VendServer/VendServer.py b/VendServer/VendServer.py index d6a07a0..6a7af6b 100755 --- a/VendServer/VendServer.py +++ b/VendServer/VendServer.py @@ -642,7 +642,7 @@ class VendServer(): self.vstatus.time_to_autologout = None self.vstatus.mk.set_message('PRICECHECK') sleep(0.5) - self.scroll_options('', vstatus.mk) + self.scroll_options('', self.vstatus.mk) self.vstatus.change_state(STATE_GET_SELECTION) return @@ -923,8 +923,8 @@ class VendServer(): try: self.vstatus.cur_user = get_uid(card_id) - logging.info('Mapped card id to uid %s'%vstatus.cur_user) - self.vstatus.username = get_uname(vstatus.cur_user) + logging.info('Mapped card id to uid %s'%self.vstatus.cur_user) + self.vstatus.username = get_uname(self.vstatus.cur_user) if self.acct_is_disabled(self.vstatus.username): self.vstatus.username = '-disabled-' except ValueError: @@ -981,8 +981,8 @@ class VendServer(): except ValueError: pass - logging.info('Enrolling card %s to uid %s (%s)'%(card_id, vstatus.cur_user, vstatus.username)) - self.set_card_id(self.vstatus.cur_user, card_id) + logging.info('Enrolling card %s to uid %s (%s)'%(card_id, self.vstatus.cur_user, self.vstatus.username)) + self.set_card_id(self.vstatus.cur_user, self.card_id) self.vstatus.mk.set_messages( [(self.center('CARD'), False, 0.5), (self.center('ENROLLED'), False, 0.5)]) @@ -1085,11 +1085,11 @@ def connect_to_vend(options, cf): logging.info('Connecting to vending machine using LAT') latclient = LATClient(service = cf.ServiceName, password = cf.ServicePassword, server_name = cf.ServerName, connect_password = cf.ConnectPassword, priv_password = cf.PrivPassword) rfh, wfh = latclient.get_fh() - #elif options.use_serial: - # # Open vending machine via serial. - # logging.info('Connecting to vending machine using serial') - # serialclient = SerialClient(port = '/dev/ttyS1', baud = 9600) - # rfh,wfh = serialclient.get_fh() + elif options.use_serial: + # Open vending machine via serial. + logging.info('Connecting to vending machine using serial') + serialclient = SerialClient(port = '/dev/ttyS1', baud = 9600) + rfh,wfh = serialclient.get_fh() else: #(rfh, wfh) = popen2('../../virtualvend/vvend.py') logging.info('Connecting to virtual vending machine on %s:%d'%(options.host,options.port)) @@ -1110,7 +1110,7 @@ def parse_args(): from optparse import OptionParser op = OptionParser(usage="%prog [OPTION]...") - op.add_option('-f', '--config-file', default='./servers.conf', metavar='FILE', dest='config_file', help='use the specified config file instead of /etc/dispense/servers.conf') + op.add_option('-f', '--config-file', default='/etc/dispense2/servers.conf', metavar='FILE', dest='config_file', help='use the specified config file instead of /etc/dispense/servers.conf') op.add_option('--serial', action='store_true', default=False, dest='use_serial', help='use the serial port') op.add_option('--lat', action='store_true', default=False, dest='use_lat', help='use LAT') op.add_option('--virtualvend', action='store_false', default=True, dest='use_serial', help='use the virtual vending server instead of LAT')