replay: use module base class & add module documentation

This commit is contained in:
Beat Küng
2017-07-14 11:57:11 +02:00
parent 674ae5292e
commit 682dabded1
2 changed files with 142 additions and 179 deletions
+23 -15
View File
@@ -41,6 +41,7 @@
#include "definitions.hpp"
#include <px4_module.h>
#include <uORB/uORBTopics.h>
#include <uORB/topics/ekf2_timestamps.h>
@@ -54,26 +55,34 @@ namespace px4
* to replay. This is necessary because data messages from different subscriptions don't need to be in
* monotonic increasing order.
*/
class Replay
class Replay : public ModuleBase<Replay>
{
public:
Replay();
Replay() {}
/// Destructor, also waits for task exit
virtual ~Replay();
virtual ~Replay() {}
/** @see ModuleBase */
static int task_spawn(int argc, char *argv[]);
/** @see ModuleBase */
static Replay *instantiate(int argc, char *argv[]);
/** @see ModuleBase */
static int custom_command(int argc, char *argv[]);
/** @see ModuleBase */
static int print_usage(const char *reason = nullptr);
/** @see ModuleBase::run() */
void run() override;
/**
* Start task.
* @param quiet silently fail if no log file found
* @param apply_params_only if true, only apply parameters from definitions section of the file
* and user-overridden parameters, then exit w/o replaying.
* @return OK on success.
* Apply the parameters from the log
* @param quiet do not print an error if true and no log file given via ENV
* @return 0 on success
*/
static int start(bool quiet, bool apply_params_only);
static void task_main_trampoline(int argc, char *argv[]);
void task_main();
static int applyParams(bool quiet);
/**
* Tell the replay module that we want to use replay mode.
@@ -158,7 +167,6 @@ protected:
std::vector<uint8_t> _read_buffer;
private:
bool _task_should_exit = false;
std::set<std::string> _overridden_params;
std::map<std::string, std::string> _file_formats; ///< all formats we read from the file