Metadata-Version: 2.4
Name: advantech_edge
Version: 2.0.6
Summary: Hardware-abstraction library for Advantech edge devices
Author: Advantech Co., Ltd.
License: LicenseRef-Proprietary
Keywords: advantech,edge,weda,wise,hardware,iot,industrial,mainboard,sensor,gpio,watchdog,thermal
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Operating System :: POSIX :: Linux
Classifier: Topic :: System :: Hardware
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Intended Audience :: Developers
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pyright; extra == "dev"
Dynamic: license-file

# advantech-edge

Python hardware-abstraction library for Advantech edge devices (industrial IoT boards).
Exposes board features through a stable public API while dispatching underneath to whichever
vendor hardware library is installed on the host: **SUSI**, **SUSI IoT**, or **EAPI**.
Mirrors the API shape of the sibling C# library `Advantech.Edge`.

## Requirements

- Linux (x86-64 or ARM64)
- Python ≥ 3.8
- Root / Administrator privileges at runtime
- One of the Advantech vendor libraries installed on the host: SUSI, SUSI IoT, or EAPI

## Installation

```bash
# From public PyPI
pip install advantech-edge

# From the internal Azure Artifacts feed (pre-release / QA-validated builds)
pip install --index-url <FEED_URL> advantech-edge

# From a local wheel
pip install dist/advantech_edge-<version>-py3-none-any.whl
```

## Quick Start

```python
from advantech.edge.platform import MainBoard

with MainBoard() as board:
    # Board identification
    print(board.board_info.name)          # e.g. "MIC-770"
    print(board.board_info.manufacturer)  # e.g. "Advantech"
    print(board.board_info.bios_version)  # e.g. "5.27"

    # Onboard sensors (None if unsupported by the active backend)
    if board.onboard_sensors:
        for src in board.onboard_sensors.temperature_sources:
            sample = board.onboard_sensors.get_temperature(src)
            print(sample.source, sample.value)  # degrees Celsius
        for src in board.onboard_sensors.voltage_sources:
            sample = board.onboard_sensors.get_voltage(src)
            print(sample.source, sample.value)  # volts
        for src in board.onboard_sensors.fan_sources:
            sample = board.onboard_sensors.get_fan_speed(src)
            print(sample.source, sample.value)  # RPM

    # GPIO (None if unsupported)
    if board.gpio:
        from advantech.edge.platform import GpioDirection, GpioLevel
        board.gpio.set_direction(0, GpioDirection.OUTPUT)
        board.gpio.set_level(0, GpioLevel.HIGH)
        print(board.gpio.get_level(0))

    # Watchdog (None if unsupported)
    if board.watchdog:
        for timer in board.watchdog.timer_ids:
            print(board.watchdog.try_get_cap(timer))
            print(board.watchdog.try_get_config(timer))

    # Thermal protection (None if unsupported)
    if board.thermal_protection:
        for zone in board.thermal_protection.zone_ids:
            print(board.thermal_protection.try_get_zone_cap(zone))
```

## API Overview

| Feature | Access | Description |
|---------|--------|-------------|
| Board info | `board.board_info` | Board name, manufacturer, BIOS version, DMI info |
| Onboard sensors | `board.onboard_sensors` | Temperature, voltage, fan-speed readings |
| GPIO | `board.gpio` | Pin direction and level control, input-change events |
| Watchdog | `board.watchdog` | Watchdog timer configuration, start/stop, event callbacks |
| Thermal protection | `board.thermal_protection` | Per-zone thermal protection policies and event callbacks |

Features not supported by the active backend are exposed as `None` on the `MainBoard` instance.

## Supported Backends

| Backend | Board Info | Sensors | GPIO | Watchdog | Thermal Protection |
|---------|:----------:|:-------:|:----:|:--------:|:-----------------:|
| SUSI | | | | ✓ | ✓ |
| SUSI IoT | ✓ | ✓ | ✓ | | |
| EAPI | ✓ | ✓ | ✓ | ✓ | |

The library auto-detects which vendor library is installed and selects the appropriate backend.
