haniwers.v1.port.tester#
Serial port connectivity testing.
Provides functions to test connections to OSECHI detector devices by reading detector data from the serial port and validating the format.
Module Contents#
Functions#
Test connectivity to OSECHI detector. |
API#
- haniwers.v1.port.tester.test_port_connectivity(device: str, baudrate: int = 115200, timeout: float = 5.0) haniwers.v1.port.model.TestResult#
Test connectivity to OSECHI detector.
Opens the specified port and attempts to read detector data to verify it’s the correct device.
Args: device: Path to serial device (e.g., /dev/ttyUSB0, COM3) baudrate: Baud rate in bits per second (default: 115200) timeout: Read timeout in seconds (default: 5.0)
Returns: TestResult object indicating success or failure with details
Example: >>> result = test_port_connectivity(“/dev/ttyUSB0”) >>> if result.success: … print(f"Connected in {result.response_time:.2f}s") … else: … print(f"Error: {result.error_type}")