# sheesh0327/pisophone-kiosk-launcher-v1 architecture

> Architecture diagram of the GitHub repository sheesh0327/pisophone-kiosk-launcher-v1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sheesh0327/pisophone-kiosk-launcher-v1
- Repository: https://github.com/sheesh0327/pisophone-kiosk-launcher-v1

## Overview

TechNet PisoHub combines coin-operated Wi-Fi with rental Android phones. The main phone workflow is coin box payment delivery to the kiosk, where payment is credited once and paid time drives a locked/unlocked session. A separate router portal sells Wi-Fi time, while the box firmware also provides owner administration and durable payment handling. The README establishes the product-level flows; sampled source and the SOURCE INDEX support selected internal calls. Several firmware and router details are documented but not sampled, so those connections are shown only where the README explicitly supports them.

Main entry points: [`app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt`](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt) (Kiosk engine), [`tools/pisoportal/src/main.rs`](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/tools/pisoportal/src/main.rs) (PisoWiFi portal), [`app/src/main/java/com/pisophone/kiosk/KioskService.kt`](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/KioskService.kt) (Kiosk service), [`esp32_firmware/src/CoinSlotManager.cpp`](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/CoinSlotManager.cpp) (Coin slot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_phone["PisoPhone kiosk"]
  node_kiosk_service["Kiosk service<br/>[KioskService.kt]"]
  node_engine["Kiosk engine<br/>[KioskEngine.kt]"]
  node_esp_connection["Box connection"]
  node_wifi_join["Kiosk Wi-Fi<br/>[KioskWifi.kt]"]
  node_overlay["Kiosk overlay"]
end

subgraph group_box["Coin box firmware"]
  node_box_coin_slot["Coin slot"]
  node_box_queue[("Payment queue")]
  node_box_web["Box dashboard API"]
  node_box_config[("Box configuration<br/>[Config.cpp]")]
end

subgraph group_wifi["PisoWiFi portal"]
  node_portal["PisoWiFi portal<br/>[main.rs]"]
  node_portal_ledger[("Revenue ledger<br/>[ledger.rs]")]
end

subgraph group_state["Payment and state"]
  node_payment_repo["Payment repository"]
  node_phone_db[("Phone database<br/>[AppDatabase.kt]")]
  node_session_rules["Session rules<br/>[SessionRules.kt]"]
end

subgraph group_admin["Kiosk control"]
  node_policy["Device policies"]
end

node_customer(("Customer"))
node_coin(("Coin input"))
node_router_customer(("Wi-Fi customer"))
node_router["OpenWrt router"]

node_coin -->|"pulses"| node_box_coin_slot
node_box_coin_slot -->|"queues payments"| node_box_queue
node_box_queue -->|"delivers payment"| node_esp_connection
node_esp_connection -->|"reports payment"| node_engine
node_engine -->|"credits payment"| node_payment_repo
node_payment_repo -.->|"persists receipts"| node_phone_db
node_engine -->|"checks session"| node_session_rules
node_engine -->|"coordinates overlay"| node_overlay
node_kiosk_service -->|"runs engine"| node_engine
node_kiosk_service -->|"joins network"| node_wifi_join
node_kiosk_service -->|"enforces kiosk"| node_policy
node_box_web -.->|"reads payments"| node_box_queue
node_box_config -.->|"configures slot"| node_box_coin_slot
node_router_customer -->|"opens coin page"| node_portal
node_portal -->|"grants Wi-Fi"| node_router
node_portal -.->|"records revenue"| node_portal_ledger
node_portal -.->|"requests coin status"| node_box_web

click node_kiosk_service "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/KioskService.kt"
click node_engine "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt"
click node_esp_connection "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/network/Esp32ConnectionManager.kt"
click node_wifi_join "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/network/KioskWifi.kt"
click node_payment_repo "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/repository/PaymentRepository.kt"
click node_phone_db "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/db/AppDatabase.kt"
click node_session_rules "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/service/SessionRules.kt"
click node_overlay "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/overlay/KioskOverlayCoordinator.kt"
click node_policy "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/security/KioskPolicyManager.kt"
click node_box_coin_slot "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/CoinSlotManager.cpp"
click node_box_queue "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/PaymentQueueManager.cpp"
click node_box_web "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/WebServerModule.cpp"
click node_box_config "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/Config.cpp"
click node_portal "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/tools/pisoportal/src/main.rs"
click node_portal_ledger "https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/tools/pisoportal/src/ledger.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_kiosk_service,node_engine,node_esp_connection,node_wifi_join,node_overlay toneBlue
class node_box_coin_slot,node_box_queue,node_box_web,node_box_config toneAmber
class node_portal,node_portal_ledger,node_router toneMint
class node_payment_repo,node_phone_db,node_session_rules toneRose
class node_policy,node_customer,node_coin,node_router_customer toneIndigo
```

## Components

### PisoPhone kiosk

- [Kiosk service](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/KioskService.kt): `app/src/main/java/com/pisophone/kiosk/KioskService.kt`
- [Kiosk engine](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt): `app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt`
- [Box connection](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/network/Esp32ConnectionManager.kt): `app/src/main/java/com/pisophone/kiosk/network/Esp32ConnectionManager.kt`
- [Kiosk Wi-Fi](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/network/KioskWifi.kt): `app/src/main/java/com/pisophone/kiosk/network/KioskWifi.kt`
- [Kiosk overlay](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/overlay/KioskOverlayCoordinator.kt): `app/src/main/java/com/pisophone/kiosk/overlay/KioskOverlayCoordinator.kt`

### Coin box firmware

- [Coin slot](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/CoinSlotManager.cpp): `esp32_firmware/src/CoinSlotManager.cpp`
- [Payment queue](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/PaymentQueueManager.cpp): `esp32_firmware/src/PaymentQueueManager.cpp`
- [Box dashboard API](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/WebServerModule.cpp): `esp32_firmware/src/WebServerModule.cpp`
- [Box configuration](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/esp32_firmware/src/Config.cpp): `esp32_firmware/src/Config.cpp`

### PisoWiFi portal

- [PisoWiFi portal](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/tools/pisoportal/src/main.rs): `tools/pisoportal/src/main.rs`
- [Revenue ledger](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/tools/pisoportal/src/ledger.rs): `tools/pisoportal/src/ledger.rs`

### Payment and state

- [Payment repository](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/repository/PaymentRepository.kt): `app/src/main/java/com/pisophone/kiosk/repository/PaymentRepository.kt`
- [Phone database](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/db/AppDatabase.kt): `app/src/main/java/com/pisophone/kiosk/db/AppDatabase.kt`
- [Session rules](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/service/SessionRules.kt): `app/src/main/java/com/pisophone/kiosk/service/SessionRules.kt`

### Kiosk control

- [Device policies](https://github.com/sheesh0327/pisophone-kiosk-launcher-v1/blob/main/app/src/main/java/com/pisophone/kiosk/security/KioskPolicyManager.kt): `app/src/main/java/com/pisophone/kiosk/security/KioskPolicyManager.kt`

### Other components

- **Customer**
- **Coin input**
- **Wi-Fi customer**
- **OpenWrt router**

## Connections

- Coin input → Coin slot: pulses (evidence: `README.md`)
- Coin slot → Payment queue: queues payments (evidence: `esp32_firmware/src/CoinSlotManager.cpp`)
- Payment queue → Box connection: delivers payment (evidence: `README.md`)
- Box connection → Kiosk engine: reports payment (evidence: `app/src/main/java/com/pisophone/kiosk/network/Esp32ConnectionManager.kt`)
- Kiosk engine → Payment repository: credits payment (evidence: `app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt`)
- Payment repository → Phone database: persists receipts
- Kiosk engine → Session rules: checks session (evidence: `app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt`)
- Kiosk engine → Kiosk overlay: coordinates overlay (evidence: `app/src/main/java/com/pisophone/kiosk/service/KioskEngine.kt`)
- Kiosk service → Kiosk engine: runs engine (evidence: `app/src/main/java/com/pisophone/kiosk/KioskService.kt`)
- Kiosk service → Kiosk Wi-Fi: joins network (evidence: `app/src/main/java/com/pisophone/kiosk/KioskService.kt`)
- Kiosk service → Device policies: enforces kiosk (evidence: `app/src/main/java/com/pisophone/kiosk/KioskService.kt`)
- Box dashboard API → Payment queue: reads payments
- Box configuration → Coin slot: configures slot
- Wi-Fi customer → PisoWiFi portal: opens coin page (evidence: `README.md`)
- PisoWiFi portal → OpenWrt router: grants Wi-Fi (evidence: `README.md`)
- PisoWiFi portal → Revenue ledger: records revenue (evidence: `tools/pisoportal/src/main.rs`)
- PisoWiFi portal → Box dashboard API: requests coin status
