mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-10-22 14:01:24 +00:00
fix(ble): enable NimBLE scan response so service UUID + name fit; add T:BLE hook
Two related changes: 1. NimBLE advertising overflow At boot pyxis was logging "NimBLEAdvertisementData: Data length exceeded" twice. The 128-bit Reticulum service UUID is 18 bytes once you include the AD type+length headers; the device name "TD-XXXXXX" is another 9-11 bytes; flags eat 3 bytes. That's already over the 31-byte legacy adv-packet limit, so NimBLE was silently truncating the advertisement and dropping the service UUID. Android Columba's BleScanner filters by ServiceUuid at the Android BLE driver layer (ScanFilter.Builder().setServiceUuid), so without the UUID in the primary adv data, pyxis was invisible to Columba. Fix: call enableScanResponse(true) BEFORE addServiceUUID + setName. NimBLE then routes the long device name into the secondary 31-byte scan-response payload that active scanners request, leaving the primary adv data with just flags + the service UUID — under budget and visible to the filter. Verified: with the fix, Android system Bluetooth reads pyxis's name as "TD-46cbcf" and Columba's BleGattServer logs "Central connected: FC:69:15:9C:B2:C9" (pyxis as central). The connection holds for ~40s before HCI_CONN_TIMEOUT — separate issue not addressed here, just the unblock so the link can be established at all. 2. T:BLE on|off harness hook Mirrors T:CALL_PROFILE / T:ANNLXST / T:LXSTDEST: persists the ble_en NVS key and starts/stops the interface live so the LXMF harness can flip BLE on/off the same way it drives any other subsystem. Idempotent for "already on" / "already off". Useful for upcoming pyxis ↔ Android Columba BLE smoke tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2504fefa66
commit
cbac8ed5ca
2 files changed
+59
-1
No files matched your search
@@ -2506,8 +2506,18 @@ bool NimBLEPlatform::setupAdvertising() {
|
||||
_advertising_obj->setMinInterval(_config.adv_interval_min_ms * 1000 / 625); // Convert to 0.625ms units
|
||||
_advertising_obj->setMaxInterval(_config.adv_interval_max_ms * 1000 / 625);
|
||||
|
||||
// Enable scan-response payload BEFORE addServiceUUID + setName so the
|
||||
// 128-bit service UUID (18 bytes once you include the AD type+length
|
||||
// headers) and the device name (~9-11 bytes once you include its
|
||||
// header) don't both fight for the 31-byte legacy adv packet. With
|
||||
// scan-response on, NimBLE places the long name in the secondary 31
|
||||
// bytes returned to active scanners. Without this, NimBLE was logging
|
||||
// "NimBLEAdvertisementData: Data length exceeded" twice at startup
|
||||
// and emitting truncated advertising data — Android Columba's
|
||||
// BleScanner never saw pyxis's service UUID.
|
||||
_advertising_obj->enableScanResponse(true);
|
||||
|
||||
// NimBLE 2.x: Use addServiceUUID to include service in advertising packet
|
||||
// The name goes in scan response automatically when enableScanResponse is used
|
||||
_advertising_obj->addServiceUUID(NimBLEUUID(UUID::SERVICE));
|
||||
_advertising_obj->setName(_config.device_name);
|
||||
|
||||
|
||||
Reference in new issue
Block a user