INNER CODE UNIT · Python
decode
Chanchaldhiman/CANviz · backend/canviz/cli.py:890
def decode(
input: Annotated[Path, typer.Option("--input", "-i", help="Captured JSON file from `canviz capture`")],
dbc: Annotated[Path, typer.Option("--dbc", help="DBC file for signal decoding")],
format: Annotated[
str,
typer.Option("--format", "-f", help="Output format: json | csv"),
] = "json",
output: Annotated[
Optional[Path],
typer.Option("--output", "-o", help="Output file path. If omitted, writes to stdout (for shell pipelines)."),
] = None,
) -> None:
"""
Decode a captured frame file using a DBC and write decoded signals to a file or stdout.
Reads a .json file produced by `canviz capture`, applies cantools DBC
signal decoding to each frame, and outputs the result as JSON or CSV.