flapp.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "flipper.h"
  3. // == Flipper Application control (flapp) ==
  4. typedef FlappHandler uint32_t; // TODO
  5. /*
  6. simply starts application. It call `app` entrypoint with `param` passed as argument
  7. Useful for daemon applications and pop-up.
  8. */
  9. FlappHandler* flapp_start(void(app*)(void*), char* name, void* param);
  10. /*
  11. swtich to other application.
  12. System **stop current app**, call `app` entrypoint with `param` passed
  13. as argument and save current application entrypoint to `prev` field in
  14. current application registry. Useful for UI or "active" application.
  15. */
  16. FlappHandler* flapp_switch(void(app*)(void*), char* name, void* param);
  17. /*
  18. Exit application
  19. stop current application (stop thread and clear application's stack),
  20. start application from `prev` entry in current application registry,
  21. cleanup current application registry.
  22. */
  23. void flapp_exit(void* param);
  24. /*
  25. stop specified `app` without returning to `prev` application.
  26. */
  27. bool flapp_kill(FlappHandler* app);
  28. /*
  29. If case one app depend on other, notify that app is ready.
  30. */
  31. void flapp_ready();
  32. /*
  33. Register on-exit callback.
  34. It called before app will be killed.
  35. Not recommended to use in user scenario, only for system purpose
  36. (unregister callbacks, release mutexes, etc.)
  37. */
  38. bool flapp_on_exit(void(cb*)(void*), void* ctx);