if __name__ == '__main__': args = setup_args_parser() setup_logging(args.loglevel) controller = Controller(args.adapter) if args.device: try: controller.identify(args.device) except Exception as e: print(e) logging.debug(e, exc_info=True) sys.exit(-1) elif args.mac: try: controller.identify_ble(args.mac, args.adapter) except Exception as e: print(e) logging.debug(e, exc_info=True) sys.exit(-1) else: controller.load_data(args.file) if args.alias not in controller.get_pairings(): print('"{a}" is no known alias'.format(a=args.alias)) exit(-1) pairing = controller.get_pairings()[args.alias] try: pairing.identify() except Exception as e: print(e)
if __name__ == '__main__': args = setup_args_parser() setup_logging(args.loglevel) controller = Controller(args.adapter) if args.device: try: controller.identify(args.device) except Exception as e: print(e) logging.debug(e, exc_info=True) sys.exit(-1) elif args.mac: try: controller.identify_ble(args.mac) except Exception as e: print(e) logging.debug(e, exc_info=True) sys.exit(-1) else: controller.load_data(args.file) if args.alias not in controller.get_pairings(): print('"{a}" is no known alias'.format(a=args.alias)) exit(-1) pairing = controller.get_pairings()[args.alias] try: pairing.identify() except Exception as e: print(e)