diff --git a/src/py_dvt_ate/instruments/scpi.py b/src/py_dvt_ate/instruments/scpi.py new file mode 100644 index 0000000..d7d3df4 --- /dev/null +++ b/src/py_dvt_ate/instruments/scpi.py @@ -0,0 +1,32 @@ +"""SCPI command parsing. + +This module provides SCPI (Standard Commands for Programmable Instruments) +command parsing for instrument communication. It handles IEEE 488.2 common +commands (*IDN?, *RST, etc.) and instrument-specific commands. +""" + +from dataclasses import dataclass + + +@dataclass +class SCPICommand: + """Parsed SCPI command. + + Attributes: + header: The command header (e.g., "TEMP:SETPOINT" or "*IDN"). + arguments: List of command arguments (e.g., ["85.0"]). + is_query: True if the command ends with '?' (query command). + """ + + header: str + arguments: list[str] + is_query: bool + + @property + def keyword(self) -> str: + """Return the command keyword without '?'. + + For query commands like "TEMP:SETPOINT?", returns "TEMP:SETPOINT". + For regular commands like "VOLT", returns "VOLT". + """ + return self.header.rstrip("?")