Metadata-Version: 2.3
Name: pylinbus
Version: 0.1.0
Summary: Local Interconnect Network interface module for Python
Requires-Dist: pyvxlapi>=0.1.2
Requires-Dist: toomoss-py>=0.1.2
Requires-Dist: udsoncan>=1.26.1
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pylinbus

A Python package for **LIN bus** communication with transport-layer support
and multiple hardware backends.

## Features

- **Abstract bus interface** — implement your own hardware driver by
  subclassing `LinBus`.
- **LIN Transport Protocol** — ISO-TP-style segmentation and reassembly
  (`LinTp`) over LIN diagnostic frames (0x3C / 0x3D).
- **udsoncan connection adapter** — drop-in `LinTpConnection` for the
  popular [udsoncan](https://github.com/pylessard/python-udsoncan) UDS library.
- **Hardware backends**:
  - **Toomoss** USB-LIN adapters (`toomoss_py`)
  - **Vector** XL API (`pyvxlapi`, Windows)

## Installation

```bash
pip install pylinbus
```

## Quick start

```python
from pylinbus import LinTp
from pylinbus.backends import ToomossLin

# Open the bus
bus = ToomossLin(channel=0, bitrate=19200)
tp = LinTp(bus, nad=0x01)

# Send / receive using the transport layer
tp.send(bytes([0x10, 0x01]))
rx = tp.recv(timeout=0.5)
print(rx.hex())

bus.shutdown()
```

## Using udsoncan

```python
from udsoncan.client import Client
from udsoncan.configs import default_client_config

from pylinbus.backends import ToomossLin
from pylinbus.connection import LinTpConnection

bus = ToomossLin(channel=0, bitrate=19200)
conn = LinTpConnection(bus, nad=0x01)

cfg = dict(default_client_config)
cfg["standard_version"] = 2006

with Client(conn, config=cfg) as client:
    response = client.change_session(1)
    print(response)
```

## License

MIT
