canlink-tscan-sys 0.3.3

Low-level Rust FFI bindings to LibTSCAN for CAN hardware access
Documentation

CANLink TSCan Sys

Crates.io Documentation License

English | 中文

CANLink TSCan Sys provides low-level, unsafe Rust FFI bindings to the LibTSCAN C API.

Warning

This crate exposes raw C functions. For a safe, high-level API, use canlink-tscan instead.

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.

Platform Support

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

Installation

[dependencies]

canlink-tscan-sys = "0.3.0"

Basic Usage

use canlink_tscan_sys::*;
use std::ptr;

unsafe {
    initialize_lib_tscan(true, false, true);

    let mut device_count = 0;
    tscan_scan_devices(&mut device_count);

    let mut handle = 0;
    tscan_connect(ptr::null(), &mut handle);

    // ... use device ...

    tscan_disconnect_by_handle(handle);
    finalize_lib_tscan();
}

Build and Runtime Requirements

  • Provide libTSCAN.dll and libTSCAN.lib (x64) during build.
  • At runtime, libTSCAN.dll must be in the executable directory or in PATH.
  • See docs/guides/libtscan-setup-guide.md for setup details.

Related Crates

Documentation

License

MIT OR Apache-2.0

中文 | English

CANLink TSCan Sys 提供 LibTSCAN C API 的底层 Rust FFI 绑定(不安全接口)。

警告

此 crate 直接暴露 C 函数。若需要安全、高层 API,请使用 canlink-tscan

验证范围

当前仓库的实机回归仅覆盖同星 / TOSUN 相关硬件。LibTSCAN 文档列出的其他设备类型尚未逐项验证。

平台支持

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

安装

[dependencies]

canlink-tscan-sys = "0.3.0"

基础用法

use canlink_tscan_sys::*;
use std::ptr;

unsafe {
    initialize_lib_tscan(true, false, true);

    let mut device_count = 0;
    tscan_scan_devices(&mut device_count);

    let mut handle = 0;
    tscan_connect(ptr::null(), &mut handle);

    // ... 使用设备 ...

    tscan_disconnect_by_handle(handle);
    finalize_lib_tscan();
}

构建与运行要求

  • 构建时提供 libTSCAN.dlllibTSCAN.lib(x64)。
  • 运行时 libTSCAN.dll 需在可执行文件目录或 PATH 中。
  • 具体配置参考 docs/guides/libtscan-setup-guide.md

相关包

文档

许可证

MIT OR Apache-2.0