mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
Change contract for commands to return full event
This commit is contained in:
parent
39ea3cb3f3
commit
6fbf15885d
17 changed files with 231 additions and 104 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue