Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_files: add blocking download_file; add erase log file function #1649

Merged
merged 7 commits into from
Apr 13, 2022

Conversation

dayjaby
Copy link
Contributor

@dayjaby dayjaby commented Dec 9, 2021

This PR adds two new functions to the log_files plugin:

  • a blocking download_file
  • an erase function

Note, that for the erase function, LOG_ERASE is being used. This mavlink message does not prescribe any feedback. To check whether the logs got really deleted, you can verify with get_entries.

Running the example looks like:

./MAVSDK/examples/logfile_download$ cmake -Bbuild -H. && cmake --build build -j4 && ./build/logfile_download udp://:14540
-- Configuring done
-- Generating done
-- Build files have been written to: ./MAVSDK/examples/logfile_download/build
[100%] Built target logfile_download
[01:09:06|Info ] MAVSDK version: v0.50.1 (mavsdk_impl.cpp:28)
Waiting to discover system...
[01:09:06|Info ] New system on: 127.0.0.1:58354 (with sysid: 1) (udp_connection.cpp:194)
[01:09:06|Debug] New: System ID: 1 Comp ID: 1 (mavsdk_impl.cpp:484)
[01:09:06|Debug] Component Autopilot (1) added. (system_impl.cpp:361)
[01:09:06|Debug] Component Unsupported component (240) added. (system_impl.cpp:361)
[01:09:07|Debug] Discovered 2 component(s) (system_impl.cpp:529)
[01:09:07|Debug] Received all entries (log_files_impl.cpp:169)
Got log file with ID 0 and date 2021-12-08T16:28:48Z
[01:09:07|Debug] 46080 B of 353765 B (320.16 kiB/s) (log_files_impl.cpp:418)
[01:09:07|Debug] 92160 B of 353765 B (237.55 kiB/s) (log_files_impl.cpp:418)
[01:09:07|Debug] 138240 B of 353765 B (333.791 kiB/s) (log_files_impl.cpp:418)
[01:09:08|Debug] 184320 B of 353765 B (328.368 kiB/s) (log_files_impl.cpp:418)
[01:09:08|Debug] 230400 B of 353765 B (326.467 kiB/s) (log_files_impl.cpp:418)
[01:09:08|Debug] 276480 B of 353765 B (319.142 kiB/s) (log_files_impl.cpp:418)
[01:09:08|Debug] 322560 B of 353765 B (317.143 kiB/s) (log_files_impl.cpp:418)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Error] Ignoring wrong offset (log_files_impl.cpp:359)
[01:09:08|Debug] 353765 B of 353765 B (306.913 kiB/s) (log_files_impl.cpp:418)

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @dayjaby!

src/plugins/log_files/log_files_impl.cpp Outdated Show resolved Hide resolved
@dayjaby
Copy link
Contributor Author

dayjaby commented Dec 10, 2021

@julianoes thanks for the review! One more question: should this erase log files be a "fire and forget"-function, like in native MAVLink...or does it make sense to call get_entries after a short amount of time and check whether they got deleted or not? And provide some feedback with either LogFiles::Success or LogFiles::Failure?

@julianoes
Copy link
Collaborator

Yer, that's the question. I'm not sure, mostly because the list function takes quite a bit of time. You could add a comment that says "if you want to be sure the log has been deleted, you have to list it again and check".

@julianoes
Copy link
Collaborator

julianoes commented Jan 14, 2022

@dayjaby I think this would still be worthwhile. @dayjaby would you mind fixing the conflicts and adding the comment about the fact that that you need to check the logfiles again after deleting to make sure it worked.

@julianoes julianoes force-pushed the log_files_improvements branch from 5b7556f to f73c11c Compare April 13, 2022 05:30
@julianoes
Copy link
Collaborator

@dayjaby I've rebased this, fixed it up, and force pushed it. Let's hope it's now mergeable.

@julianoes
Copy link
Collaborator

CI failure probably unrelated.

@julianoes julianoes merged commit 9b1034f into mavlink:main Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants