1 #include <Application.h> 2 #include <MessageRunner.h> 3 4 #include "power_button_monitor.h" 5 6 class PowerManagementDaemon : public BApplication { 7 public: 8 PowerManagementDaemon(); 9 virtual ~PowerManagementDaemon(); 10 }; 11 12 int main(void) { 13 new PowerManagementDaemon(); 14 be_app->Run(); 15 delete be_app; 16 return 0; 17 } 18 19 PowerManagementDaemon::PowerManagementDaemon() : BApplication("application/x-vnd.Haiku-powermanagement") { 20 PowerButtonMonitor *pb_mon = new PowerButtonMonitor(); 21 AddHandler(pb_mon); 22 23 new BMessageRunner(BMessenger(pb_mon,this),new BMessage(POLL_POWER_BUTTON_STATUS),5e5 /* twice a second */); 24 } 25 26 PowerManagementDaemon::~PowerManagementDaemon() {} 27