def main(): args = get_argparser().parse_args() init_logger(args) if not args.simulation and args.device is None: print("You need to specify either --simulation or -d/--device " "argument. Use --help for more information.") sys.exit(1) product = args.product.lower() if args.simulation: if product == "tdc001": dev = TdcSim() elif product == "tpz001": dev = TpzSim() else: print("Invalid product string (-P/--product), " "choose from tdc001 or tpz001") sys.exit(1) else: if product == "tdc001": dev = Tdc(args.device) elif product == "tpz001": dev = Tpz(args.device) else: print("Invalid product string (-P/--product), " "choose from tdc001 or tpz001") sys.exit(1) try: simple_server_loop({product: dev}, bind_address_from_args(args), args.port) finally: dev.close()
def main(): args = get_argparser().parse_args() init_logger(args) if os.name == "nt": asyncio.set_event_loop(asyncio.ProactorEventLoop()) if not args.simulation and args.device is None: print("You need to specify either --simulation or -d/--device " "argument. Use --help for more information.") sys.exit(1) product = args.product.lower() if args.simulation: if product == "tdc001": dev = TdcSim() elif product == "tpz001": dev = TpzSim() else: print("Invalid product string (-P/--product), " "choose from tdc001 or tpz001") sys.exit(1) else: if product == "tdc001": dev = Tdc(args.device) elif product == "tpz001": dev = Tpz(args.device) loop = asyncio.get_event_loop() loop.run_until_complete(dev.get_tpz_io_settings()) else: print("Invalid product string (-P/--product), " "choose from tdc001 or tpz001") sys.exit(1) try: simple_server_loop({product: dev}, bind_address_from_args(args), args.port) finally: dev.close()
def main(): args = get_argparser().parse_args() init_logger(args) if not args.simulation and args.device is None: print("You need to specify either --simulation or -d/--device " "argument. Use --help for more information.") sys.exit(1) if args.simulation: if args.product == "TDC001": dev = TdcSim() elif args.product == "TPZ001": dev = TpzSim() else: if args.product == "TDC001": dev = Tdc(args.device) elif args.product == "TPZ001": dev = Tpz(args.device) try: simple_server_loop({args.product.lower(): dev}, args.bind, args.port) finally: dev.close()