mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-12 03:34:58 -04:00
Send CaptureThread error into app-local message queue.
This commit is contained in:
parent
76c5fe96af
commit
cfaa44b02a
5 changed files with 42 additions and 17 deletions
|
@ -44,7 +44,8 @@ public:
|
|||
CaptureThread(
|
||||
std::unique_ptr<Writer> writer,
|
||||
size_t write_size,
|
||||
size_t buffer_count
|
||||
size_t buffer_count,
|
||||
std::function<void(File::Error)>&& error_callback
|
||||
);
|
||||
~CaptureThread();
|
||||
|
||||
|
@ -52,8 +53,6 @@ public:
|
|||
return config;
|
||||
}
|
||||
|
||||
const Optional<File::Error>& error() const;
|
||||
|
||||
static void check_fifo_isr();
|
||||
|
||||
private:
|
||||
|
@ -61,12 +60,15 @@ private:
|
|||
|
||||
CaptureConfig config;
|
||||
std::unique_ptr<Writer> writer;
|
||||
Optional<File::Error> last_error;
|
||||
std::function<void(File::Error)> error_callback;
|
||||
static Thread* thread;
|
||||
|
||||
static msg_t static_fn(void* arg) {
|
||||
auto obj = static_cast<CaptureThread*>(arg);
|
||||
obj->last_error = obj->run();
|
||||
const auto error = obj->run();
|
||||
if( error.is_valid() && obj->error_callback ) {
|
||||
obj->error_callback(error.value());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue