aboutsummaryrefslogtreecommitdiffstats
path: root/src/odr-padenc.h
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2017-08-23 17:02:52 +0200
committerStefan Pöschel <github@basicmaster.de>2017-08-23 17:02:52 +0200
commitaa45b70efb3d236b313527022dad7ef27eacdae0 (patch)
treec58e78b10803fd3e3feeb34030ce77e53a74152c /src/odr-padenc.h
parentbfd47a0b33ff38bda39b11d64cf31e32bbfd19d2 (diff)
downloadODR-PadEnc-aa45b70efb3d236b313527022dad7ef27eacdae0.tar.gz
ODR-PadEnc-aa45b70efb3d236b313527022dad7ef27eacdae0.tar.bz2
ODR-PadEnc-aa45b70efb3d236b313527022dad7ef27eacdae0.zip
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
Diffstat (limited to 'src/odr-padenc.h')
-rw-r--r--src/odr-padenc.h41
1 files changed, 38 insertions, 3 deletions
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 <mutex>
#include <stdlib.h>
#include <signal.h>
#include <string>
@@ -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<std::string> 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();
+};