22 #ifndef SUSPENDBLOCKER_H
23 #define SUSPENDBLOCKER_H
28 #include <lunaservice.h>
44 void setupService(LSHandle*& service, GMainLoop* loop);
45 void callService(LSHandle* service, LSFilterFunc callback,
46 const char* url,
const char* message);
47 void registerSuspendRequest();
48 void registerPrepareSuspend();
50 static bool cbSuspendRequest(LSHandle* sh, LSMessage* message,
void* ctx);
51 static bool cbPrepareSuspend(LSHandle* sh, LSMessage* message,
void* ctx);
52 static bool cbResume(LSHandle* sh, LSMessage* message,
void* ctx);
53 static bool cbPowerdUp(LSHandle* sh, LSMessage* message,
void* ctx);
54 static bool cbIdentify(LSHandle* sh, LSMessage* message,
void* ctx);
61 GMainLoop* m_mainLoop;
64 LSHandle* m_nestedService;
65 GMainContext* m_nestedCtxt;
66 GMainLoop* m_nestedLoop;
68 bool m_registeredSuspendRequest;
69 bool m_registeredPrepareSuspend;
77 template<
class Target>
88 , m_allowSuspendFunction(f1)
89 , m_setSuspendedFunction(f2) {}
93 virtual bool allowSuspend() {
return (m_target->*m_allowSuspendFunction)(); }
94 virtual void setSuspended(
bool isSuspended) { (m_target->*m_setSuspendedFunction)(isSuspended); }