# lanresort/verbleiber architecture

> Architecture diagram of the GitHub repository lanresort/verbleiber, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lanresort/verbleiber
- Repository: https://github.com/lanresort/verbleiber

## Overview

##### System Context Level

- Hardware Clients (Verbleiber) [This project]
- Central Backend (BYCEPS-whereabouts)
- Frontend (Overview interface)

##### Client Application Level

Main Components (based on src/*.rs files):
a) Core Components:
- Main Controller (main.rs)
- Configuration Manager (config.rs)
- API Client (api.rs)
- Device Manager (devices.rs)

b) Input/Output Components:
- User Input Handler (userinput.rs)
- Audio Manager (audio.rs)
- CLI Interface (cli.rs)
- Data Model (model.rs)

##### Hardware Integration Layer
Physical device interactions:
- RFID/Barcode Reader
- Button Input Device (Gamepad)
- Audio Output Device

Design Guidelines:

##### Specific details
- Configuration flow from TOML file
- User authentication flow (RFID/Barcode → Backend)
- Status update flow (Buttons → Backend)
- Audio feedback path

##### Input Flow
devices.rs ← userinput.rs ← main.rs

##### Output Flow
main.rs → audio.rs → Physical Audio Output

##### External Communication
main.rs → api.rs → Central Backend

##### Configuration
config.rs → All Components

- Component types
- Connection types
- Status states (check-in, travelling, sleeping)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main System Context
    subgraph External
        Backend["Central Backend<br/>(BYCEPS-whereabouts)"]:::external
        Frontend["Frontend<br/>(Overview Interface)"]:::external
    end

    subgraph Verbleiber["Verbleiber Client Application"]
        %% Core Components
        Main["Main Controller"]:::core
        Config["Configuration Manager"]:::core
        API["API Client"]:::core
        DeviceManager["Device Manager"]:::core

        %% I/O Components
        UserInput["User Input Handler"]:::io
        Audio["Audio Manager"]:::io
        CLI["CLI Interface"]:::io
        Model["Data Model"]:::io

        %% Configuration
        ConfigFile["Configuration File<br/>(TOML)"]:::file
    end

    %% Hardware Layer
    subgraph Hardware["Hardware Devices"]
        RFID["RFID Reader"]:::hardware
        Barcode["Barcode Scanner"]:::hardware
        Button["Button Input<br/>(Gamepad)"]:::hardware
        AudioOut["Audio Output<br/>Device"]:::hardware
    end

    %% Relationships
    ConfigFile --> Config
    Config --> Main
    Config --> API
    Config --> Audio
    Config --> DeviceManager

    Main --> API
    API --> Backend
    Backend --> Frontend

    DeviceManager --> UserInput
    UserInput --> Main

    RFID --> DeviceManager
    Barcode --> DeviceManager
    Button --> DeviceManager

    Main --> Audio
    Audio --> AudioOut

    Main --> CLI
    Main --> Model

    %% Click Events
    click Main "https://github.com/lanresort/verbleiber/blob/main/src/main.rs"
    click Config "https://github.com/lanresort/verbleiber/blob/main/src/config.rs"
    click API "https://github.com/lanresort/verbleiber/blob/main/src/api.rs"
    click DeviceManager "https://github.com/lanresort/verbleiber/blob/main/src/devices.rs"
    click UserInput "https://github.com/lanresort/verbleiber/blob/main/src/userinput.rs"
    click Audio "https://github.com/lanresort/verbleiber/blob/main/src/audio.rs"
    click CLI "https://github.com/lanresort/verbleiber/blob/main/src/cli.rs"
    click Model "https://github.com/lanresort/verbleiber/blob/main/src/model.rs"
    click ConfigFile "https://github.com/lanresort/verbleiber/blob/main/config_example.toml"

    %% Styles
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef io fill:#38a169,stroke:#2f855a,color:white
    classDef hardware fill:#ed8936,stroke:#dd6b20,color:white
    classDef external fill:#718096,stroke:#4a5568,color:white
    classDef file fill:#ecc94b,stroke:#d69e2e,color:black

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["I/O Component"]:::io
        L3["Hardware Device"]:::hardware
        L4["External System"]:::external
        L5["Configuration File"]:::file
    end
```
