Echo is a Flutter prototype for receiving, storing, and relaying emergency alerts between nearby devices over Bluetooth Low Energy when an internet connection is unavailable.
Status: prototype. The repository implements NWS ingestion, local persistence, a BLE GATT client and server, native translation, and two Python relay utilities. The included Python unit tests pass, but the repository does not contain a recorded end-to-end hardware test. Automatic background relay is also limited by the advertisement metadata mismatch described under Current limitations.
These screenshots are from the app in this repository. They demonstrate the implemented interface, local alert display, translation selection, and text-to-speech controls. They are not evidence of a multi-device BLE test.
- A Flutter device acts as both a BLE central and peripheral. Dart handles scanning and transfer orchestration while Kotlin and Swift expose native GATT servers through platform channels.
- Alert JSON is transferred through a custom indexed chunk protocol. The Flutter sender uses gzip; the receiver accepts either gzip or raw UTF-8 JSON so it can also read the Python senders.
- A background Flutter service uses IPC to ask the main Flutter engine to restart advertising. This avoids calling a platform channel from the background engine where it is not registered.
- Alerts are parsed from the public National Weather Service GeoJSON feed, filtered by severity, and stored in SQLite.
- The detail view supports native text-to-speech and on-device translation into 22 target languages after the required language model is available.
- The Raspberry Pi package has 9 unit tests covering its alert model, metadata packing, and chunk framing. On this checkout, all 9 pass.
flowchart LR
NWS["NWS active-alert GeoJSON"] --> A["Echo device with internet"]
OP["Operator-created alert"] --> P["Python relay"]
A --> DB1[("SQLite")]
A -->|"BLE advertisement + GATT reads"| B["Nearby Echo device"]
P -->|"BLE advertisement + GATT reads"| B
B --> DB2[("SQLite")]
B -.-> C["Next Echo device (intended relay)"]
- Echo fetches active alerts from
api.weather.gov, or a Python utility creates an operator-supplied alert. - A relay advertises the Echo service UUID and exposes two GATT characteristics: one selects a chunk index and one returns that chunk.
- A receiving app scans for the service, connects, reconstructs the payload, increments
hopCount, and stores the alert. - The app restarts its GATT server with the received alert, which provides the intended next-hop path.
The direct foreground receive and re-advertise paths are implemented. Continuous background propagation has not been demonstrated in this repository and currently encounters the metadata compatibility issue documented below. See docs/protocol.md for the exact wire format and compatibility matrix.
| Area | Implementation |
|---|---|
| Mobile app | Flutter, Dart, Material 3 |
| Android BLE and translation | Kotlin, BluetoothGattServer, BluetoothLeAdvertiser, ML Kit Translation |
| iOS BLE and translation | Swift, CoreBluetooth, Apple Translation framework |
| Persistence | SQLite through sqflite |
| Alert source | National Weather Service active-alert GeoJSON API |
| Raspberry Pi relay | Python 3.10+, BlueZ D-Bus through dbus-next |
| Desktop relay | Python 3.10+, bless for macOS and Windows |
Prerequisites:
- Flutter with a Dart SDK in the package's
>=3.6.2 <4.0.0range - Android: JDK 17, Android SDK 36, and a device running API 26 or newer
- iOS: macOS, Xcode with the iOS 18 SDK, CocoaPods, and a device running iOS 18 or newer
- A physical device for BLE advertising and transfer tests
git clone https://github.com/aadityad12/Echo.git
cd Echo
flutter pub get
flutter analyze
flutter test
flutter runAfter launch, grant the requested Bluetooth permissions. Open Settings and choose Load Demo Alerts to exercise the local database and UI without a network or second device. Choose Download NWS Alerts to fetch the current active-alert feed.
The generated JSON adapter is committed. Regenerate it only after changing lib/data/alert_packet.dart:
dart run build_runner build --delete-conflicting-outputsThis path requires Linux, BlueZ, a BLE adapter that supports peripheral mode, and permission to register GATT services and advertisements on the system bus.
cd pi_sender
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
python -m pytest -qCreate and publish an alert:
beconnect-pi alert new \
--headline "Test weather alert" \
--severity Severe \
--expires 1893456000 \
--instructions "Move indoors and monitor official guidance." \
--source-url "local://operator" \
--verified false
beconnect-pi alert list
beconnect-pi publish <alert_id>
beconnect-pi broadcast start --foregroundSee pi_sender/README.md for BlueZ setup, background operation, state files, and the optional Streamlit UI.
cd beacon_cli
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -e .
beacon --helpSee beacon_cli/README.md for the command workflow and current interoperability limits.
Echo does not require an API key. The app calls the public NWS active-alert GeoJSON endpoint. A state filter can be selected in Settings and is saved in SharedPreferences.
| Component | Configuration |
|---|---|
| Flutter app | No environment variables or secret files |
| Pi CLI | --state-dir, default ~/.beconnect-pi |
| Pi Streamlit UI | Optional BECONNECT_PI_STATE_DIR |
| Desktop CLI | --state-dir, default ~/.beacon-cli |
The verified field is payload metadata, not a digital signature. The Flutter NWS parser sets it to true; Python operators can also set it explicitly. Consumers must not treat it as cryptographic proof of origin.
The following checks were run against this checkout:
| Check | Result | Scope |
|---|---|---|
python -m pytest -q pi_sender/tests |
9 passed | Pi model validation, ID generation, chunk encode/decode, and advertisement metadata packing |
Editable install of pi_sender |
Passed | Package build, dependency installation, CLI create/list/publish/status workflow |
Editable install of beacon_cli |
Passed | Package build, dependency installation, CLI help and local state workflow |
| Python bytecode compilation | Passed | Both Python packages and the Streamlit entry point |
flutter analyze and flutter test |
Not run | Flutter is not installed in the verification environment |
| Android/iOS build | Not run | Requires the Flutter toolchain and platform SDK setup |
| BLE transfer on physical devices | Not run | Requires compatible BLE hardware and multiple devices |
There are no latency, range, delivery-rate, or power measurements in the repository. No production performance claim is made.
- Indexed reads instead of notifications: the receiver writes a two-byte chunk index and reads the requested frame. This is simple to implement across Android, iOS, BlueZ, and
bless, but each chunk costs a write/read round trip. - Main-engine GATT ownership: native advertising stays in the main Flutter engine. The background service emits IPC events instead of using an unavailable platform channel.
- Compact local IDs: NWS alerts are assigned the first eight hexadecimal characters of SHA-1 over
headline + expires. This supports compact deduplication but is neither collision-resistant at this length nor an authenticity mechanism. - Bounded local storage: every insert prunes the database to the 20 most recent
fetchedAtvalues. Pinned alerts sort first in the UI, but the current prune query does not exempt them. - Model-backed translation: translations run on device, but a language model may need to be downloaded before offline use.
- Automatic background relay does not currently have a consistent alert identifier in BLE advertisements. Android app advertisements include only severity, iOS and
beacon_cliinclude no manufacturer metadata, andpi_senderencodes a Java hash rather than the app's eight-character alert ID. Foreground scanning can still attempt a GATT download, but the background loop and deduplication behavior are not interoperable as written. - The Pi sender's severity-byte order is the reverse of the Flutter mapping for most values. This affects advertisement previews, not the severity inside the downloaded JSON.
sentAtis parsed from NWS data, but the GATT client does not copy it when constructing a relayed packet.- The app has one Flutter widget smoke test and no committed Dart unit tests for chunking, parsing, persistence, or background coordination.
- No automated hardware, integration, or multi-hop test is included.
- BLE peripheral support varies by adapter and operating system. Simulators and emulators cannot validate the transfer path.
- The repository tracks generated iOS build cache files and Python
.egg-infodirectories. They are not required source files. - There is no CI configuration, release artifact, deployment configuration, or published deployment in this repository.
lib/ Flutter app, BLE orchestration, storage, and UI
android/ Android GATT server, advertising, and ML Kit bridge
ios/ iOS GATT server, advertising, and Translation bridge
pi_sender/ BlueZ relay CLI, Streamlit UI, and Python tests
beacon_cli/ macOS and Windows relay CLI built on bless
assets/sample/ Screenshots shown above
test/ Flutter widget smoke test
docs/protocol.md Wire format and current compatibility matrix
Git history records contributions from aadityad12, shahxsheel, and Mr-Shine09.
No license file is currently included. Unless a license is added, the repository does not grant general permission to copy, modify, or redistribute the code.


