Skip to content

core: deprecate old MAVLink interception API and MavlinkPassthrough for v4#2917

Open
bansiesta wants to merge 26 commits into
mainfrom
bansiesta/deprecate-old-mavlink-intercept-api
Open

core: deprecate old MAVLink interception API and MavlinkPassthrough for v4#2917
bansiesta wants to merge 26 commits into
mainfrom
bansiesta/deprecate-old-mavlink-intercept-api

Conversation

@bansiesta

Copy link
Copy Markdown
Collaborator

Marks the old MAVLink APIs as deprecated ahead of v4:

  • Mavsdk::intercept_incoming_messages_async() — use subscribe_incoming_messages_json() instead
  • Mavsdk::intercept_outgoing_messages_async() — use subscribe_outgoing_messages_json() instead
  • MavlinkPassthrough class — use MavlinkDirect instead

The JSON-based replacements were added in #2638, which stated the old API would be replaced "by the next major release". MavlinkPassthrough already had a docstring warning; this adds the machine-readable [[deprecated]] attribute so compilers emit warnings at call sites.

julianoes
julianoes previously approved these changes Jul 12, 2026
bansiesta and others added 23 commits July 13, 2026 13:45
… plugins respect drops

Plugins like FTP and Telemetry register handlers via register_mavlink_message_handler
(old path) and are dispatched in process_message, not process_libmav_message.
The JSON interception callbacks were only checked in process_libmav_message, so
returning false from subscribe_incoming_messages_json had no effect on those plugins.

Move the JSON intercept check into process_message (after _mutex is released,
before plugin dispatch), using the same mavlink_message_t → Mavsdk::MavlinkMessage
conversion pattern already used in deliver_message for outgoing intercept.

Remove the check from process_libmav_message to avoid invoking each callback twice
for the same physical packet (dual-parser architecture calls both paths per datagram).

This fixes:
- Intercept.IncomingDrop: GLOBAL_POSITION_INT now blocked before Telemetry sees it
- Ftp.DownloadBurstStopAndTryAgain / DownloadStopAndTryAgain / UploadStopAndTryAgain:
  FTP plugin now sees the drop and the first transfer times out as expected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- mavsdk_impl.cpp: clang-format style fixes (collapse multi-line conditions to single lines)
- docs: regenerate MavlinkPassthrough and Mavsdk API docs to reflect deprecation markers and new JSON subscription methods
- examples/CMakeLists.txt: allow -Wno-error=deprecated-declarations so examples that intentionally demonstrate deprecated APIs still build under -Werror

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bansiesta bansiesta force-pushed the bansiesta/deprecate-old-mavlink-intercept-api branch from 0df6f6a to 76bb3b4 Compare July 13, 2026 01:46
bansiesta and others added 3 commits July 14, 2026 10:08
The JSON intercept must fire before forward_message() so that a dropped
message is neither forwarded to connected peers nor delivered to local
plugins. Moving it inside the _mutex block (after the legacy
intercept_incoming_messages_async check, before forward_message) fixes
the Intercept.IncomingDrop system test which was seeing the forwarded
packet land on the receiver even after the interceptor dropped it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…cessing

Intercept semantics: messages are still forwarded to connected peers as
a raw relay; the subscribe_incoming_messages_json callback only controls
whether local plugins (Telemetry, FTP, etc.) receive the message.

Update Intercept.IncomingDrop test to match: only assert that the
interceptor's own Telemetry plugin does NOT receive the dropped message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants