diff options
Diffstat (limited to 'apps/sm-serial-read-all.h')
-rw-r--r-- | apps/sm-serial-read-all.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/sm-serial-read-all.h b/apps/sm-serial-read-all.h index 14cdf1e..b87727b 100644 --- a/apps/sm-serial-read-all.h +++ b/apps/sm-serial-read-all.h @@ -21,8 +21,8 @@ namespace sm_serial_read_all_utils { class port_handler { public: - port_handler(string &port_name, serial_port &port, unique_ptr<SampleStreamParser> parser) : - port_name(port_name), port(port), parser(move(parser)) { + port_handler(string &port_name, serial_port &port, unique_ptr<SampleStreamParser> parser) + : port_name(port_name), port(port), parser(move(parser)) { } void run() { @@ -54,7 +54,6 @@ private: unique_ptr<SampleStreamParser> parser; }; - } // This only supports Linux @@ -65,7 +64,7 @@ private: vector<string> &&find_ports() { DIR *dir = opendir("/dev"); - vector <string> ports; + vector<string> ports; if (!dir) { return move(ports); @@ -100,13 +99,12 @@ public: sample_format_type format; void add_options(po::options_description_easy_init &options) override { - options - ("port", po::value<string>()->required(), "The serial port to read") - ("format", po::value<sample_format_type>(&format)->default_value(sample_format_type::KEY_VALUE), "Output format"); + options("port", po::value<string>()->required(), "The serial port to read"); + options("format", po::value<sample_format_type>(&format)->default_value(sample_format_type::KEY_VALUE), + "Output format"); } - static - void handler_thread(port_handler *handler) { + static void handler_thread(port_handler *handler) { handler->run(); } @@ -150,7 +148,8 @@ public: port.set_option(serial_port_base::flow_control(serial_port_base::flow_control::none)); KeyDictionary parserDict; // TODO: dette feiler - unique_ptr<SampleStreamParser> parser = open_sample_stream_parser(thread_safe_output, parserDict, sample_format_type::KEY_VALUE); + unique_ptr<SampleStreamParser> parser = + open_sample_stream_parser(thread_safe_output, parserDict, sample_format_type::KEY_VALUE); auto handler = new port_handler(port_name, port, move(parser)); active_ports[port_name] = handler; @@ -163,8 +162,6 @@ public: return EXIT_SUCCESS; } - }; - } } |