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  * To have a reference-counted wakeup-source, set the LE_PM_REF_COUNT bit in the opts argument.
49  * When this bit is set, each le_pm_StayAwake() increments a counter, and multiple calls to
50  * le_pm_Relax() is necessary to release the wakeup source.
51  *
52  * Power Manager service will automatically release and delete all wakeup sources held on behalf
53  * of an exiting or disconnecting client.
54  *
55  * For deterministic behaviour, clients requesting services of Power Manager should have
56  * CAP_EPOLLWAKEUP (or CAP_BLOCK_SUSPEND) capability assigned.
57  *
58  * <HR>
59  *
60  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
61  */
62 /**
63  * @file le_pm_interface.h
64  *
65  * Legato @ref c_pm include file.
66  *
67  * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
68  */
69 /**
70  * Some useful constants
71  */
72 
73 #ifndef LE_PM_INTERFACE_H_INCLUDE_GUARD
74 #define LE_PM_INTERFACE_H_INCLUDE_GUARD
75 
76 
77 #include "legato.h"
78 
79 //--------------------------------------------------------------------------------------------------
80 /**
81  *
82  * Connect the current client thread to the service providing this API. Block until the service is
83  * available.
84  *
85  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
86  * called before any other functions in this API. Normally, ConnectService is automatically called
87  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
88  *
89  * This function is created automatically.
90  */
91 //--------------------------------------------------------------------------------------------------
93 (
94  void
95 );
96 
97 //--------------------------------------------------------------------------------------------------
98 /**
99  *
100  * Try to connect the current client thread to the service providing this API. Return with an error
101  * if the service is not available.
102  *
103  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
104  * called before any other functions in this API. Normally, ConnectService is automatically called
105  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
106  *
107  * This function is created automatically.
108  *
109  * @return
110  * - LE_OK if the client connected successfully to the service.
111  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
112  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
113  * - LE_COMM_ERROR if the Service Directory cannot be reached.
114  */
115 //--------------------------------------------------------------------------------------------------
117 (
118  void
119 );
120 
121 //--------------------------------------------------------------------------------------------------
122 /**
123  *
124  * Disconnect the current client thread from the service providing this API.
125  *
126  * Normally, this function doesn't need to be called. After this function is called, there's no
127  * longer a connection to the service, and the functions in this API can't be used. For details, see
128  * @ref apiFilesC_client.
129  *
130  * This function is created automatically.
131  */
132 //--------------------------------------------------------------------------------------------------
134 (
135  void
136 );
137 
138 
139 //--------------------------------------------------------------------------------------------------
140 /**
141  * Maximum string length for a wake-up source tag (not including the null-terminator)
142  */
143 //--------------------------------------------------------------------------------------------------
144 #define LE_PM_TAG_LEN 31
145 
146 
147 //--------------------------------------------------------------------------------------------------
148 /**
149  * Maximum string length for a wake-up source tag (including the null-terminator)
150  */
151 //--------------------------------------------------------------------------------------------------
152 #define LE_PM_TAG_LEN_BYTES 32
153 
154 
155 //--------------------------------------------------------------------------------------------------
156 /**
157  * Option LE_PM_REF_COUNT to manage a reference counted wakeup source
158  */
159 //--------------------------------------------------------------------------------------------------
160 #define LE_PM_REF_COUNT 1
161 
162 
163 //--------------------------------------------------------------------------------------------------
164 /**
165  * Reference to wakeup source used by StayAwake and Relax function
166  */
167 //--------------------------------------------------------------------------------------------------
168 typedef struct le_pm_WakeupSource* le_pm_WakeupSourceRef_t;
169 
170 //--------------------------------------------------------------------------------------------------
171 /**
172  * Create a wakeup source
173  *
174  * @return
175  * - Reference to wakeup source (to be used later for acquiring/releasing)
176  *
177  * @note The process exits if an invalid or existing tag is passed
178  */
179 //--------------------------------------------------------------------------------------------------
181 (
182  uint32_t createOpts,
183  ///< [IN] Wakeup source options
184 
185  const char* wsTag
186  ///< [IN] Context-specific wakeup source tag
187 );
188 
189 //--------------------------------------------------------------------------------------------------
190 /**
191  * Acquire a wakeup source
192  *
193  */
194 //--------------------------------------------------------------------------------------------------
195 void le_pm_StayAwake
196 (
198  ///< [IN] Reference to a created wakeup source
199 );
200 
201 //--------------------------------------------------------------------------------------------------
202 /**
203  * Release a previously acquired wakeup source
204  *
205  */
206 //--------------------------------------------------------------------------------------------------
207 void le_pm_Relax
208 (
210  ///< [IN] Reference to a created wakeup source
211 );
212 
213 
214 #endif // LE_PM_INTERFACE_H_INCLUDE_GUARD
215 
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:168
le_pm_WakeupSourceRef_t le_pm_NewWakeupSource(uint32_t createOpts, const char *wsTag)