From aa45b70efb3d236b313527022dad7ef27eacdae0 Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Wed, 23 Aug 2017 17:02:52 +0200 Subject: Refactor basic PAD encoder structure - move main process into new PAD encoder object - hand over options by new separate options object - unify default value retrieval in usage --- src/odr-padenc.h | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/odr-padenc.h') diff --git a/src/odr-padenc.h b/src/odr-padenc.h index 2b3f79b..ce77c27 100644 --- a/src/odr-padenc.h +++ b/src/odr-padenc.h @@ -29,6 +29,7 @@ #include "common.h" +#include #include #include #include @@ -43,7 +44,41 @@ #include "sls.h" -static const int SLEEPDELAY_DEFAULT = 10; // seconds -static const int DLS_REPETITION_WHILE_SLS = 50; +// --- PadEncoderOptions ----------------------------------------------------------------- +struct PadEncoderOptions { + size_t padlen; + bool erase_after_tx; + int sleepdelay; + bool raw_slides; + DL_PARAMS dl_params; -static bool do_exit = false; + const char* sls_dir; + const char* output; + std::vector dls_files; + + PadEncoderOptions() : + padlen(58), + erase_after_tx(false), + sleepdelay(10), + raw_slides(false), + sls_dir(NULL), + output("/tmp/pad.fifo") + {} +}; + + +// --- PadEncoder ----------------------------------------------------------------- +class PadEncoder { +private: + static const int DLS_REPETITION_WHILE_SLS; + + PadEncoderOptions options; + + std::mutex status_mutex; + bool do_exit; +public: + PadEncoder(PadEncoderOptions options) : options(options), do_exit(false) {} + + int Main(); + void DoExit(); +}; -- cgit v1.2.3