Chapter 7: Offline P2P Mesh & Role System¶
In disaster response, civilian telecommunication infrastructure frequently collapses: cell towers fail and internet access is cut off. The Stromnetz Pro requires neither internet nor a Wi-Fi router to synchronize devices in the field.
📡 Decentralized Mesh Network Without Infrastructure¶
The app relies on a fully self-contained peer-to-peer mesh (P2P):
- Technology: Google Nearby Connections uses Bluetooth Low Energy (BLE) for fast discovery of neighboring devices and Wi-Fi Direct for broadband, low-latency data transfer.
- No Router or Cellular Network Required: Smartphones and tablets form a direct, encrypted point-to-multipoint radio mesh ad-hoc.
- Encryption: Every data channel is end-to-end encrypted with AES-256, based on Elliptic Curve Diffie-Hellman (ECDH) key exchange.
🤝 Connection Flow & Server Discovery (DiscoveredServer)¶
Instead of connecting indiscriminately, the app provides a structured pairing workflow:
- Start Host Server (Command Device):
- Under Settings → Connectivity, toggle “Enable Sync Server”.
- The device advertises its readiness with mission keyword and host role (ADMIN).
- Server Discovery List (
DiscoveredServer): - Client devices open a server selection list.
- Operators see all active mission servers in radio range, including Mission Keyword, Device Name, and Signal Strength.
- Tapping connects to the desired mission network.
- 4-Digit Pairing Token & Verification (
PairingDialog): - To prevent man-in-the-middle attacks, both devices simultaneously display a 4-digit confirmation token (e.g.
4829). - Access is granted only when the administrator actively confirms the pairing request.
👥 Role & Permission Concept¶
To prevent accidental or unauthorized edits to critical power systems, the app supports three roles:
| Role | Permissions | Typical Field Function |
|---|---|---|
| ADMIN (Administrator) | Full read and write access. Can adjust topology, approve load requests, and block devices. | Incident commander, group leader |
| OPERATOR | Can record refueling, update operating hours, and submit load change requests. | Generator operator / machinist |
| MONITOR (Read-Only) | View dashboard, tactical map, and live metrics in real time without control permissions. | Observer, assistant staff |
🛡️ Remote Control & Approval Policies¶
In Settings, the administrator defines how operator requests are processed:
- Manual Approval:
- Every load change or cable re-plug request generates a pop-up in the approval queue (
PendingRequestCard) for explicit commander sign-off. - Safe Auto-Approve (Recommended Default):
- Non-critical actions (e.g. switching small lights or tools) are approved automatically.
- Safety-critical actions (e.g. starting/stopping generators, reconnecting main feeder branches, actions risking unbalance or overload) strictly require manual commander approval.
- Full Remote Control:
- All authorized operators can commit changes directly to the grid model without prompt.
🔄 Conflict Resolution in Offline Mesh (LWW)¶
If an operator temporarily loses radio contact (e.g. working in basements), the app continues seamlessly locally:
- Last-Write-Wins (LWW): Upon reconnection, changes merge automatically based on synchronized timestamps (
lastModified) and cryptographic checksums at field level. - Zero Data Loss: If Operator A updates generator fuel levels and Leader B updates distributor wiring, both edits merge without conflicts.