Metadata-Version: 2.4
Name: tobii-gaze-server
Version: 0.1.0
Summary: WebSocket server for Tobii Eye Tracker gaze data using Tobii Stream Engine
Author: Thomas Wagner
License: MIT
Project-URL: Homepage, https://github.com/yourusername/tobii-gaze-server
Project-URL: Repository, https://github.com/yourusername/tobii-gaze-server
Project-URL: Issues, https://github.com/yourusername/tobii-gaze-server/issues
Keywords: tobii,eye-tracking,gaze,websocket,stream-engine
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
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 :: Scientific/Engineering :: Human Machine Interfaces
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: websockets>=10.0
Provides-Extra: demo
Requires-Dist: pygame>=2.0; extra == "demo"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pygame>=2.0; extra == "dev"
Dynamic: license-file

# Tobii Gaze Server

A WebSocket server for streaming Tobii Eye Tracker gaze data using the Tobii Stream Engine.

## Features

- Real-time gaze data streaming via WebSocket
- Uses Tobii Stream Engine for calibrated gaze data
- Easy integration with web applications

## Requirements

- Windows OS
- Tobii Eye Tracker with Tobii EyeX software installed
- Python 3.8+

## Installation

### Using Conda (Recommended)

1. Create and activate the conda environment:

```bash
conda env create -f environment.yml
conda activate tobii-gaze-server
```

2. Install the package in development mode:

```bash
pip install -e .
```

### Using pip

```bash
pip install tobii-gaze-server
```

## Usage

### Demo: Gaze-Controlled Mouse

The included demo moves your mouse cursor to where you look. A dwell-activated exit button allows you to quit without using the keyboard.

```bash
conda activate tobii-gaze-server
python examples/demo.py
```

**Features:**
- Mouse cursor follows your gaze
- Red X button in the top-right corner
- Look at the X button for 1.5 seconds to exit
- Automatically starts the gaze server (or uses an existing one)

**Options:**
- `--no-server`: Don't auto-start the server (use if server is already running)
- `--url ws://host:port`: Connect to a different server URL

### Command Line

Start the server:

```bash
tobii-gaze-server
```

The server will start on `ws://localhost:8887` by default.

### As a Library

```python
from tobii_gaze_server import TobiiGazeServer

server = TobiiGazeServer(host="localhost", port=8887)
server.run()
```

### Environment Variables

- `TOBII_STREAM_ENGINE_DLL`: Path to the Tobii Stream Engine DLL (default: `C:\Program Files\Tobii\Tobii EyeX\tobii_stream_engine.dll`)

## WebSocket Protocol

### Messages from Server

#### Gaze Data
```json
{
    "type": "gaze",
    "x": 960.5,
    "y": 540.2
}
```

#### Status
```json
{
    "type": "status",
    "connected": true,
    "mode": "GAZE",
    "message": "Tobii Stream Engine - Calibrated gaze data"
}
```

### Messages to Server

#### Set Screen Size
```json
{
    "action": "set_screen_size",
    "width": 1920,
    "height": 1080
}
```

## License

MIT License - see LICENSE file for details.
