4e186d901e78fd361d1a5896223c337b28344bb4
[platform/core/multimedia/mm-resource-manager.git] / src / lib / mm_resource_manager.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __MM_RESOURCE_MANAGER__
18 #define __MM_RESOURCE_MANAGER__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 /**
27  * @file mm_resource_manager.h
28  * @brief Abstraction layer providing unified API for Tizen Multimedia Components
29  *        to communicate with underlying resource management modules.
30  * @details The API provides functionality for resolving conflict of
31  *          simultaneous access to the same resource from different multimedia
32  *          components. The API has a feature to acquire resource by parts.
33  *
34  *          There are 4 main entity: Resource Manager, Application Class,
35  *          Resource and Release Callback.
36  *
37  *          Resource Manager is a wrapper over underlying resource
38  *          management modules. Multimedia component or application defines its
39  *          Application Class which associated with priority. An application
40  *          trying to acquire Resource or its part, using by other application,
41  *          will acquire the resource if the first application has the same or
42  *          higher priority than the second application only. In that case,
43  *          Release Callback function will be called for the second application.
44  *          During the callback call, the second application must stop using
45  *          the resource. The resource will not be acquired by the first
46  *          application until the callback execution ends.
47  */
48
49
50 /**
51  * @brief Generated file right after daemonizing normally.
52  *
53  * @since_tizen 5.5
54  */
55 #define MM_RESOURCE_MANAGER_READY "/tmp/.mm_res_mgr_ready"
56
57
58
59
60 /**
61  * @brief Defining full volume of a resource.
62  *
63  * @since_tizen 4.0
64  */
65 #define MM_RESOURCE_MANAGER_RES_VOLUME_FULL -1
66
67
68
69 /**
70  * @brief Resource manager handle type.
71  *
72  * @since_tizen 4.0
73  */
74 typedef void *mm_resource_manager_h;
75
76 /**
77  * @brief Enumeration of resource type.
78  * @remarks Note that available resource types can differ depending
79  *          on platform. #MM_RESOURCE_MANAGER_RES_TYPE_MAX is invalid resource
80  *          type.
81  * @since_tizen 4.0
82  */
83 typedef enum {
84         MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_DECODER,     /**< ID of video decoder resource type */
85         MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY,     /**< ID of video overlay resource type */
86         MM_RESOURCE_MANAGER_RES_TYPE_CAMERA,            /**< ID of camera resource type */
87         MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_ENCODER,     /**< ID of video encoder resource type */
88         MM_RESOURCE_MANAGER_RES_TYPE_RADIO,             /**< ID of radio resource type */
89         MM_RESOURCE_MANAGER_RES_TYPE_AUDIO_OFFLOAD,     /**< ID of audio offload resource type */
90         MM_RESOURCE_MANAGER_RES_TYPE_MAX,               /**< Used to iterate on resource types only */
91 } mm_resource_manager_res_type_e;
92
93 /**
94  * @brief Enumeration of resource type condition to request resource part volume.
95  * @remarks Note that available list of conditions can differ depending
96  *          on platform. #MM_RESOURCE_MANAGER_RES_TYPE_COND_MAX is invalid
97  *          condition.
98  * @since_tizen 4.0
99  */
100 typedef enum {
101         MM_RESOURCE_MANAGER_RES_TYPE_COND_SD,               /**< ID for SD video */
102         MM_RESOURCE_MANAGER_RES_TYPE_COND_HD,               /**< ID for HD video */
103         MM_RESOURCE_MANAGER_RES_TYPE_COND_FHD,              /**< ID for FHD video */
104         MM_RESOURCE_MANAGER_RES_TYPE_COND_UHD,              /**< ID for UHD video */
105         MM_RESOURCE_MANAGER_RES_TYPE_COND_MAX,              /**< Used to iterate on conditions only */
106 } mm_resource_manager_res_type_cond_e;
107
108 /**
109  * @brief Enumeration for application class.
110  * @remarks Note that available application classes can differ depending
111  *          on platform. #MM_RESOURCE_MANAGER_APP_CLASS_MAX is invalid
112  *          application class.
113  * @since_tizen 4.0
114  */
115 typedef enum {
116         MM_RESOURCE_MANAGER_APP_CLASS_MEDIA,        /**< ID of multimedia application class */
117         MM_RESOURCE_MANAGER_APP_CLASS_INTERRUPT,    /**< ID of application class with max priority */
118         MM_RESOURCE_MANAGER_APP_CLASS_MAX,          /**< Used to iterate on application classes only */
119 } mm_resource_manager_app_class_e;
120
121 /**
122  * @brief Enumeration for resource manager status.
123  *
124  * @since_tizen 4.0
125  */
126 typedef enum {
127         MM_RESOURCE_MANAGER_STATUS_DISCONNECTED,    /**< Resource manager was forcibly disconnected from underlying resource management module */
128         MM_RESOURCE_MANAGER_STATUS_MAX,             /**< Used to iterate on resource manager statuses only */
129 } mm_resource_manager_status_e;
130
131 /**
132  * @brief Enumeration for resource manager error.
133  *
134  * @since_tizen 4.0
135  */
136 typedef enum {
137         MM_RESOURCE_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE,                                        /**< Successful */
138         MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,              /**< Invalid parameter */
139         MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,             /**< Invalid operation */
140         MM_RESOURCE_MANAGER_ERROR_NOT_SUPPORTED  = TIZEN_ERROR_NOT_SUPPORTED,                     /**< The feature is not supported */
141         MM_RESOURCE_MANAGER_ERROR_INVALID_STATE,                                                  /**< Invalid state */
142         MM_RESOURCE_MANAGER_ERROR_LOW_PRIORITY,                                                   /**< Low priority to acquire a resource */
143         MM_RESOURCE_MANAGER_ERROR_NOT_ENOUGH,                                                     /**< There are no enough free resource volume */
144         MM_RESOURCE_MANAGER_ERROR_LAUNCH_FAILURE,                                                 /**< Resource manager is not launched */
145 } mm_resource_manager_error_e;
146
147 /**
148  * @brief Resource volume. It's using to acquire part of resource.
149  *
150  * @since_tizen 4.0
151  */
152 typedef int mm_resource_manager_res_volume;
153
154 /**
155  * @brief Structure with information about resource in the resource manager.
156  *
157  * @since_tizen 4.0
158  */
159 typedef struct {
160         mm_resource_manager_res_type_e type;      /**< Resource type */
161         mm_resource_manager_res_volume volume;    /**< Resource part volume or #MM_RESOURCE_MANAGER_RES_VOLUME_FULL if it's full resource*/
162         int is_acquire_failed;                    /**< It's TRUE if last attempt to acquire this resource failed */
163 } mm_resource_manager_res_info_s;
164
165 /**
166  * @brief Handle of resource in the resource manager. It's using to
167  *        identify resources.
168  *
169  * @since_tizen 4.0
170  */
171 typedef void *mm_resource_manager_res_h;
172
173 /**
174  * @brief Called when resource manager status is changed.
175  * @since_tizen 4.0
176  * @details Any operations on resource manager will cause lock.
177  *          When @a status equal to #MM_RESOURCE_MANAGER_STATUS_DISCONNECTED
178  *          no further operations with resource manager should be permitted.
179  *          Resources associated should be released manually.
180  *          Resource manager must not be destroyed within this callback.
181  * @param [in] rm          Resource manager handle
182  * @param [in] status      The previous status of the resource manager
183  * @param [in] user_data   The user data passed from the code where
184  *                         mm_resource_manager_set_status_cb() was called
185  * @see mm_resource_manager_set_status_cb()
186  * @see mm_resource_manager_status_e
187  */
188 typedef void (*mm_resource_manager_status_cb) (mm_resource_manager_h rm,
189                 mm_resource_manager_status_e status, void *user_data);
190
191
192
193 /**
194  * @brief Called when resource @a type is being acquired by other instance of
195  *        resource manager.
196  * @since_tizen 4.0
197  * @details When this callback is triggered all resources associated with
198  *          resource @a type must be released. Any operations on resource
199  *          manager will cause lock.
200  * @param [in] rm          Resource manager handle
201  * @param [in] resource_h  Handle of resource caused release callback
202  * @param [in] user_data   The user data passed from the code where
203  *                         mm_resource_manager_create() was called.
204  * @return TRUE if all resources should be released in the resource manager
205  *         automatically after the callback execution ends; FALSE otherwise.
206  * @see mm_resource_manager_create()
207  * @see mm_resource_manager_res_type_e
208  * @see mm_resource_manager_res_h
209  */
210 typedef int (*mm_resource_manager_release_cb) (mm_resource_manager_h rm,
211                 mm_resource_manager_res_h resource_h, void *user_data);
212
213 /**
214  * @brief Creates an instance of resource manager and
215  *        passes back the handle to the caller.
216  * @since_tizen 4.0
217  * @remarks @a rm must be released by calling mm_resource_manager_destroy()
218  * @details @a release_cb must be set, because resource acquiring cannot be
219  *          done without the release callback function.
220  * @param [in]  app_class     Application class
221  * @param [in]  release_cb    Resource release callback
222  * @param [in]  cb_user_data  Data passed to the callback function
223  * @param [out] rm            Resource manager handle
224  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
225  *         otherwise error code value
226  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
227  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
228  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
229  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_STATE Invalid state
230  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_ENOUGH not enough free resource volume
231  * @see mm_resource_manager_destroy()
232  * @see mm_resource_manager_app_class_e
233  * @see mm_resource_manager_release_cb
234  */
235 int mm_resource_manager_create(mm_resource_manager_app_class_e app_class,
236                 mm_resource_manager_release_cb release_cb,
237                 void *cb_user_data, mm_resource_manager_h *rm);
238
239 /**
240  * @brief Destroys resource manager.
241  * @since_tizen 4.0
242  * @param [in] rm    Resource manager handle
243  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
244  *         otherwise error code value
245  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
246  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
247  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
248  * @pre @a rm must be created by calling mm_resource_manager_create()
249  * @see mm_resource_manager_create()
250  */
251 int mm_resource_manager_destroy(mm_resource_manager_h rm);
252
253 /**
254  * @brief Marks resource of type @a type or its part for acquiring. Actual
255  *        acquiring is done after calling mm_resource_manager_commit()
256  * @since_tizen 4.0
257  * @remarks Available resources are represented by mm_resource_manager_res_type_e
258  *          enumeration, but actual list could vary depending on platform
259  *          capabilities. #MM_RESOURCE_MANAGER_RES_TYPE_MAX isn't in available
260  *          resources list.
261  *          Resource should be released manually by calling
262  *          mm_resource_manager_mark_for_release() or
263  *          mm_resource_manager_mark_all_for_release() and subsequent
264  *          mm_resource_manager_commit() call.
265  *          Otherwise, the resource will be automatically released by calling
266  *          mm_resource_manager_destroy().
267  * @remarks There are presets for @a volume which can be obtained with
268  *          @a mm_resource_manager_get_res_type_volume(). Upper limit of
269  *          @a volume can be obtained with
270  *          @a mm_resource_manager_get_res_type_max_volume()
271  * @remarks To mark whole resource for acquiring @a volume parameter should be
272  *          set to #MM_RESOURCE_MANAGER_RES_VOLUME_FULL.
273  * @param [in] rm          Resource manager handle
274  * @param [in] type        Type of resource to acquire
275  * @param [in] volume      Volume of resource part to acquire or
276  *                         #MM_RESOURCE_MANAGER_RES_VOLUME_FULL to acquire full resource
277  * @param [out] resource_h Handle to the marked resource
278  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
279  *         otherwise error code value
280  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
281  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
282  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
283  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_SUPPORTED Resource type is not supported
284  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_ENOUGH There are no enough free local volume to mark
285  * @pre @a rm must be created by calling mm_resource_manager_create()
286  * @post mm_resource_manager_commit() should be called to acquire resource actually
287  * @see mm_resource_manager_create()
288  * @see mm_resource_manager_destroy()
289  * @see mm_resource_manager_get_res_type_volume()
290  * @see mm_resource_manager_get_res_type_max_volume()
291  * @see mm_resource_manager_mark_for_release()
292  * @see mm_resource_manager_mark_all_for_release()
293  * @see mm_resource_manager_commit()
294  * @see mm_resource_manager_res_type_e
295  * @see mm_resource_manager_res_volume
296  * @see mm_resource_manager_res_h
297  */
298 int mm_resource_manager_mark_for_acquire(
299                 mm_resource_manager_h rm, mm_resource_manager_res_type_e type,
300                 mm_resource_manager_res_volume volume,
301                 mm_resource_manager_res_h *resource_h);
302
303 /**
304  * @brief Change resource part volume that was set with
305  *        mm_resource_manager_mark_for_acquire().
306  *        For already acquired resources, actual resizing is done after calling
307  *        mm_resource_manager_commit()
308  * @since_tizen 4.0
309  * @remarks Calling this function for resource part marked for releasing marks the
310  *          resource for acquiring with size specified in @a new_volume parameter.
311  * @remarks To mark whole resource for acquiring @a new_volume parameter should be
312  *          set to #MM_RESOURCE_MANAGER_RES_VOLUME_FULL.
313  * @param [in] rm          Resource manager handle
314  * @param [in] resource_h  Resource handle to change
315  * @param [in] new_volume  New volume of resource part to acquire or
316  *                         #MM_RESOURCE_MANAGER_RES_VOLUME_FULL to acquire full resource
317  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
318  *         otherwise error code value
319  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
320  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
321  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
322  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_ENOUGH There are no enough free local volume to resize
323  * @pre @a rm must be created by calling mm_resource_manager_create()
324  * @pre @a resource_h is returned by mm_resource_manager_mark_for_acquire()
325  * @post mm_resource_manager_commit() should be called to resize already acquired resource actually
326  * @see mm_resource_manager_create()
327  * @see mm_resource_manager_mark_for_acquire()
328  * @see mm_resource_manager_mark_for_release()
329  * @see mm_resource_manager_mark_all_for_release()
330  * @see mm_resource_manager_commit()
331  * @see mm_resource_manager_res_h
332  * @see mm_resource_manager_res_volume
333  */
334 int mm_resource_manager_resize_marked(mm_resource_manager_h rm,
335                 mm_resource_manager_res_h resource_h,
336                 mm_resource_manager_res_volume new_volume);
337
338 /**
339  * @brief Marks resource handle @resource_h for releasing. Actual
340  *        releasing is done after calling mm_resource_manager_commit()
341  * @since_tizen 4.0
342  * @details Both already acquired and marked for acquiring resource can be marked
343  *          for release. In the first case, the actual releasing is done after
344  *          calling mm_resource_manager_commit(); in the second case,
345  *          the resource is unmarked for acquiring and the handle is destroyed.
346  * @remarks Calling this function with wrong or destroyed handle will not
347  *          raise the segmentation fault error. #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER
348  *          will be returned.
349  * @remarks All acquired resources will be automatically released by
350  *          calling mm_resource_manager_destroy().
351  * @param [in] rm           Resource manager handle
352  * @param [in] resource_h   Resource handle to mark
353  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
354  *         otherwise error code value
355  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
356  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
357  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
358  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_STATE Invalid state
359  * @pre @a rm must be created by calling mm_resource_manager_create()
360  * @pre @a resource_h is returned by mm_resource_manager_mark_for_acquire()
361  * @see mm_resource_manager_create()
362  * @see mm_resource_manager_destroy()
363  * @see mm_resource_manager_mark_for_acquire()
364  * @see mm_resource_manager_commit()
365  * @see mm_resource_manager_res_h
366  */
367 int mm_resource_manager_mark_for_release(mm_resource_manager_h rm,
368                 mm_resource_manager_res_h resource_h);
369
370 /**
371  * @brief Marks all resource handles for releasing. Actual
372  *        releasing is done after calling mm_resource_manager_commit()
373  * @since_tizen 4.0
374  * @details This function calls mm_resource_manager_mark_for_release() for all
375  *          resource handles existing in the resource manager.
376  * @param [in] rm           Resource manager handle
377  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
378  *         otherwise error code value
379  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
380  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
381  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
382  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_STATE Invalid state
383  * @pre @a rm must be created by calling mm_resource_manager_create()
384  * @see mm_resource_manager_create()
385  * @see mm_resource_manager_mark_for_release()
386  * @see mm_resource_manager_commit()
387  */
388 int mm_resource_manager_mark_all_for_release(mm_resource_manager_h rm);
389
390 /**
391  * @brief Fill @a info structure with information about resource handle @a resource_h
392  * @since_tizen 4.0
393  * @remarks Calling this function with wrong or destroyed handle will not
394  *          raise the segmentation fault error. MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER
395  *          will be returned.
396  * @param [in]   rm           Resource manager handle
397  * @param [in]   resource_h   Resource handle
398  * @param [out]  info         Pointer to the info structure to be filled
399  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
400  *         otherwise error code value
401  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
402  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
403  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
404  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_STATE Invalid state
405  * @pre @a rm must be created by calling mm_resource_manager_create()
406  * @pre @a resource_h is returned by mm_resource_manager_mark_for_acquire()
407  * @see mm_resource_manager_create()
408  * @see mm_resource_manager_mark_for_acquire()
409  * @see mm_resource_manager_res_h
410  * @see mm_resource_manager_res_info_s
411  */
412 int mm_resource_manager_get_resource_info(mm_resource_manager_h rm,
413                 mm_resource_manager_res_h resource_h,
414                 mm_resource_manager_res_info_s *info);
415
416 /**
417  * @brief Synchronizes local resource manager state with the resource manager
418  *        back-end.
419  * @since_tizen 4.0
420  * @details If the function completes successfully, all resources, marked for
421  *          acquiring by mm_resource_manager_mark_for_acquire() are acquired;
422  *          all resources, marked for releasing by mm_resource_manager_mark_for_release()
423  *          are released and their handles are destroyed.
424  *          In case of error, neither local state of the resource manager nor
425  *          state of the back-end are changed.
426  * @remarks If the function fails because of resource conflict (one of resources,
427  *          marked for acquiring is already acquired by application with higher
428  *          priority), user can check which resource(s) could not be acquired
429  *          by calling mm_resource_manager_get_resource_info()
430  * @param [in] rm           Resource manager handle
431  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
432  *         otherwise error code value
433  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
434  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
435  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
436  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_STATE Invalid state
437  * @retval #MM_RESOURCE_MANAGER_ERROR_LOW_PRIORITY Resource conflict
438  * @pre @a rm must be created by calling mm_resource_manager_create()
439  * @pre resources for acquiring should be marked with mm_resource_manager_mark_for_acquire()
440  * @pre resources for releasing should be marked with
441  *      mm_resource_manager_mark_for_release() or mm_resource_manager_mark_all_for_release()
442  * @see mm_resource_manager_create()
443  * @see mm_resource_manager_mark_for_acquire()
444  * @see mm_resource_manager_mark_for_release()
445  * @see mm_resource_manager_mark_all_for_release()
446  * @see mm_resource_manager_get_resource_info()
447  * @see mm_resource_manager_res_h
448  */
449 int mm_resource_manager_commit(mm_resource_manager_h rm);
450
451 /**
452  * @brief Sets status callback to resource manager.
453  * @since_tizen 4.0
454  * @remakrs Status callback can be unset by calling this function with NULL for
455  *          @a cb parameter.
456  * @param [in] rm        Resource manager handle
457  * @param [in] cb        Status callback
458  * @param [in] user_data Data that will be passed to the callback function
459  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
460  *         otherwise error code value
461  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
462  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
463  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_OPERATION Invalid operation
464  * @pre @a rm must be created by calling mm_resource_manager_create()
465  * @see mm_resource_manager_create()
466  * @see mm_resource_manager_status_cb
467  */
468 int mm_resource_manager_set_status_cb(mm_resource_manager_h rm,
469                 mm_resource_manager_status_cb cb, void *user_data);
470
471 /**
472  * @brief Gets full (max) volume of certain resource type.
473  * @since_tizen 4.0
474  * @remakrs Resources of the same type may have different max volumes on
475  *          different platforms. #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER is
476  *          returned if there is no specified resource type for the platform.
477  * @param [in]  rm            Resource manager handle
478  * @param [in]  type          Resource type
479  * @param [out] max_volume    Max volume of the resource type
480  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
481  *         otherwise error code value
482  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
483  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
484  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_SUPPORTED Resource type is not supported
485  * @pre @a rm must be created by calling mm_resource_manager_create()
486  * @see mm_resource_manager_create()
487  * @see mm_resource_manager_res_type_e
488  */
489 int mm_resource_manager_get_res_type_max_volume(mm_resource_manager_h rm,
490                 mm_resource_manager_res_type_e type,
491                 mm_resource_manager_res_volume *max_volume);
492
493 /**
494  * @brief Gets volume of resource part per specified resource @a type and
495  *        @a condition parameter.
496  * @since_tizen 4.0
497  * @remakrs This function may return different volumes for the same type and
498  *          condition depending on platform.
499  *          #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER is
500  *          returned if there are no specified resource type or condition for
501  *          the platform.
502  * @param [in]  rm          Resource manager handle
503  * @param [in]  type        Resource type
504  * @param [in]  condition   Condition
505  * @param [out] volume      Volume of resource part
506  * @return #MM_RESOURCE_MANAGER_ERROR_NONE on success,
507  *         otherwise error code value
508  * @retval #MM_RESOURCE_MANAGER_ERROR_NONE Successful
509  * @retval #MM_RESOURCE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
510  * @retval #MM_RESOURCE_MANAGER_ERROR_NOT_SUPPORTED Resource type or condition
511  *         are not supported
512  * @pre @a rm must be created by calling mm_resource_manager_create()
513  * @see mm_resource_manager_create()
514  * @see mm_resource_manager_res_type_e
515  * @see mm_resource_manager_res_type_cond_e
516  */
517 int mm_resource_manager_get_res_type_volume(mm_resource_manager_h rm,
518                 mm_resource_manager_res_type_e type,
519                 mm_resource_manager_res_type_cond_e condition,
520                 mm_resource_manager_res_volume *volume);
521
522 #ifdef __cplusplus
523 }
524 #endif /* __cplusplus */
525
526 #endif /* __MM_RESOURCE_MANAGER__ */