跳转到内容

BMCLI dbc

Reference version: BMCLI 1.6.5. Command names, parameters and machine-readable fields retain their source spelling.

DBC-specific inspection and signal conversion. dbc load is the typed shortcut for database load and registers the same persistent resource object. It is not an alias for the entire database category.

Terminal window
bmcli dbc load --file=network.dbc --name=vehicle

Decode raw CAN data into signal values. Select a registered resource by name, or pass a DBC path directly. If exactly one DBC is registered it is selected automatically; multiple registered DBCs require an explicit selector. Decoded signals retain their numeric raw, physical, and unit fields. If the raw value has a DBC VAL_ entry, JSON additionally reports label; an unmapped raw value reports label:null.

Decode reports the observed value even when it is outside the DBC physical minimum/maximum; it does not clamp the value or mark it as range-validated. For example, a 16-bit Speed signal with factor 0.01, offset 0 and range [0|250] decodes raw 65535 as 655.35. This preserves abnormal observations for diagnosis. Compare decoded values with the project’s expected ranges when evaluating validity. In contrast, dbc encode and DBC-backed sending reject out-of-range input before constructing a transmission.

Terminal window
bmcli dbc decode --database=vehicle --message=EngineStatus --data="00 10 5C 00"
bmcli dbc decode --dbc=network.dbc --message=0x200 --data="00 10 5C 00"
Option Description
--database Registered DBC name or direct DBC path
--dbc Direct DBC path for this invocation
--message Message name or CAN ID (required)
--data Raw hex data bytes (required)

Encode signal values into raw CAN bytes.

Terminal window
# Preferred: --signal=Name=Value (consistent with 'message send')
bmcli dbc encode --database=vehicle --message=EngineStatus --signal=EngineSpeed=1500 --signal=EngineTemp=85
# Auto-load DBC
bmcli dbc encode --dbc=network.dbc --message=EngineStatus --signal=EngineSpeed=1500 --signal=EngineTemp=85
# Positional assignments are also accepted
bmcli dbc encode --database=vehicle --message=EngineStatus EngineSpeed=1500 EngineTemp=85

Signal values may be given as --signal=Name=Value (preferred) or as positional Name=Value pairs. --signal= is the canonical form and matches message send. Value may be a finite numeric physical value or an exact DBC VAL_ label. Numeric syntax takes precedence; labels are case-sensitive exact matches. For an unscaled, zero-offset integer signal, decimal integer text is range checked and preserved directly so signed and unsigned 64-bit extrema do not pass through double. Duplicate labels that map to different raw values are ambiguous and fail before channel lookup or transmission. Unknown and ambiguous labels return the signal name plus at most 16 valid labels in bounded error.details. dbc encode and DBC-backed message send use the same resolver, so Gear=D and Gear=3 produce identical bytes when D maps to raw value 3.

Physical-to-raw conversion rounds ordinary values to nearest and decimal half values away from zero. This rule is shared by dbc encode, DBC-backed message send, and simulation sources; for factor 0.01, examples include 1.005 -> 101, 20.015 -> 2002, 249.995 -> 25000, and -1.005 -> -101. Scaled/offset conversion uses the shortest round-tripping decimal forms of physical, factor, and offset for exact rational nearest rounding rather than a tolerance band; binary half artifacts do not promote decimal non-halves. No decimal correction is applied to the exact factor-one/zero-offset path, so large .375/.625 values retain ordinary nearest rounding. The exact integer magnitude remains integral through raw width checks and encoding, including scaled odd 64-bit raw values above the exact double integer domain; compatibility helpers that return double reject such a result instead of silently changing it. Decimal integer text outside the exact double integer domain is rejected when exact raw-range parsing fails, so 64-bit overflow cannot round back into range; its original spelling is retained as a JSON string in error details. Range and signed/unsigned width checks still apply. JSON output includes extended, fd, and brs. BMCLI preserves DBC VFrameFormat and CANFD_BRS; message send uses those values as the default IDE/FDF/BRS flags unless --flags is explicitly supplied.

Encode failures use one of these stable reason codes: invalid_argument, resource_load_failed, parse_failed, message_not_found, signal_not_found, value_out_of_range, multiplex_mismatch, or output_too_small. JSON and JSONL output include the reason as error.code and bounded context in error.details; text output prefixes the message with [reason]. Direct dbc encode, standalone message send, and daemon message send preserve the same root cause and details. Multiplexed branch signals require the matching multiplexor value in the same request.

Resource diagnostics preserve registered logical names and relative paths. For an absolute path they expose only the basename. DBC declaration parse errors include a 1-based line and position where available.

Inspect normalized DBC metadata without touching hardware.

Terminal window
bmcli dbc message list --database=vehicle --format=json
bmcli dbc message list Engine --database=vehicle
bmcli dbc message show EngineStatus --database=vehicle --format=json
bmcli dbc signal list --message=EngineStatus --database=vehicle --format=json
bmcli dbc signal show --message=EngineStatus EngineSpeed --database=vehicle --format=json

Message output includes extended-ID, CAN FD, and BRS attributes. Signal output includes bit layout, endianness, signedness, scaling, range, unit, and multiplexing metadata. JSON signal output also includes the complete ordered values array of {raw,label} DBC entries; text output prints the same map in readable raw=label form. database decode, database encode, and unscoped dbc list are intentionally not commands: use the typed DBC operations above.


Source of truth: BMCLI 1.6.5 repository documentation. Run bmcli help <category> <action> --format=json for the exact contract of the installed version.