feat: Phase 28.1.2 — dual-network binding + OkHttp clients
- NetworkBinder: discovers Pi hotspot WiFi (no-internet) and cellular networks via ConnectivityManager, creates per-network socket-bound OkHttpClients - DualNetworkTestScreen: real OkHttp calls to 10.42.0.1/api/gps/status and yaris.ceaf.dev/health, simultaneous "Test Both" gate button - MainActivity: discovers networks at startup, passes bound clients to screen - Retrofit interfaces (PiApi, ServerApi) + DTOs (GpsStatus, HealthResponse) - Uncommented OkHttp/Retrofit/kotlinx-serialization deps in build.gradle.kts
This commit is contained in:
+13
-16
@@ -76,29 +76,26 @@ android/
|
||||
- [x] Create Android project in `android/` via Android Studio (Empty Activity + Compose)
|
||||
- [x] Kotlin DSL build files with version catalog
|
||||
- [x] `.gitignore` for Android (`*.iml`, `.gradle/`, `build/`, `local.properties`, `.idea/`)
|
||||
- [ ] Verify project builds and runs on emulator (blank screen)
|
||||
- [ ] Commit: `init: android project scaffold`
|
||||
- [x] Create Android project in `android/` via Android Studio (Empty Activity + Compose)
|
||||
- [x] Kotlin DSL build files with version catalog
|
||||
- [x] `.gitignore` for Android (`*.iml`, `.gradle/`, `build/`, `local.properties`, `.idea/`)
|
||||
- [ ] Verify project builds and runs on emulator (needs Android Studio)
|
||||
- [x] Commit: `f1c83a2` init: android project scaffold
|
||||
|
||||
#### 28.1.2 — Networking layer
|
||||
- [ ] Add dependencies: OkHttp 4.x, Retrofit 2.x, Kotlinx Serialization (or Moshi)
|
||||
- [ ] Create `NetworkBinder.kt` — utility class that:
|
||||
- On startup, discovers available `Network` objects via `ConnectivityManager`
|
||||
- Identifies the WiFi network matching `10.42.0.0/24` (Pi hotspot subnet)
|
||||
- Identifies the cellular network (`TRANSPORT_CELLULAR`)
|
||||
- Exposes `bindToWifi(): OkHttpClient` and `bindToCellular(): OkHttpClient` factories
|
||||
- Falls back gracefully if one network is unavailable
|
||||
- [ ] Create Retrofit service interfaces:
|
||||
- `PiApi.kt` — endpoints on `http://10.42.0.1` (or dynamically resolved)
|
||||
- `ServerApi.kt` — endpoints on `https://yaris.ceaf.dev`
|
||||
- [ ] Wire up a manual test screen with two buttons + status text:
|
||||
- "Test Pi" → calls `/api/gps/status` on WiFi-bound client, shows response
|
||||
- "Test Server" → calls `/health` on cellular-bound client, shows response
|
||||
- [x] Add dependencies: OkHttp 4.12, Retrofit 2.11, Kotlinx Serialization 1.7.3
|
||||
- [x] Create `NetworkBinder.kt` — discovers WiFi (Pi hotspot, no-internet) + cellular networks
|
||||
via `ConnectivityManager`, creates socket-bound `OkHttpClient` per network
|
||||
- [x] Create Retrofit service interfaces (`PiApi.kt`, `ServerApi.kt`) with placeholder endpoints
|
||||
- [x] Create DTOs: `GpsStatus`, `HealthResponse`
|
||||
- [x] Wire `DualNetworkTestScreen.kt` with real OkHttp calls + simultaneous "Test Both" button
|
||||
- [x] Wire `MainActivity.kt` to discover networks at startup and pass bound clients to screen
|
||||
- [ ] **Real-device gate test:**
|
||||
- Connect phone to Pi hotspot ("yaris 911")
|
||||
- Verify cellular data is still active (browse any website while on hotspot)
|
||||
- Press "Test Pi" → should return GPS status JSON
|
||||
- Press "Test Server" → should return `{"status":"ok"}`
|
||||
- Press both rapidly → both should succeed
|
||||
- Press "Test Both" → both should succeed simultaneously
|
||||
- If either fails: investigate `bindProcessToNetwork()` behavior on this Pixel/Android version
|
||||
- [ ] Commit: `feat: dual-network proof-of-concept`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user