mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 23:39:37 -05:00
Extract CaptureConfig from StreamOutput to CaptureThread.
So capture stats can be exposed by CaptureThread.
This commit is contained in:
parent
75159fcc00
commit
7430e31578
@ -38,14 +38,13 @@ using namespace hackrf::one;
|
|||||||
class StreamOutput {
|
class StreamOutput {
|
||||||
public:
|
public:
|
||||||
StreamOutput(
|
StreamOutput(
|
||||||
const size_t write_size_log2,
|
CaptureConfig* const config
|
||||||
const size_t buffer_count_log2
|
) : config { config }
|
||||||
) : config { write_size_log2, buffer_count_log2 }
|
|
||||||
{
|
{
|
||||||
shared_memory.baseband_queue.push_and_wait(
|
shared_memory.baseband_queue.push_and_wait(
|
||||||
CaptureConfigMessage { &config }
|
CaptureConfigMessage { config }
|
||||||
);
|
);
|
||||||
fifo = config.fifo;
|
fifo = config->fifo;
|
||||||
}
|
}
|
||||||
|
|
||||||
~StreamOutput() {
|
~StreamOutput() {
|
||||||
@ -66,7 +65,7 @@ public:
|
|||||||
static FIFO<uint8_t>* fifo;
|
static FIFO<uint8_t>* fifo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CaptureConfig config;
|
CaptureConfig* const config;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CaptureThread {
|
class CaptureThread {
|
||||||
@ -75,8 +74,7 @@ public:
|
|||||||
std::string file_path,
|
std::string file_path,
|
||||||
size_t write_size_log2,
|
size_t write_size_log2,
|
||||||
size_t buffer_count_log2
|
size_t buffer_count_log2
|
||||||
) : write_size_log2 { write_size_log2 },
|
) : config { write_size_log2, buffer_count_log2 },
|
||||||
buffer_count_log2 { buffer_count_log2 },
|
|
||||||
file_path { std::move(file_path) }
|
file_path { std::move(file_path) }
|
||||||
{
|
{
|
||||||
// Need significant stack for FATFS
|
// Need significant stack for FATFS
|
||||||
@ -106,8 +104,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const size_t write_size_log2;
|
CaptureConfig config;
|
||||||
const size_t buffer_count_log2;
|
|
||||||
const std::string file_path;
|
const std::string file_path;
|
||||||
File file;
|
File file;
|
||||||
static Thread* thread;
|
static Thread* thread;
|
||||||
@ -122,13 +119,13 @@ private:
|
|||||||
return false;
|
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<uint8_t[]>(write_size);
|
const auto write_buffer = std::make_unique<uint8_t[]>(write_size);
|
||||||
if( !write_buffer ) {
|
if( !write_buffer ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamOutput stream { write_size_log2, buffer_count_log2 };
|
StreamOutput stream { &config };
|
||||||
|
|
||||||
while( !chThdShouldTerminate() ) {
|
while( !chThdShouldTerminate() ) {
|
||||||
if( stream.available() >= write_size ) {
|
if( stream.available() >= write_size ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user