Metadata-Version: 2.4
Name: tscan.lib
Version: 1.5.3
Summary: Python bindings for the TOSUN TSCAN API
Author: The TSCAN Developers
Author-email: tsmaster.dist@tosunai.cn
License: Apache License 2.0
Platform: Windows
Platform: Linux
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-can>=3.3.4
Requires-Dist: cantools>=37.2.0
Requires-Dist: ldfparser>=0.26.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# tscan.lib

`tscan.lib` provides Python bindings for the TOSUN TSCAN API. The Python import package remains `libTSCANAPI` for compatibility with existing applications.

## Requirements

- Python 3.6 or newer.
- Windows x86, Windows x64, or Linux x64.
- A supported TOSUN TSCAN device.

## Installation

Install the package with pip:

```powershell
python -m pip install tscan.lib
```

For offline environments, install the package file provided by TOSUN:

```powershell
python -m pip install <package-file>
```

## Basic Usage

```python
from ctypes import c_int32

from libTSCANAPI import finalize_lib_tscan, initialize_lib_tscan, tscan_scan_devices

initialize_lib_tscan(True, True, False)

device_count = c_int32(0)
result = tscan_scan_devices(device_count)
print("scan result:", result)
print("device count:", device_count.value)

finalize_lib_tscan()
```

## Platform Notes

- Windows supports the core TSCAN APIs and BLF APIs.
- Linux supports the core TSCAN APIs. BLF APIs are disabled on Linux and return a controlled unavailable result.
- If Linux device connection returns a permission error, install the udev rule from `libTSCANAPI/rules/99-tosun.rules`.

## Optional Integrations

To use the `libtosun` interface through `python-can`, set `IS_ADD_PYTHON_CAN` in `libTSCANAPI/config.py` to `True`, then import `libTSCANAPI` once.

To enable TOSUN-specific DBC parsing for automatic CAN and CAN FD message creation, set `IS_ADD_CANTOOLS` in `libTSCANAPI/config.py` to `True`, then import `libTSCANAPI` once.

Keep both options disabled unless the integration is required by your application.
