Quick test for QSUsb class.

def main():
    """Quick test for QSUsb class."""
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('--url', help='QSUSB URL [http://127.0.0.1:2020]',
                        default='http://127.0.0.1:2020')
    parser.add_argument('--file', help='a test file from /&devices')
    parser.add_argument('--test_ids', help='List of test IDs',
                        default='@0c2700,@0ac2f0')
    args = parser.parse_args()

    if args.file:
        with open(args.file) as data_file:
            data = json.load(data_file)
        qsusb = pyqwikswitch.QSDevices(
            print_devices_change_callback, print_devices_change_callback)
        print_bad_data(data)
        qsusb.set_qs_values(data)
        return

    print('Execute a basic test on server: {}\n'.format(args.url))

    def qs_to_value(key, new):
        print(" --> New value: {}={}".format(key, new))

    qsusb = QSUsb(args.url, 1, qs_to_value)
    print('Version: ' + qsusb.version())
    qsusb.set_qs_values()

    qsusb.listen(print_item_callback, timeout=5)
    print("Started listening")
    try:
        # Do some test while listening
        if args.test_ids and len(args.test_ids) > 0:
            test_devices_set(qsusb.devices, args.test_ids.split(','))

        print("\n\nListening for 60 seconds (test buttons now)\n")
        sleep(60)
    except KeyboardInterrupt:
        pass
    finally:
        qsusb.stop()  # Close all threads
        print("Stopped listening")