feat(ble): Add support for FromRadioSync characteristic#4584
Closed
jamesarich wants to merge 5 commits intomainfrom
Closed
feat(ble): Add support for FromRadioSync characteristic#4584jamesarich wants to merge 5 commits intomainfrom
jamesarich wants to merge 5 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #4584 +/- ##
=========================================
- Coverage 15.43% 7.99% -7.45%
=========================================
Files 426 345 -81
Lines 14855 10938 -3917
Branches 2472 1768 -704
=========================================
- Hits 2293 874 -1419
+ Misses 12242 9914 -2328
+ Partials 320 150 -170 ☔ View full report in Codecov by Sentry. |
This commit introduces support for the new `FromRadioSync` Bluetooth LE characteristic. This characteristic provides a way for the radio to send packets directly to the app, similar to the existing `FromRadio` characteristic, but using notifications for immediate delivery. Specific changes include: - Added the `BTM_FROMRADIOSYNC_CHARACTER` UUID. - Discovered and subscribed to the `FromRadioSync` characteristic upon connection. - Handled incoming notifications from this characteristic by dispatching the received data directly as a radio packet. - Added a new unit test to verify that notifications from the `FromRadioSync` characteristic are correctly received and processed. Signed-off-by: James Rich <[email protected]>
This commit prevents a redundant subscription to `fromNumCharacteristic` when `fromRadioSyncCharacteristic` is also present. The subscription to `fromNumCharacteristic` is now skipped on devices that support the newer `fromRadioSyncCharacteristic`, avoiding duplicate notifications and potential race conditions. Signed-off-by: James Rich <[email protected]>
Signed-off-by: James Rich <[email protected]>
Signed-off-by: James Rich <[email protected]>
503387a to
16f5b85
Compare
This commit addresses a race condition in the BLE OTA tests and improves resource handling in the transport layer. The `BleOtaTransport` now explicitly closes its `responseChannel` upon disconnection. This prevents potential resource leaks and ensures that downstream consumers are properly notified when the transport is closed. The BLE OTA tests have been made more robust by adding a check to ensure the peripheral is still connected (`otaPeripheral.isConnected`) before attempting to simulate a value update. This prevents tests from hanging or throwing exceptions due to race conditions where a response is simulated after the connection has already been terminated. Signed-off-by: James Rich <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for a new BLE characteristic,
BTM_FROMRADIOSYNC_CHARACTER, to the radio interface, enabling direct packet delivery via notifications. The implementation includes updates to characteristic discovery, notification setup, logging, and test coverage to ensure correct handling of the new characteristic.Addition of new BLE characteristic support:
BTM_FROMRADIOSYNC_CHARACTERconstant inBleConstantsand added corresponding memberfromRadioSyncCharacteristicinNordicBleInterfaceto handle the new characteristic. [1] [2] [3]fromRadioSyncCharacteristicduring initialization.Notification handling and logging enhancements:
setupNotificationsto subscribe tofromRadioSyncCharacteristicand dispatch packets directly upon receiving notifications. Added logging to indicate subscription and packet dispatch events. [1] [2] [3]Resource management improvements:
fromRadioSyncCharacteristicis properly cleared during interface closure to prevent resource leaks.Testing:
fromRadioSyncCharacteristiccorrectly deliver packets to the service's handler.Firmware implementation PR here: meshtastic/firmware#9675