diff --git a/buzzer_tool/core/commands/check.py b/buzzer_tool/core/commands/check.py new file mode 100644 index 0000000..d0308db --- /dev/null +++ b/buzzer_tool/core/commands/check.py @@ -0,0 +1,18 @@ +# core/commands/check.py +from core.connection import BuzzerError + +def execute(conn, path: str) -> dict: + """Holt die CRC32 einer datei und gibt sie als Int zurück.""" + lines = conn.send_command("check " + path) + if not lines: + raise BuzzerError("Keine Antwort auf 'check' empfangen.") + + parts = lines[0].split() + if len(parts) != 2 or parts[0] != "CRC32": + raise BuzzerError(f"Unerwartetes Check-Format: {lines[0]}") + + crc32 = int(parts[1], 16) + + return { + "crc32": crc32 + } \ No newline at end of file