Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion soti/umsats_soti/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def parse_send(args: str, default_sender: NodeID) -> Message:
priority: int = 255
sender_id: NodeID = default_sender
recipient_id: NodeID | None = get_implied_recipient(cmd_id)
is_ack: bool = False

# represents the bytes that will be sent in the data section of the message
data = bytearray()
Expand All @@ -128,6 +129,13 @@ def parse_send(args: str, default_sender: NodeID) -> Message:
recipient_id = NodeID(parse_int(value))
except ValueError as exc:
raise ArgumentException(f"Invalid node ID '{value}'") from exc
elif key == "ack":
if value.lower() == "true":
is_ack = True
elif value.lower() == "false":
is_ack = False
else:
raise ArgumentException(f"Invalid value for ack '{value}'. Expected true or false")
else:
raise ArgumentException(f"Unknown option '{key}'")

Expand Down Expand Up @@ -183,5 +191,5 @@ def parse_send(args: str, default_sender: NodeID) -> Message:
priority,
sender_id,
recipient_id,
False
is_ack
)