Skip to main content

Crate canlink_tscan

Crate canlink_tscan 

Source
Expand description

English | 中文

Safe Rust backend for LibTSCAN-backed CAN hardware. This crate implements CanBackend from canlink-hal.

§Validation Scope

  • Real-hardware regression in this repository is limited to TOSUN-related devices.
  • LibTSCAN documentation lists more device types on the same backend path, but they are not individually validated here.
  • Future vendor-native SDK paths should land as separate backend crates.

§Requirements

  • Windows 10/11 x64 (validated)
  • LibTSCAN runtime (libTSCAN.dll + libTSCAN.lib)
  • LibTSCAN is not distributed by this project

§Quick Start

use canlink_hal::{BackendConfig, CanBackend, CanMessage};
use canlink_tscan::TSCanBackend;

let mut backend = TSCanBackend::new();
let config = BackendConfig::new("tscan");

backend.initialize(&config)?;
backend.open_channel(0)?;

let msg = CanMessage::new_standard(0x123, &[1, 2, 3, 4])?;
backend.send_message(&msg)?;

backend.close_channel(0)?;
backend.close()?;

§TSCan Daemon Workaround (Vendor Bug)

To isolate a known vendor DLL hang in DISCONNECT_*, this crate supports an out-of-process daemon path and enables it by default. See the crate README for configuration details.

中文 | English

基于 LibTSCAN 的安全 Rust 后端,实现 canlink-halCanBackend

§验证范围

  • 当前仓库的实机回归仅覆盖同星 / TOSUN 相关硬件。
  • LibTSCAN 文档列出的其他设备类型尚未逐项验证。
  • 若未来需要厂商原生 SDK 路径,应以新的独立后端 crate 落地。

§环境要求

  • Windows 10/11 x64(已验证)
  • LibTSCAN 运行库(libTSCAN.dll + libTSCAN.lib
  • 本项目不分发 LibTSCAN 文件

§快速开始

use canlink_hal::{BackendConfig, CanBackend, CanMessage};
use canlink_tscan::TSCanBackend;

let mut backend = TSCanBackend::new();
let config = BackendConfig::new("tscan");

backend.initialize(&config)?;
backend.open_channel(0)?;

let msg = CanMessage::new_standard(0x123, &[1, 2, 3, 4])?;
backend.send_message(&msg)?;

backend.close_channel(0)?;
backend.close()?;

§TSCan 守护进程规避方案(厂商 DLL 问题)

为隔离 DISCONNECT_* 调用的厂商 DLL 卡死问题,本 crate 支持独立守护进程路径并默认启用。 具体配置见 crate README。

§相关包

Structs§

BackendConfig
Backend configuration.
BackendVersion
Backend version information.
CanMessage
Unified CAN message type.
FileConfig
File-based daemon configuration loaded from canlink-tscan.toml.
HardwareCapability
Hardware capability description.
MessageFlags
CAN message flags.
TSCanBackend
CAN backend implementation for TOSUN TSMaster devices.
TSCanBackendFactory
Factory used to create TSCanBackend instances through canlink-hal.
Timestamp
Microsecond-precision timestamp.
TscanDaemonConfig
Effective daemon configuration merged from file and backend parameters.

Enums§

CanError
Unified CAN error type.
CanId
CAN identifier (standard or extended).

Traits§

CanBackend
CAN hardware backend interface.

Type Aliases§

CanResult
Result type alias for CAN operations.