canlink-cli 0.3.0

Command-line interface for CAN hardware abstraction layer
canlink-cli-0.3.0 is not a library.
Visit the last successful build: canlink-cli-0.3.3

CANLink CLI

Command-line interface for interacting with CAN hardware through the CANLink HAL.

Features

  • List available backends
  • Query backend capabilities
  • Send CAN messages (single-shot or periodic)
  • Receive CAN messages
  • Validate configuration files
  • Human-readable and JSON output

Installation

From Source

cargo install --path canlink-cli

From Crates.io (when published)

cargo install canlink-cli

Requirements

Real hardware usage requires:

  • Windows
  • LibTSCAN runtime (TSMaster installation or a standalone LibTSCAN bundle)

Quick Start

# List available backends

canlink list


# Query backend capabilities

canlink info tscan


# Send a CAN message

canlink send tscan 0 0x123 01 02 03 04


# Receive messages

canlink receive tscan 0 --count 5

Commands

List Available Backends

canlink list

Query Backend Information

canlink info <backend>

Example:

canlink info tscan

Send a CAN Message

canlink send <backend> <channel> <id> [data...]

Periodic mode:

canlink send tscan 0 0x123 01 02 03 04 --periodic 100 --count 10

Receive CAN Messages

canlink receive <backend> <channel> [--count <n>]

Validate Configuration File

canlink validate <config-file>

Example:

canlink validate canlink.toml

JSON Output

All commands support JSON output with the --json flag:

canlink --json info tscan

Configuration File Format

Create a canlink.toml file:

[backend]

backend_name = "tscan"

retry_count = 3

retry_interval_ms = 1000

Exit Codes

  • 0: Success
  • 2: Backend not found
  • 3: Backend error
  • 4: Configuration error
  • 5: Invalid argument
  • 6: I/O error
  • 7: Parse error
  • 8: Timeout
  • 9: No messages received

Troubleshooting

Backend Not Found

Error: Backend 'socketcan' not found

Solution: Check available backends with canlink list

Invalid Data Format

Error: Invalid hex byte: 'GG'

Solution: Use valid hex bytes (00-FF)

Missing LibTSCAN Runtime

If tscan initialization fails, ensure the LibTSCAN runtime is available and matches the installed DLL/Lib bundle.

Related Documentation

License

MIT OR Apache-2.0