sync
This commit is contained in:
18
buzzer_tool/core/commands/check.py
Normal file
18
buzzer_tool/core/commands/check.py
Normal file
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user