aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/syscb/callbacks/runlevelcb.h
blob: 4ead8d5eb7013468375d4122f1c4a1d1e54c41b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _RUNLEVELCB_H
#define _RUNLEVELCB_H

#include <api/syscb/callbacks/syscbi.h>
#include <api/service/service.h>

#define RUNLEVELCALLBACKI_PARENT SysCallbackI
class RunlevelCallbackI : public RUNLEVELCALLBACKI_PARENT {
public:
  virtual FOURCC syscb_getEventType() { return SysCallback::RUNLEVEL; }

  // override these
  virtual void runlevelcb_onStartup() {}
  virtual void runlevelcb_onAppRunning() {}
  virtual void runlevelcb_onShutdown() {}
  virtual void runlevelcb_onBeforeShutdown() {}

private:
  virtual int syscb_notify(int msg, intptr_t param1=0, intptr_t param2=0) {
    switch (msg) {
      case SvcNotify::ONSTARTUP:
        runlevelcb_onStartup();
      break;
      case SvcNotify::ONAPPRUNNING:
        runlevelcb_onAppRunning();
      break;
      case SvcNotify::ONSHUTDOWN:
        runlevelcb_onShutdown();
      break;
      case SvcNotify::ONBEFORESHUTDOWN:
        runlevelcb_onBeforeShutdown();
        break;
      default: return 0;
    }
    return 1;
  }
};

#endif