Skip to content

Commit

Permalink
refactor(primitives): Unified output of primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
fkglr committed Nov 27, 2023
1 parent 0a70ade commit 9ec885c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions src/gallia/commands/primitive/uds/read_by_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ async def main(self, args: Namespace) -> None:
if isinstance(resp, NegativeResponse):
logger.error(resp)
else:
logger.info("Positive response:")
logger.result("Positive response:")
data = resp.data_record
logger.info(f"hex: {data.hex()}")
logger.info(f"raw: {repr(data)}")
logger.result(
f"{self.ecu.transport.target.raw} responds to {args.DID:#06x} with {data.hex()}"
)
logger.result(f"hex: {data.hex()}")
logger.result(f"raw: {repr(data)}")
self.result = data
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/rtcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ async def main(self, args: Namespace) -> None:
if isinstance(resp, NegativeResponse):
logger.error(f"request_routine_results: {resp}")
else:
logger.result("[get result] Positive response:")
logger.result("[results] Positive response:")
logger.result(f"hex: {resp.routine_status_record.hex()}")
logger.result(f"raw: {resp.routine_status_record!r}")
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/send_pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ async def main(self, args: Namespace) -> None:
if isinstance(response, RawResponse):
logger.warning("Could not parse the response pdu")

logger.notice(f"Received {response}")
logger.result(f"Received {response}")
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/write_by_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ async def main(self, args: Namespace) -> None:
if isinstance(resp, NegativeResponse):
logger.error(resp)
else:
logger.info("Positive response")
logger.result("Success")

0 comments on commit 9ec885c

Please sign in to comment.