# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

SERIAL_HELPER_METADATA = Metadata(
    id="4df7ea7f38a6767c1aba72a89599b9e5c022108c.boutiques",
    name="serial_helper",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class SerialHelperOutputs(typing.NamedTuple):
    """
    Output object returned when calling `serial_helper(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def serial_helper(
    serial_port: str,
    sock_num: float | None = None,
    mp_max: float | None = None,
    mp_min: float | None = None,
    num_extra: float | None = None,
    disp_all: float | None = None,
    debug: float | None = None,
    show_times: bool = False,
    help_: bool = False,
    hist: bool = False,
    no_serial: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> SerialHelperOutputs:
    """
    Passes motion parameters from socket to serial port.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        serial_port: Output serial port filename.
        sock_num: Specify socket number to serve.
        mp_max: Limit the maximum value of the MP data.
        mp_min: Limit the minimum value of the MP data.
        num_extra: Receive additional floats per TR.
        disp_all: Receive NVOX*8 extra floats per TR.
        debug: Set the debugging level (0-3).
        show_times: Show communication times.
        help_: Display this help information.
        hist: Show the module history.
        no_serial: Turn off serial port output.
        version: Show the current version number.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SerialHelperOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SERIAL_HELPER_METADATA)
    cargs = []
    cargs.append("serial_helper")
    cargs.extend([
        "-serial_port",
        serial_port
    ])
    if sock_num is not None:
        cargs.extend([
            "-sock_num",
            str(sock_num)
        ])
    if mp_max is not None:
        cargs.extend([
            "-mp_max",
            str(mp_max)
        ])
    if mp_min is not None:
        cargs.extend([
            "-mp_min",
            str(mp_min)
        ])
    if num_extra is not None:
        cargs.extend([
            "-num_extra",
            str(num_extra)
        ])
    if disp_all is not None:
        cargs.extend([
            "-disp_all",
            str(disp_all)
        ])
    if debug is not None:
        cargs.extend([
            "-debug",
            str(debug)
        ])
    if show_times:
        cargs.append("-show_times")
    if help_:
        cargs.append("-help")
    if hist:
        cargs.append("-hist")
    if no_serial:
        cargs.append("-no_serial")
    if version:
        cargs.append("-version")
    ret = SerialHelperOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SERIAL_HELPER_METADATA",
    "SerialHelperOutputs",
    "serial_helper",
]
