CCAux 3.0.0.0
CCAux API reference
PowerMgr.h
Go to the documentation of this file.
1
2/*
3 * Copyright (C) 2023 CrossControl AB
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; with
8 * version 2.1 of the License.
9 */
10/*
11 * File description:
12 * Access functions for managing application shutdown/cleanup
13 * when suspend or shutdown events occur. An application can use this framework
14 * to delay a suspend/shutdown until it is ready with any tasks it needs to do.
15 * It is also possible to use existing OS functions to achieve the same result.
16 *
17 * Note that applications should not use these functions to delay a suspend/shutdown
18 * request for a long time (more than 20-30s depending on platform). The computer will
19 * eventually be shut down forcibly if the application does not respond.
20 *
21 * It is not recommended for multiple applications to access the PowerMgr
22 * functionality simultaneously, although it is supported on some platforms.
23 *
24 * Note that a shutdown initiated by the OS will not be caught by this framework.
25 *
26 * Example Usage:
27 * @include powermgr_example.cpp
28 *
29 ************************************************/
30
31#ifndef CC_POWERMGR_H_
32#define CC_POWERMGR_H_
33
34#include "CCAuxErrors.h"
35#include "CCAuxTypes.h"
36#include "CCPlatform.h"
37
38#ifdef __cplusplus
39namespace CrossControl
40{
41#endif
42
46typedef enum
47{
53 Normal = 0,
54
59
68
69typedef enum
70{
84
85typedef void *POWERMGRHANDLE;
86
106EXTERN_C
107CCAUXDLL_API
109CCAUXDLL_CALLING_CONV
111
122EXTERN_C
123CCAUXDLL_API
124void CCAUXDLL_CALLING_CONV PowerMgr_release(POWERMGRHANDLE);
125
138EXTERN_C
139CCAUXDLL_API
141
154EXTERN_C
155CCAUXDLL_API
157
171EXTERN_C
172CCAUXDLL_API
174
187EXTERN_C
188CCAUXDLL_API
190
204EXTERN_C
205CCAUXDLL_API
206eErr CCAUXDLL_CALLING_CONV PowerMgr_hasResumed(POWERMGRHANDLE, bool *resumed);
207
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* CC_POWERMGR_H_ */
EXTERN_C CCAUXDLL_API POWERMGRHANDLE CCAUXDLL_CALLING_CONV GetPowerMgr(void)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PowerMgr_hasResumed(POWERMGRHANDLE, bool *resumed)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PowerMgr_setAppReadyForSuspendOrShutdown(POWERMGRHANDLE)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV PowerMgr_release(POWERMGRHANDLE)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PowerMgr_getConfiguration(POWERMGRHANDLE, PowerMgrConf *conf)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PowerMgr_getPowerMgrStatus(POWERMGRHANDLE, PowerMgrStatus *status)
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV PowerMgr_registerControlledSuspendOrShutDown(POWERMGRHANDLE, PowerMgrConf conf)
Definition: About.h:30
PowerMgrStatus
Definition: PowerMgr.h:70
@ SuspendPending
Definition: PowerMgr.h:78
@ NoRequestsPending
Definition: PowerMgr.h:74
@ ShutdownPending
Definition: PowerMgr.h:82
void * POWERMGRHANDLE
Definition: PowerMgr.h:85
PowerMgrConf
Definition: PowerMgr.h:47
@ Normal
Definition: PowerMgr.h:53
@ BatterySuspend
Definition: PowerMgr.h:66
@ ApplicationControlled
Definition: PowerMgr.h:58
eErr
Definition: CCAuxTypes.h:162