Metadata-Version: 2.4
Name: canviz
Version: 0.1.0
Summary: Open-source browser-based CAN bus analyzer
Author-email: Chanchal Dhiman <chanchalv.dhiman@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/yourname/CANvas
Project-URL: Repository, https://github.com/yourname/CANvas
Project-URL: Issues, https://github.com/yourname/CANvas/issues
Keywords: CAN bus,automotive,analyzer,cantools,python-can
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.111
Requires-Dist: uvicorn[standard]>=0.29
Requires-Dist: python-can[gs_usb]>=4.3
Requires-Dist: pyusb>=1.2
Requires-Dist: libusb>=1.0.26
Requires-Dist: cantools>=39
Requires-Dist: aiofiles>=23
Requires-Dist: websockets>=12
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: httpx>=0.27; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"

# CANvas Backend

FastAPI + python-can backend for the CANvas CAN bus analyzer.

## Quick Start

```bash
cd backend

# Install (includes gs_usb support)
pip install -e ".[gs_usb]"

# Run with virtual bus (no hardware needed)
canvaz --interface virtual

# Run with FYSETC UCAN / any Candlelight-firmware device (Windows)
canvaz --interface gs_usb

# Run with slcan (COM port) device
canvaz --interface slcan --channel COM3 --bitrate 500000

# Run on Raspberry Pi (SocketCAN)
canvaz --interface socketcan --channel can0 --bitrate 500000
```

Browser opens automatically at http://localhost:8080.
API docs at http://localhost:8080/docs.

## Run Tests (no hardware needed)

```bash
pip install -e ".[dev]"
pytest tests/ -v
```

## API Summary

| Method | Path | Description |
|--------|------|-------------|
| POST | `/connect` | Open CAN interface |
| POST | `/disconnect` | Close interface |
| GET | `/status` | Connection state |
| POST | `/send` | Transmit a frame |
| WS | `/ws/frames` | Live frame stream |
| POST | `/dbc/load` | Upload DBC file |
| GET | `/dbc/messages` | List decoded messages |
| DELETE | `/dbc` | Unload DBC |
| POST | `/log/start` | Start recording |
| POST | `/log/stop` | Stop recording |
| GET | `/log/download/{file}` | Download log file |

## Interface Notes

**gs_usb (default):** Targets Candlelight firmware — the default on FYSETC UCAN
and most cheap CAN modules. Shows as "USB Composite Device" + "gs_usb" in
Windows Device Manager. No COM port. No reflash needed.

**slcan:** For devices running slcan firmware that enumerate as a COM port. Pass
`--channel COM3` (or whatever port Windows assigns).

**virtual:** Software bus — frames loop back on themselves. Used for development
and CI. No hardware required.

**socketcan:** Linux SocketCAN. Requires `ip link set can0 up type can bitrate 500000`
before starting. Works on Raspberry Pi and WSL2 with usbipd.
