Skip to content

feat: mqtt#4841

Merged
jamesarich merged 22 commits intomainfrom
feat/mqtt
Mar 18, 2026
Merged

feat: mqtt#4841
jamesarich merged 22 commits intomainfrom
feat/mqtt

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

Replaces Android only paho mqtt dependency with KMQTT https://github.com/davidepianca98/KMQTT.

Wired up to Desktop and Android targets for use as client proxy.

@github-actions github-actions bot added the enhancement New feature or request label Mar 18, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 12.00000% with 66 lines in your changes missing coverage. Please review.
✅ Project coverage is 13.49%. Comparing base (1e9e838) to head (4275e8b).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...stic/core/network/repository/MQTTRepositoryImpl.kt 0.00% 65 Missing ⚠️
...otlin/org/meshtastic/core/model/MqttJsonPayload.kt 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4841      +/-   ##
==========================================
+ Coverage   13.44%   13.49%   +0.04%     
==========================================
  Files         542      543       +1     
  Lines       17822    17842      +20     
  Branches     2667     2666       -1     
==========================================
+ Hits         2396     2407      +11     
- Misses      15104    15112       +8     
- Partials      322      323       +1     
Flag Coverage Δ
host-unit 13.49% <12.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit refactors `MQTTRepositoryImpl` to improve error handling and code formatting. It replaces generic `Exception` catches with specific MQTT, IO, and Serialization exceptions, ensuring better diagnostic logging and lifecycle management of the client loop.

Specific changes include:
- **Error Handling**: Updated `MQTTRepositoryImpl` to catch specific exceptions (`MQTTException`, `IOException`, `SerializationException`) instead of a generic `Exception` block.
- **Client Logic**:
    - Improved address parsing to dynamically select the default port (8883 for TLS, 1883 otherwise).
    - Added explicit handling for `CancellationException` in the MQTT client loop.
- **Code Style & Formatting**:
    - Applied consistent formatting across `MQTTRepositoryImpl.kt`, `MQTTRepositoryImplTest.kt`, and `MqttJsonPayload.kt`.
    - Removed the unused `DEFAULT_QOS` constant.
    - Simplified subscription logic and address parsing expressions for readability.
- **Testing**: Updated test files to match new formatting standards while maintaining coverage for address parsing and JSON payload serialization.
@jamesarich jamesarich added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit d314ee2 Mar 18, 2026
7 checks passed
@jamesarich jamesarich deleted the feat/mqtt branch March 18, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant