1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox interface to host's power notification service
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ____H_HOSTPOWER
|
---|
23 | #define ____H_HOSTPOWER
|
---|
24 |
|
---|
25 | #include "VirtualBoxBase.h"
|
---|
26 | #include "MachineImpl.h"
|
---|
27 |
|
---|
28 | #include <vector>
|
---|
29 |
|
---|
30 | class VirtualBox;
|
---|
31 |
|
---|
32 | typedef enum
|
---|
33 | {
|
---|
34 | HostPowerEvent_Suspend,
|
---|
35 | HostPowerEvent_Resume,
|
---|
36 | HostPowerEvent_BatteryLow
|
---|
37 | } HostPowerEvent;
|
---|
38 |
|
---|
39 | class HostPowerService
|
---|
40 | {
|
---|
41 | public:
|
---|
42 |
|
---|
43 | HostPowerService (VirtualBox *aVirtualBox);
|
---|
44 | virtual ~HostPowerService();
|
---|
45 |
|
---|
46 | void notify (HostPowerEvent aEvent);
|
---|
47 |
|
---|
48 | protected:
|
---|
49 |
|
---|
50 | ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
|
---|
51 |
|
---|
52 | std::vector <ComPtr <IConsole> > mConsoles;
|
---|
53 | };
|
---|
54 |
|
---|
55 | # ifdef RT_OS_WINDOWS
|
---|
56 | /**
|
---|
57 | * The Windows hosted Power Service.
|
---|
58 | */
|
---|
59 | class HostPowerServiceWin : public HostPowerService
|
---|
60 | {
|
---|
61 | public:
|
---|
62 |
|
---|
63 | HostPowerServiceWin(VirtualBox *aVirtualBox);
|
---|
64 | virtual ~HostPowerServiceWin();
|
---|
65 |
|
---|
66 | private:
|
---|
67 |
|
---|
68 | static DECLCALLBACK(int) NotificationThread (RTTHREAD ThreadSelf, void *pInstance);
|
---|
69 | static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
70 |
|
---|
71 | HWND mHwnd;
|
---|
72 | RTTHREAD mThread;
|
---|
73 | };
|
---|
74 | # endif /* RT_OS_WINDOWS */
|
---|
75 |
|
---|
76 | #endif /* !____H_HOSTPOWER */
|
---|