Add pont-bascule-api project

This commit is contained in:
2026-01-09 12:53:14 +00:00
parent c6d9d8cbf4
commit ee2594b9cf
4 changed files with 104 additions and 0 deletions

18
mock_bridge.py Normal file
View File

@@ -0,0 +1,18 @@
import threading
import time
class MockBridge:
def __init__(self):
self._lock = threading.Lock()
def busy(self):
return self._lock.locked()
def send_and_read_once(self, payload: bytes):
if not self._lock.acquire(blocking=False):
return {"busy": True, "error": "BUSY"}
try:
time.sleep(0.1)
return {"ok": True, "response": "OK"}
finally:
self._lock.release()