runlevelcb.h 1002 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _RUNLEVELCB_H
  2. #define _RUNLEVELCB_H
  3. #include <api/syscb/callbacks/syscbi.h>
  4. #include <api/service/service.h>
  5. #define RUNLEVELCALLBACKI_PARENT SysCallbackI
  6. class RunlevelCallbackI : public RUNLEVELCALLBACKI_PARENT {
  7. public:
  8. virtual FOURCC syscb_getEventType() { return SysCallback::RUNLEVEL; }
  9. // override these
  10. virtual void runlevelcb_onStartup() {}
  11. virtual void runlevelcb_onAppRunning() {}
  12. virtual void runlevelcb_onShutdown() {}
  13. virtual void runlevelcb_onBeforeShutdown() {}
  14. private:
  15. virtual int syscb_notify(int msg, intptr_t param1=0, intptr_t param2=0) {
  16. switch (msg) {
  17. case SvcNotify::ONSTARTUP:
  18. runlevelcb_onStartup();
  19. break;
  20. case SvcNotify::ONAPPRUNNING:
  21. runlevelcb_onAppRunning();
  22. break;
  23. case SvcNotify::ONSHUTDOWN:
  24. runlevelcb_onShutdown();
  25. break;
  26. case SvcNotify::ONBEFORESHUTDOWN:
  27. runlevelcb_onBeforeShutdown();
  28. break;
  29. default: return 0;
  30. }
  31. return 1;
  32. }
  33. };
  34. #endif