From 7430e315783e8d3f94bff359a4169f8570e0e032 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 27 Apr 2016 10:56:50 -0700 Subject: [PATCH] Extract CaptureConfig from StreamOutput to CaptureThread. So capture stats can be exposed by CaptureThread. --- firmware/application/capture_thread.hpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/firmware/application/capture_thread.hpp b/firmware/application/capture_thread.hpp index 9f9a0da1a..f8fc9ec7f 100644 --- a/firmware/application/capture_thread.hpp +++ b/firmware/application/capture_thread.hpp @@ -38,14 +38,13 @@ using namespace hackrf::one; class StreamOutput { public: StreamOutput( - const size_t write_size_log2, - const size_t buffer_count_log2 - ) : config { write_size_log2, buffer_count_log2 } + CaptureConfig* const config + ) : config { config } { shared_memory.baseband_queue.push_and_wait( - CaptureConfigMessage { &config } + CaptureConfigMessage { config } ); - fifo = config.fifo; + fifo = config->fifo; } ~StreamOutput() { @@ -66,7 +65,7 @@ public: static FIFO* fifo; private: - CaptureConfig config; + CaptureConfig* const config; }; class CaptureThread { @@ -75,8 +74,7 @@ public: std::string file_path, size_t write_size_log2, size_t buffer_count_log2 - ) : write_size_log2 { write_size_log2 }, - buffer_count_log2 { buffer_count_log2 }, + ) : config { write_size_log2, buffer_count_log2 }, file_path { std::move(file_path) } { // Need significant stack for FATFS @@ -106,8 +104,7 @@ public: } private: - const size_t write_size_log2; - const size_t buffer_count_log2; + CaptureConfig config; const std::string file_path; File file; static Thread* thread; @@ -122,13 +119,13 @@ private: return false; } - const size_t write_size = 1U << write_size_log2; + const size_t write_size = 1U << config.write_size_log2; const auto write_buffer = std::make_unique(write_size); if( !write_buffer ) { return false; } - StreamOutput stream { write_size_log2, buffer_count_log2 }; + StreamOutput stream { &config }; while( !chThdShouldTerminate() ) { if( stream.available() >= write_size ) {