mirror of
https://github.com/pe1hvh/meshcore-gui.git
synced 2026-11-03 11:02:30 +01:00
WHAT - route_page: _default_reply_channel() derives the reply select default from msg.channel instead of the first entry in the channel list - models: new Message.date field, now_date() and display_timestamp(); format_line() and incoming()/outgoing() use them - message_archive: persist "date" alongside "time" and "timestamp_utc" - room_server_panel + route_page info header use display_timestamp() - VERSION 1.22.2 -> 1.22.3 WHY The route page exists to show one specific message, so that message — not the ordering of the channel list — is the correct source for the reply default. The date could not be fixed at the render site because Message had no date at all: now_timestamp() yields HH:MM:SS and the date lived only as timestamp_utc inside the archive layer, unread by from_dict(). A first-class field plus a single formatting helper fixes the cause and keeps the format in one place. NOTES No breaking changes. The archive schema gains one additive field; pre-1.22.3 entries have their date derived from timestamp_utc (converted to local time) and fall back to time-only when absent. Message.incoming() gained an optional keyword-only date parameter. Message display lines are ~11 characters wider.
60 lines
2.3 KiB
Markdown
60 lines
2.3 KiB
Markdown
# v5.5 Integration Guide — Subprocess BLE Connection
|
|
|
|
## Overzicht
|
|
|
|
Deze wijziging lost het BlueZ 5.82 probleem op door `meshcore-ble-connect`
|
|
als **persistent subprocess** te draaien dat de D-Bus/BLE connectie openhoudt,
|
|
terwijl `BleakClient` er alleen GATT service discovery overheen doet.
|
|
|
|
De architectuur, de flow en de risico-mitigatie staan in
|
|
**`docs/adr/ADR-003-subprocess-ble-connect.md`**. Dit document bevat alleen
|
|
de installatie- en delivery-stappen.
|
|
|
|
---
|
|
|
|
## Gewijzigde bestanden
|
|
|
|
### meshcore-ble-connect (5 bestanden)
|
|
|
|
| Bestand | Wijziging |
|
|
|---|---|
|
|
| `constants.py` | Versie → 1.1.0. Nieuwe constanten: `SERVICES_RESOLVED_TIMEOUT`, `DISCONNECT_POLL_INTERVAL`. Nieuwe exit codes: `CONNECT_FAILED` (5), `DISCONNECTED` (6). |
|
|
| `exceptions.py` | Nieuwe exception: `ConnectHoldError`. |
|
|
| `__main__.py` | Nieuw `--connect` flag. Mutual exclusion met `--check-only`. Doorgifte `connect_hold=` aan `BleConnectApp`. |
|
|
| `app.py` | Nieuw `connect_hold` parameter. Na bond OK → `_enter_connect_hold()` → `device.connect_and_hold()`. Werkt bij zowel bestaande bond als verse pairing. |
|
|
| `device.py` | Nieuwe methoden: `connect_and_hold()`, `is_connected()`, `is_services_resolved()`, `_wait_for_services_resolved()`, `_monitor_connection()`. Signal handling (SIGTERM/SIGINT) voor clean shutdown. |
|
|
|
|
### meshcore-gui (1 bestand)
|
|
|
|
| Bestand | Wijziging |
|
|
|---|---|
|
|
| `worker.py` | Nieuwe methoden: `_connect_via_subprocess()`, `_kill_connect_subprocess()`. Gewijzigd: `_connect()` gebruikt subprocess als primary path wanneer `_use_ble_connect=True`. Subprocess health check in main loop. Cleanup in finally block. |
|
|
|
|
---
|
|
|
|
## Installatie
|
|
|
|
```bash
|
|
# 1. Update meshcore-ble-connect
|
|
cd ~/meshcore-ble-connect
|
|
# Vervang de 5 gewijzigde bestanden in meshcore_ble_connect/
|
|
pip install -e . --break-system-packages
|
|
|
|
# 2. Test --connect mode standalone
|
|
meshcore-ble-connect FF:05:D6:71:83:8D --pin 123456 --connect --verbose
|
|
# Verwacht: READY op stdout, proces blijft draaien
|
|
# Ctrl+C om te stoppen
|
|
|
|
# 3. Update worker.py
|
|
cp worker.py ~/meshcore-gui/meshcore_gui/ble/worker.py
|
|
|
|
# 4. Start meshcore-gui
|
|
cd ~/meshcore-gui && python -m meshcore_gui
|
|
```
|
|
|
|
## Fallback gedrag
|
|
|
|
Als het subprocess faalt (bijv. op BlueZ < 5.78 waar het niet nodig is),
|
|
valt `_connect()` automatisch terug op de directe `MeshCore.create_ble(address)`
|
|
aanroep. Dit garandeert backwards compatibility.
|