le_pm_interface.h

Go to the documentation of this file.
1 /*
2  * ====================== WARNING ======================
3  *
4  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
5  * DO NOT MODIFY IN ANY WAY.
6  *
7  * ====================== WARNING ======================
8  */
9 
10 /**
11  * @page c_pm Power Manager
12  *
13  * @ref le_pm_interface.h "API Reference"
14  *
15  * <HR>
16  *
17  * Components need access to the Power Manager to control the system's wake-up state.
18  * Operations that need fast response times (e.g., maintaining call state or playing/recording a
19  * media stream) result in high interrupt rates; keeping the system awake results in better performance
20  * and power efficiency.
21  *
22  * Power Manager uses kernel wakeup sources to keep the system awake when at least one of the
23  * registered components requests a wakeup source to be held. When all wakeup sources are
24  * released, the system may enter a suspend state depending on the status of other (unrelated) wakeup
25  * sources.
26  *
27  * @section le_pm_binding IPC interfaces binding
28  *
29  * All the functions of this API are provided by the @b powerMgr service.
30  *
31  * Here's a code sample binding to Power Manager services:
32  * @verbatim
33  bindings:
34  {
35  clientExe.clientComponent.le_pm -> powerMgr.le_pm
36  }
37  @endverbatim
38  *
39  * @section le_pm_request Requesting and releasing a wakeup source
40  *
41  * The Power Manager service provides basic API for requesting and releasing a wakeup source.
42  * Power Manager's clients call @c le_pm_NewWakeupSource() to create a wakeup source. This function
43  * returns a @ref le_pm_WakeupSourceRef_t type that can later be used to acquire and release a
44  * wakeup source through @c le_pm_StayAwake() and le_pm_Relax(), respectively. Wakeup sources
45  * are not reference-counted, which means multiple calls to le_pm_StayAwake() can be canceled
46  * by a single call to le_pm_Relax().
47  *
48  * Power Manager service will automatically release and delete all wakeup sources held on behalf
49  * of an exiting or disconnecting client.
50  *
51  * For deterministic behaviour, clients requesting services of Power Manager should have
52  * CAP_EPOLLWAKEUP (or CAP_BLOCK_SUSPEND) capability assigned.
53  *
54  * <HR>
55  *
56  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
57  */
58 /**
59  * @file le_pm_interface.h
60  *
61  * Legato @ref c_pm include file.
62  *
63  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
64  */
65 /**
66  * Some useful constants
67  */
68 
69 #ifndef LE_PM_INTERFACE_H_INCLUDE_GUARD
70 #define LE_PM_INTERFACE_H_INCLUDE_GUARD
71 
72 
73 #include "legato.h"
74 
75 //--------------------------------------------------------------------------------------------------
76 /**
77  *
78  * Connect the current client thread to the service providing this API. Block until the service is
79  * available.
80  *
81  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
82  * called before any other functions in this API. Normally, ConnectService is automatically called
83  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
84  *
85  * This function is created automatically.
86  */
87 //--------------------------------------------------------------------------------------------------
89 (
90  void
91 );
92 
93 //--------------------------------------------------------------------------------------------------
94 /**
95  *
96  * Try to connect the current client thread to the service providing this API. Return with an error
97  * if the service is not available.
98  *
99  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
100  * called before any other functions in this API. Normally, ConnectService is automatically called
101  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
102  *
103  * This function is created automatically.
104  *
105  * @return
106  * - LE_OK if the client connected successfully to the service.
107  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
108  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
109  * - LE_COMM_ERROR if the Service Directory cannot be reached.
110  */
111 //--------------------------------------------------------------------------------------------------
113 (
114  void
115 );
116 
117 //--------------------------------------------------------------------------------------------------
118 /**
119  *
120  * Disconnect the current client thread from the service providing this API.
121  *
122  * Normally, this function doesn't need to be called. After this function is called, there's no
123  * longer a connection to the service, and the functions in this API can't be used. For details, see
124  * @ref apiFilesC_client.
125  *
126  * This function is created automatically.
127  */
128 //--------------------------------------------------------------------------------------------------
130 (
131  void
132 );
133 
134 
135 //--------------------------------------------------------------------------------------------------
136 /**
137  * Maximum string length for a wake-up source tag (not including the null-terminator)
138  */
139 //--------------------------------------------------------------------------------------------------
140 #define LE_PM_TAG_LEN 31
141 
142 
143 //--------------------------------------------------------------------------------------------------
144 /**
145  * Maximum string length for a wake-up source tag (including the null-terminator)
146  */
147 //--------------------------------------------------------------------------------------------------
148 #define LE_PM_TAG_LEN_BYTES 32
149 
150 
151 //--------------------------------------------------------------------------------------------------
152 /**
153  * Reference to wakeup source used by StayAwake and Relax function
154  */
155 //--------------------------------------------------------------------------------------------------
156 typedef struct le_pm_WakeupSource* le_pm_WakeupSourceRef_t;
157 
158 //--------------------------------------------------------------------------------------------------
159 /**
160  * Create a wakeup source
161  *
162  * @return
163  * - Reference to wakeup source (to be used later for acquiring/releasing)
164  *
165  * @note The process exits if an invalid or existing tag is passed
166  */
167 //--------------------------------------------------------------------------------------------------
169 (
170  uint32_t createOpts,
171  ///< [IN] Wakeup source options (always zero - usage reserved)
172 
173  const char* wsTag
174  ///< [IN] Context-specific wakeup source tag
175 );
176 
177 //--------------------------------------------------------------------------------------------------
178 /**
179  * Acquire a wakeup source
180  *
181  */
182 //--------------------------------------------------------------------------------------------------
183 void le_pm_StayAwake
184 (
186  ///< [IN] Reference to a created wakeup source
187 );
188 
189 //--------------------------------------------------------------------------------------------------
190 /**
191  * Release a previously acquired wakeup source
192  *
193  */
194 //--------------------------------------------------------------------------------------------------
195 void le_pm_Relax
196 (
198  ///< [IN] Reference to a created wakeup source
199 );
200 
201 
202 #endif // LE_PM_INTERFACE_H_INCLUDE_GUARD
203 
le_result_t
Definition: le_basics.h:35
void le_pm_DisconnectService(void)
void le_pm_ConnectService(void)
void le_pm_StayAwake(le_pm_WakeupSourceRef_t wsRef)
void le_pm_Relax(le_pm_WakeupSourceRef_t wsRef)
le_result_t le_pm_TryConnectService(void)
struct le_pm_WakeupSource * le_pm_WakeupSourceRef_t
Definition: le_pm_interface.h:156
le_pm_WakeupSourceRef_t le_pm_NewWakeupSource(uint32_t createOpts, const char *wsTag)