stack = ThreadedSerialAdapter(
        connection, make_threading_stack(protocol_stack=protocol))
    logger.info(stack)

    (data, data_kwargs) = make_send_data(application_preset)
    time.sleep(1.0)
    run_echo(stack,
             receive_blocking,
             send_data,
             data,
             expected_data_kwargs=data_kwargs,
             report_interval=report_interval,
             limit=limit)
    logger.info('Quitting!')


if __name__ == '__main__':
    args = parse_args(grouped_args={
        group_protocol_stack:
        (args_transport_logical_substack, args_application_stack)
    },
                      description='Measure performance on payload echo test.')

    # cProfile.run('main(args.logical, args.application, limit=10000)', 'serial_polling.profile')
    # p = pstats.Stats('serial_threading.profile')
    # p.strip_dirs().sort_stats('cumulative').print_stats(30)

    # main(args.logical, args.application, report_interval=100)  # for UART
    main(args.logical, args.application,
         report_interval=1000)  # for teensy4 and dueUSB
Exemple #2
0
        time.sleep(0.05)


def main(transport_logical_preset, application_preset):
    """Run echo test."""
    connection = connect_serial_retry(baudrate=115200, timeout=0.05)
    if connection is None:
        logger.fatal('Failed to establish serial connection!')
        return

    protocol = AutomaticStack(
        make_preset_stack(transport_logical=transport_logical_preset,
                          application=application_preset), ReceiveLoggerLink())
    stack = ThreadedSerialAdapter(
        connection, make_threading_stack(protocol_stack=protocol))
    logger.info(stack)

    time.sleep(1.0)
    run_once(run_console, stack, send_data, application_preset)
    logger.info('Quitting!')


if __name__ == '__main__':
    args = parse_args(grouped_args={
        group_protocol_stack:
        (args_transport_logical_substack, args_application_stack)
    },
                      description='Run console test.')

    main(args.logical, args.application)
Exemple #3
0
            yield data
    if stack.receiver_disconnected:
        raise ConnectionResetError


def main(transport_logical_preset, application_preset):
    """List the ports."""
    connection = connect_serial_retry(baudrate=115200, timeout=1.0)
    if connection is None:
        logger.fatal('Failed to establish serial connection!')
        return

    protocol = make_preset_stack(transport_logical=transport_logical_preset,
                                 application=application_preset)
    stack = ThreadedSerialAdapter(
        connection, make_threading_stack(protocol_stack=protocol))
    logger.info(stack)

    run_once(run_read, stack, receive_blocking)
    logger.info('Quitting!')


if __name__ == '__main__':
    args = parse_args(
        grouped_args={
            group_protocol_stack:
            (args_transport_logical_substack, args_application_stack)
        },
        description='Print all data received on the serial port.')
    main(args.logical, args.application)