Metadata-Version: 2.4
Name: restora_sdk
Version: 0.2.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# Restora SDK

Python bindings for BrainCo Restora devices.

## Installation

```bash
pip install restora-sdk
```

## Quick Start

```python
import asyncio

from restora_sdk import (
    GattTransport,
    RESTORA_SERVICE_UUID,
    initialize_central_adapter,
    start_scan_with_uuids,
)


async def main() -> None:
    await initialize_central_adapter()
    await start_scan_with_uuids(
        [RESTORA_SERVICE_UUID],
        GattTransport.Auto,
    )
    await asyncio.sleep(10)


asyncio.run(main())
```

`GattTransport.Auto` accepts either Bluetooth LE or GATT over BR/EDR. Use
`GattTransport.Le` or `GattTransport.BrEdr` to require a specific bearer. BR/EDR devices must be
paired first; platform support and prerequisites vary by operating system.

The package also provides connection and sensor streaming APIs (`connect_ble`, `subscribe_eeg`,
`subscribe_imu`, and `subscribe_ppg`), record decoding helpers, and protocol frame builders.

## RR-derived HRV (RMSSD)

Create one `HrvCalculator` per device or session and feed it the RR intervals and confidence from
each `PPGData` callback:

```python
from restora_sdk import HrvCalculator

hrv = HrvCalculator()


def on_ppg(_device_id: str, data) -> None:
    rmssd_ms = hrv.update(data.rr_intervals, data.hrv_confidence)
    if rmssd_ms is not None:
        print(f"RMSSD: {rmssd_ms:.1f} ms")
```

The default confidence threshold is 80. The calculator accepts RR intervals from 400 through 1500
ms. After five valid intervals, it rejects a value more than 150 ms from the latest five-sample
mean. It returns `None` until the rolling window contains 40 valid intervals, then updates for each
subsequently accepted interval. This SDK-derived RMSSD does not replace or identify the algorithm
used by device-firmware HRV fields.

## Examples

Example projects and integration guides are maintained in the source repository under
`sdk/examples/python`. Install this package first, then run the example that matches your device and
transport mode. OSS credentials used by the record upload example are read from environment
variables and are not included in the package.

## Support

If you run into device connection or API issues, please share your package version, Python version, operating system, and device model with the SDK maintainer.

