# {py:mod}`haniwers.v1.cli.threshold`

```{py:module} haniwers.v1.cli.threshold
```

```{autodoc2-docstring} haniwers.v1.cli.threshold
:allowtitles:
```

## Module Contents

### Functions

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`write <haniwers.v1.cli.threshold.write>`
  - ```{autodoc2-docstring} haniwers.v1.cli.threshold.write
    :summary:
    ```
````

### Data

````{list-table}
:class: autosummary longtable
:align: left

* - {py:obj}`app <haniwers.v1.cli.threshold.app>`
  - ```{autodoc2-docstring} haniwers.v1.cli.threshold.app
    :summary:
    ```
````

### API

````{py:data} app
:canonical: haniwers.v1.cli.threshold.app
:value: >
   'Typer(...)'

```{autodoc2-docstring} haniwers.v1.cli.threshold.app
```

````

````{py:function} write(ctx: typer.Context, config: typing.Optional[pathlib.Path] = typer.Option(None, '--config', help='Configuration file path (config.toml, etc). If not specified, ConfigLoader searches default locations.'), port: typing.Optional[str] = typer.Option(None, '--port', help="Serial port path for OSECHI detector (e.g., /dev/ttyUSB0, COM3). Use 'haniwers-v1 port list' to find available ports.", rich_help_panel='Device Settings'), baudrate: typing.Optional[int] = typer.Option(None, '--baudrate', min=1, help='Serial communication baud rate in bits per second (e.g., 9600, 115200).', rich_help_panel='Device Settings'), timeout: typing.Optional[float] = typer.Option(None, '--timeout', min=0.1, help='Serial read timeout in seconds (e.g., 1.0, 2.0).', rich_help_panel='Device Settings'), device_label: typing.Optional[str] = typer.Option(None, '--device-label', help='Device identifier label for logging and documentation.', rich_help_panel='Device Settings'), thresholds: str = typer.Option(..., '--thresholds', '-t', help="Threshold configuration: 'channel:threshold;channel:threshold;...'. Examples: '1:290' (single channel), '1:290;2:320;3:298' (all channels).", rich_help_panel='Threshold Settings'), max_retry: int = typer.Option(3, '--max-retry', min=1, help='Maximum number of retry attempts on communication failure (default: 3).', rich_help_panel='Threshold Settings'), history: pathlib.Path = typer.Option('threshold_history.csv', '--history', help='Audit log file for threshold operations (CSV format with timestamp). Automatically saved in workspace directory.', rich_help_panel='Threshold Settings'), workspace: typing.Optional[pathlib.Path] = typer.Option(None, '--workspace', help='Output directory for data files. Timestamped subdirectory created automatically.', rich_help_panel='Output Settings'), filename_prefix: typing.Optional[str] = typer.Option(None, '--filename-prefix', help="Prefix for output file names (e.g., 'run001').", rich_help_panel='Output Settings'), filename_suffix: typing.Optional[str] = typer.Option(None, '--filename-suffix', help="File extension/suffix for output files (e.g., '.csv').", rich_help_panel='Output Settings'), events_per_file: typing.Optional[int] = typer.Option(None, '--events-per-file', min=1, help='Number of detector events per output file before rollover.', rich_help_panel='Output Settings'), number_of_files: typing.Optional[int] = typer.Option(None, '--number-of-files', min=1, help='Maximum number of files to create in a single DAQ session.', rich_help_panel='Output Settings'), stream_mode: bool = typer.Option(False, '--stream-mode', help='Enable continuous streaming mode (output buffering disabled).', rich_help_panel='Output Settings'), daq_label: typing.Optional[str] = typer.Option(None, '--daq-label', help='Session identifier label for this DAQ run.', rich_help_panel='Output Settings'), mock: bool = typer.Option(False, '--mock', help='Use RandomMocker instead of real device for testing (no hardware required).', rich_help_panel='Testing')) -> None
:canonical: haniwers.v1.cli.threshold.write

```{autodoc2-docstring} haniwers.v1.cli.threshold.write
```
````
