HostPower.h revision 899cf879d9636e1b7fe8bd6b05926c372dc32ed5
b711a01730152421a900e5f4e237cfb848c9c4fdvboxsync/** @file
b0cec57d51e48736a3303366c728c3f025e8e81bvboxsync *
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * VirtualBox interface to host's power notification service
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync */
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync/*
b0cec57d51e48736a3303366c728c3f025e8e81bvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync *
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * available from http://www.virtualbox.org. This file is free software;
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * you can redistribute it and/or modify it under the terms of the GNU
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * General Public License (GPL) as published by the Free Software
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
94872a0e88ab4f38c786fcf617ddeb4b63a76957vboxsync *
78a072e1b56619e3230735ae073668311232ec94vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
78a072e1b56619e3230735ae073668311232ec94vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
78a072e1b56619e3230735ae073668311232ec94vboxsync * additional information or have any questions.
78a072e1b56619e3230735ae073668311232ec94vboxsync */
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync#ifndef ____H_HOSTPOWER
78a072e1b56619e3230735ae073668311232ec94vboxsync#define ____H_HOSTPOWER
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync#include "VirtualBoxBase.h"
78a072e1b56619e3230735ae073668311232ec94vboxsync#include "MachineImpl.h"
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncclass VirtualBox;
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsynctypedef enum
78a072e1b56619e3230735ae073668311232ec94vboxsync{
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync HostPowerEvent_Suspend,
78a072e1b56619e3230735ae073668311232ec94vboxsync HostPowerEvent_Resume,
78a072e1b56619e3230735ae073668311232ec94vboxsync HostPowerEvent_BatteryLow
78a072e1b56619e3230735ae073668311232ec94vboxsync} HostPowerEvent;
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncclass HostPowerService
78a072e1b56619e3230735ae073668311232ec94vboxsync{
78a072e1b56619e3230735ae073668311232ec94vboxsyncpublic:
78a072e1b56619e3230735ae073668311232ec94vboxsync HostPowerService(VirtualBox *aVirtualBox);
78a072e1b56619e3230735ae073668311232ec94vboxsync virtual ~HostPowerService();
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync void notify(HostPowerEvent event);
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync HRESULT processEvent(SessionMachine *machine, HostPowerEvent event);
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsyncprotected:
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync};
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync# ifdef RT_OS_WINDOWS
78a072e1b56619e3230735ae073668311232ec94vboxsync/**
c3d2b15ad840b405062f4c2c6b127d6fc107c7b2vboxsync * The Windows hosted Power Service.
78a072e1b56619e3230735ae073668311232ec94vboxsync */
78a072e1b56619e3230735ae073668311232ec94vboxsyncclass HostPowerServiceWin : public HostPowerService
78a072e1b56619e3230735ae073668311232ec94vboxsync{
78a072e1b56619e3230735ae073668311232ec94vboxsyncpublic:
78a072e1b56619e3230735ae073668311232ec94vboxsync HostPowerServiceWin(VirtualBox *aVirtualBox);
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync virtual ~HostPowerServiceWin();
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsyncprivate:
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync static DECLCALLBACK(int) NotificationThread (RTTHREAD ThreadSelf, void *pInstance);
78a072e1b56619e3230735ae073668311232ec94vboxsync static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
78a072e1b56619e3230735ae073668311232ec94vboxsync
4df0640e3f60845347b8c00d3b04a9fdecfef63cvboxsync HWND mHwnd;
78a072e1b56619e3230735ae073668311232ec94vboxsync RTTHREAD mThread;
78a072e1b56619e3230735ae073668311232ec94vboxsync};
78a072e1b56619e3230735ae073668311232ec94vboxsync# endif /* RT_OS_WINDOWS */
78a072e1b56619e3230735ae073668311232ec94vboxsync
78a072e1b56619e3230735ae073668311232ec94vboxsync#endif /* !____H_HOSTPOWER */
78a072e1b56619e3230735ae073668311232ec94vboxsync