if __name__ == '__main__': import doctest doctest.testmod() import sys port = None port = sys.argv[1:] and sys.argv[1] or False serial_num = sys.argv[2:] and sys.argv[2] or False if not port or not serial_num: print "usage:\n%s <port> <serial>, eg /dev/ttyUSB0 208850" % sys.argv[0] sys.exit(1) import link import stick import session from pprint import pformat logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) log.info( "howdy! I'm going to take a look at your pump and grab lots of info.") stick = stick.Stick(link.Link(port, timeout=.400)) stick.open() session = session.Pump(stick, serial_num) log.info(pformat(stick.interface_stats())) log.info('PUMP MODEL: %s' % session.read_model()) do_commands(session) log.info(pformat(stick.interface_stats())) #get_pages(session) #log.info(pformat(stick.interface_stats( ))) log.info("howdy! we downloaded a lot of pump info successfully.") # stick.open( )
if __name__ == '__main__': import doctest doctest.testmod( ) import sys port = None port = sys.argv[1:] and sys.argv[1] or False serial_num = sys.argv[2:] and sys.argv[2] or False if not port or not serial_num: print "usage:\n%s <port> <serial>, eg /dev/ttyUSB0 208850" % sys.argv[0] sys.exit(1) import link import stick import session from pprint import pformat logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) log.info("howdy! I'm going to take a look at your pump and grab lots of info.") stick = stick.Stick(link.Link(port, timeout=.400)) stick.open( ) session = session.Pump(stick, serial_num) log.info(pformat(stick.interface_stats( ))) log.info('PUMP MODEL: %s' % session.read_model( )) do_commands(session) log.info(pformat(stick.interface_stats( ))) #get_pages(session) #log.info(pformat(stick.interface_stats( ))) log.info("howdy! we downloaded a lot of pump info successfully.") # stick.open( )