stdglue.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdlib.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Write callback
  8. * @param _cookie - pointer to cookie (see stdio gnu extension)
  9. * @param data - pointer to data
  10. * @param size - data size
  11. * @warnign your handler must consume everything
  12. */
  13. typedef void (*FuriStdglueWriteCallback)(void* _cookie, const char* data, size_t size);
  14. /* Initialized std library glue code */
  15. void furi_stdglue_init();
  16. /* Set global STDOUT callback
  17. * @param callback - callback or NULL to clear
  18. * @return true on success, otherwise fail
  19. * @warning function is thread aware, use this API from the same thread
  20. */
  21. bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback);
  22. /* Set STDOUT callback for your thread
  23. * @param callback - callback or NULL to clear
  24. * @return true on success, otherwise fail
  25. * @warning function is thread aware, use this API from the same thread
  26. */
  27. bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
  28. #ifdef __cplusplus
  29. }
  30. #endif