Change contract for commands to return full event

This commit is contained in:
Alex Wolden 2025-04-14 11:10:59 -07:00
parent 39ea3cb3f3
commit 6fbf15885d
17 changed files with 231 additions and 104 deletions

View file

@ -22,7 +22,7 @@ class MessageReader:
# Handle command responses
if packet_type_value == PacketType.OK.value:
result: Dict[str, Any] = {"success": True}
result: Dict[str, Any] = {}
if len(data) == 5:
result["value"] = int.from_bytes(data[1:5], byteorder='little')
@ -31,9 +31,9 @@ class MessageReader:
elif packet_type_value == PacketType.ERROR.value:
if len(data) > 1:
result = {"success": False, "error_code": data[1]}
result = {"error_code": data[1]}
else:
result = {"success": False}
result = {}
# Dispatch event for the ERROR response
await self.dispatcher.dispatch(Event(EventType.ERROR, result))