VirtualBox

source: vbox/trunk/include/iprt/power.h@ 13469

Last change on this file since 13469 was 13468, checked in by vboxsync, 16 years ago

Export

File size: 3.6 KB
Line 
1/** @file
2 * IPRT - Power management.
3 */
4
5/*
6 * Copyright (C) 2008 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___iprt_power_h
31#define ___iprt_power_h
32
33#include <iprt/cdefs.h>
34#include <iprt/types.h>
35
36
37__BEGIN_DECLS
38
39/** @defgroup grp_rt_power RTPower - Power management
40 * @ingroup grp_rt
41 * @{
42 */
43
44#ifdef IN_RING0
45
46/**
47 * MP event, see FNRTPOWERNOTIFICATION.
48 */
49typedef enum RTPOWEREVENT
50{
51 /** The system will go into suspend mode. */
52 RTPOWEREVENT_SUSPEND = 1,
53 /** The system has resumed. */
54 RTPOWEREVENT_RESUME
55} RTPOWEREVENT;
56
57/**
58 * Notification callback.
59 *
60 * The context this is called in differs a bit from platform to
61 * platform, so be careful while in here.
62 *
63 * @param enmEvent The event.
64 * @param pvUser The user argument.
65 */
66typedef DECLCALLBACK(void) FNRTPOWERNOTIFICATION(RTPOWEREVENT enmEvent, void *pvUser);
67/** Pointer to a FNRTPOWERNOTIFICATION(). */
68typedef FNRTPOWERNOTIFICATION *PFNRTPOWERNOTIFICATION;
69
70/**
71 * Registers a notification callback for power events.
72 *
73 * @returns IPRT status code.
74 * @retval VINF_SUCCESS on success.
75 * @retval VERR_NO_MEMORY if a registration record cannot be allocated.
76 * @retval VERR_ALREADY_EXISTS if the pfnCallback and pvUser already exist
77 * in the callback list.
78 *
79 * @param pfnCallback The callback.
80 * @param pvUser The user argument to the callback function.
81 */
82RTDECL(int) RTPowerNotificationRegister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
83
84/**
85 * This deregisters a notification callback registered via RTPowerNotificationRegister().
86 *
87 * The pfnCallback and pvUser arguments must be identical to the registration call
88 * of we won't find the right entry.
89 *
90 * @returns IPRT status code.
91 * @retval VINF_SUCCESS on success.
92 * @retval VERR_NOT_FOUND if no matching entry was found.
93 *
94 * @param pfnCallback The callback.
95 * @param pvUser The user argument to the callback function.
96 */
97RTDECL(int) RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser);
98
99/**
100 * This calls all registered power management callback handlers registered via RTPowerNotificationRegister().
101 *
102 * @returns IPRT status code.
103 * @retval VINF_SUCCESS on success.
104 *
105 * @param enmEvent Power Management event
106 */
107RTDECL(int) RTPowerSignalEvent(RTPOWEREVENT enmEvent);
108
109#endif /* IN_RING0 */
110
111/** @} */
112
113__END_DECLS
114
115#endif
116
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette