1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 04:41:26 +04:00

[FL-3958] Stdio API improvements (#4110)

* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Anna Antonenko
2025-02-22 03:11:27 +04:00
committed by GitHub
parent 404764b660
commit ef024e8086
7 changed files with 53 additions and 21 deletions

View File

@@ -758,16 +758,22 @@ static int32_t __furi_thread_stdout_flush(FuriThread* thread) {
return 0;
}
FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback(void) {
void furi_thread_get_stdout_callback(FuriThreadStdoutWriteCallback* callback, void** context) {
FuriThread* thread = furi_thread_get_current();
furi_check(thread);
return thread->output.write_callback;
furi_check(callback);
furi_check(context);
*callback = thread->output.write_callback;
*context = thread->output.context;
}
FuriThreadStdinReadCallback furi_thread_get_stdin_callback(void) {
void furi_thread_get_stdin_callback(FuriThreadStdinReadCallback* callback, void** context) {
FuriThread* thread = furi_thread_get_current();
furi_check(thread);
return thread->input.read_callback;
furi_check(callback);
furi_check(context);
*callback = thread->input.read_callback;
*context = thread->input.context;
}
void furi_thread_set_stdout_callback(FuriThreadStdoutWriteCallback callback, void* context) {

View File

@@ -479,16 +479,18 @@ uint32_t furi_thread_get_stack_space(FuriThreadId thread_id);
/**
* @brief Get the standard output callback for the current thead.
*
* @return pointer to the standard out callback function
* @param[out] callback where to store the stdout callback
* @param[out] context where to store the context
*/
FuriThreadStdoutWriteCallback furi_thread_get_stdout_callback(void);
void furi_thread_get_stdout_callback(FuriThreadStdoutWriteCallback* callback, void** context);
/**
* @brief Get the standard input callback for the current thead.
*
* @return pointer to the standard in callback function
* @param[out] callback where to store the stdin callback
* @param[out] context where to store the context
*/
FuriThreadStdinReadCallback furi_thread_get_stdin_callback(void);
void furi_thread_get_stdin_callback(FuriThreadStdinReadCallback* callback, void** context);
/** Set standard output callback for the current thread.
*