]>
Commit | Line | Data |
---|---|---|
056a1eb7 SF |
1 | /** @file |
2 | * IPRT - Power management. | |
3 | */ | |
4 | ||
5 | /* | |
6d209b23 | 6 | * Copyright (C) 2008-2017 Oracle Corporation |
056a1eb7 SF |
7 | * |
8 | * This file is part of VirtualBox Open Source Edition (OSE), as | |
9 | * available from http://www.virtualbox.org. This file is free software; | |
10 | * you can redistribute it and/or modify it under the terms of the GNU | |
11 | * General Public License (GPL) as published by the Free Software | |
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the | |
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the | |
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. | |
15 | * | |
16 | * The contents of this file may alternatively be used under the terms | |
17 | * of the Common Development and Distribution License Version 1.0 | |
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the | |
19 | * VirtualBox OSE distribution, in which case the provisions of the | |
20 | * CDDL are applicable instead of those of the GPL. | |
21 | * | |
22 | * You may elect to license modified versions of this file under the | |
23 | * terms and conditions of either the GPL or the CDDL or both. | |
24 | */ | |
25 | ||
26 | #ifndef ___iprt_power_h | |
27 | #define ___iprt_power_h | |
28 | ||
29 | #include <iprt/cdefs.h> | |
30 | #include <iprt/types.h> | |
31 | ||
32 | ||
33 | RT_C_DECLS_BEGIN | |
34 | ||
35 | /** @defgroup grp_rt_power RTPower - Power management | |
36 | * @ingroup grp_rt | |
37 | * @{ | |
38 | */ | |
39 | ||
40 | #ifdef IN_RING0 | |
41 | ||
42 | /** | |
43 | * MP event, see FNRTPOWERNOTIFICATION. | |
44 | */ | |
45 | typedef enum RTPOWEREVENT | |
46 | { | |
47 | /** The system will go into suspend mode. */ | |
48 | RTPOWEREVENT_SUSPEND = 1, | |
49 | /** The system has resumed. */ | |
50 | RTPOWEREVENT_RESUME | |
51 | } RTPOWEREVENT; | |
52 | ||
53 | /** | |
54 | * Notification callback. | |
55 | * | |
56 | * The context this is called in differs a bit from platform to | |
57 | * platform, so be careful while in here. | |
58 | * | |
59 | * @param enmEvent The event. | |
60 | * @param pvUser The user argument. | |
61 | */ | |
62 | typedef DECLCALLBACK(void) FNRTPOWERNOTIFICATION(RTPOWEREVENT enmEvent, void *pvUser); | |
63 | /** Pointer to a FNRTPOWERNOTIFICATION(). */ | |
64 | typedef FNRTPOWERNOTIFICATION *PFNRTPOWERNOTIFICATION; | |
65 | ||
66 | /** | |
67 | * Registers a notification callback for power events. | |
68 | * | |
69 | * @returns IPRT status code. | |
70 | * @retval VINF_SUCCESS on success. | |
71 | * @retval VERR_NO_MEMORY if a registration record cannot be allocated. | |
72 | * @retval VERR_ALREADY_EXISTS if the pfnCallback and pvUser already exist | |
73 | * in the callback list. | |
74 | * | |
75 | * @param pfnCallback The callback. | |
76 | * @param pvUser The user argument to the callback function. | |
77 | */ | |
78 | RTDECL(int) RTPowerNotificationRegister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser); | |
79 | ||
80 | /** | |
81 | * This deregisters a notification callback registered via RTPowerNotificationRegister(). | |
82 | * | |
83 | * The pfnCallback and pvUser arguments must be identical to the registration call | |
84 | * of we won't find the right entry. | |
85 | * | |
86 | * @returns IPRT status code. | |
87 | * @retval VINF_SUCCESS on success. | |
88 | * @retval VERR_NOT_FOUND if no matching entry was found. | |
89 | * | |
90 | * @param pfnCallback The callback. | |
91 | * @param pvUser The user argument to the callback function. | |
92 | */ | |
93 | RTDECL(int) RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser); | |
94 | ||
95 | /** | |
96 | * This calls all registered power management callback handlers registered via RTPowerNotificationRegister(). | |
97 | * | |
98 | * @returns IPRT status code. | |
99 | * @retval VINF_SUCCESS on success. | |
100 | * | |
101 | * @param enmEvent Power Management event | |
102 | */ | |
103 | RTDECL(int) RTPowerSignalEvent(RTPOWEREVENT enmEvent); | |
104 | ||
105 | #endif /* IN_RING0 */ | |
106 | ||
107 | /** @} */ | |
108 | ||
109 | RT_C_DECLS_END | |
110 | ||
111 | #endif | |
112 |