# PON Go — Android

Native Android app for Ciena **MCMS 6.2 PON Manager** basics on the go — dashboard,
ONU and OLT browsing/diagnostics, firmware updates, resets. Kotlin + Jetpack
Compose + OkHttp. Sibling of the iOS app (`../mcms_ios`); the REST behaviour and
field paths are identical and documented in [`docs/MCMS_API.md`](docs/MCMS_API.md).

**Status: complete and building.** `./gradlew :app:assembleDebug` → `BUILD
SUCCESSFUL`, runs in the emulator. Package `no.svorka.mcms`, app name **PON Go**.

## Build & run

1. Open the folder in **Android Studio** → let it sync → Run on a device/emulator
   that can reach your MCMS host.
2. Or CLI: `./gradlew :app:assembleDebug` (needs `local.properties` with
   `sdk.dir=…`, and a JDK 17+ — Android Studio's bundled JBR works).

Verified toolchain on the dev machine: **AGP 8.11.0, Kotlin 2.0.21, Gradle 8.13,
compileSdk 36, minSdk 26, JBR 21**.

## What it does (feature parity with iOS)

- **Login / Settings** — HTTPS-only URL normalisation (`/api` auto-appended, `http`
  rejected), test-connection probe, remember-me (**email only** — passwords are never
  stored, Android Keystore), sign out.
- **Dashboard** — ONU/OLT/controller counts; total OLT traffic; a **Health**
  section (abnormal-Rx ONUs, laser-off OLTs) that drills into the affected
  devices; ONU-state breakdown; **Detailed stats** (opt-in Rx scan) and
  **Auto-refresh 30 s** toggles.
- **ONUs** — searchable list; detail with **Overview** (status, firmware +
  update picker, optical/FEC, UNI ports, traffic), **CPE** (DHCPv4/v6 leases),
  **Logs**, **Config** (raw JSON). Reset + firmware behind hardened,
  acknowledge-to-enable, red confirmations.
- **OLTs** — list with up/down summary; detail with status/uptime, PON traffic,
  environment, uplink (LLDP), registration buckets (→ ONU detail), reset.

## Layout

```
app/src/main/java/no/svorka/mcms/
  MainActivity.kt          root: state-based nav + bottom bar
  core/                    networking / models / repositories (≈ iOS core)
    Json, ApiConfiguration, ApiError, ApiQuery, McmsEndpoint, Util,
    Models, AuthModels, Firmware, Networking, ApiClient, Repositories,
    McmsConnection, KeychainStore
  ui/                      Jetpack Compose
    Theme, Types, Components, AppState,
    AuthScreens (Login+Settings), DashboardScreen (+drill-downs),
    OnuScreens (list+detail+firmware+reset), OltScreens (list+detail)
app/src/main/res/          adaptive launcher icon, strings (app_name), colors
docs/MCMS_API.md           the MCMS REST field guide (single source of truth)
```

See [`HANDOFF.md`](HANDOFF.md) for architecture notes, the build/verify loop, the
API gotchas, and what's deliberately trimmed vs iOS. Recent security/correctness
changes — and which of them to bring over to the iOS app — are in
[`CHANGELOG.md`](CHANGELOG.md).
