a9e2519466182a983a3641fd86e17ae4aa58c05c
[platform/core/system/libtracker.git] / include / tracker.h
1 /*
2  * libtracker
3  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18
19 #ifndef __LIBTRACKER_TRACKER_H__
20 #define __LIBTRACKER_TRACKER_H__
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 /**
28  * @addtogroup  LIBTRACKER_MODULE
29  * @{
30  */
31
32 #include <tizen.h>
33
34 /**
35  * @brief  Enumeration of error codes for libtracker
36  */
37 typedef enum {
38         TRACKER_ERROR_NONE              = TIZEN_ERROR_NONE,              /**< Successful */
39         TRACKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
40         TRACKER_ERROR_OUT_OF_MEMORY     = TIZEN_ERROR_OUT_OF_MEMORY,     /**< Out of memory */
41         TRACKER_ERROR_IO_ERROR          = TIZEN_ERROR_IO_ERROR,          /**< An input/output error occurred */
42         TRACKER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< No permission to use the API */
43         TRACKER_ERROR_NOT_SUPPORTED     = TIZEN_ERROR_NOT_SUPPORTED,     /**< The api is not supported */
44 } tracker_error_e;
45
46 typedef enum {
47         TRACKER_SERVICE_DOWNLOAD = 1 << 0, /**< download services */
48         TRACKER_SERVICE_MEDIA    = 1 << 1, /**< media operations */
49         TRACKER_SERVICE_NETWORK  = 1 << 2, /**< network services */
50         TRACKER_SERVICE_LOCATION = 1 << 3, /**< location services */
51         TRACKER_SERVICE_SENSOR   = 1 << 4, /**< sensor information */
52         TRACKER_SERVICE_IOT      = 1 << 5, /**< IoT services */
53 } tracker_service_e;
54
55 typedef enum {
56         TRACKER_TYPE_POWER_LOCK = 0,
57         TRACKER_TYPE_MAX
58 } tracker_type_e;
59
60 /**
61  * @brief   Gets the reference count of @a type tracker
62  * @since_tizen  3.0
63  * @param[in] type  Tracker type
64  * @param[out] count  The reference count of @a type tracker
65  * @return  @c 0 on success,
66  *          otherwise a negative error value
67  * @retval  #TRACKER_ERROR_NONE Successful
68  * @retval  #TRACKER_ERROR_INVALID_PARAMETER The input parameter is invalid
69  * @retval  #TRACKER_ERROR_PERMISSION_DENIED No permission to use the API
70  */
71 int tracker_get_ref_counter(tracker_type_e type, int *count);
72
73 /**
74  * @brief   Gets the total count of @a type tracker
75  * @since_tizen  3.0
76  * @param[in] type  Tracker type
77  * @param[out] count  The total count of @a type tracker
78  * @return  @c 0 on success,
79  *          otherwise a negative error value
80  * @retval  #TRACKER_ERROR_NONE Successful
81  * @retval  #TRACKER_ERROR_INVALID_PARAMETER The input parameter is invalid
82  * @retval  #TRACKER_ERROR_PERMISSION_DENIED No permission to use the API
83  */
84 int tracker_get_tick(tracker_type_e type, int *count);
85
86 /**
87  * @brief   Start tracking for information of services
88  * @details  This API should be used only in the framework, not in applications
89  * @since_tizen  3.0
90  * @param[in] services  The services to use internally
91  * @return  @c 0 on success,
92  *          otherwise a negative error value
93  * @retval  #TRACKER_ERROR_NONE Successful
94  * @retval  #TRACKER_ERROR_INVALID_PARAMETER The input parameter is invalid
95  * @retval  #TRACKER_ERROR_PERMISSION_DENIED No permission to use the API
96  */
97 int tracker_start_services(int services);
98
99 /**
100  * @brief   Stop tracking for information of services
101  * @details  This API should be used only in the framework, not in applications
102  * @since_tizen  3.0
103  * @param[in] services  The services not to use internally
104  * @return  @c 0 on success,
105  *          otherwise a negative error value
106  * @retval  #TRACKER_ERROR_NONE Successful
107  * @retval  #TRACKER_ERROR_INVALID_PARAMETER The input parameter is invalid
108  * @retval  #TRACKER_ERROR_PERMISSION_DENIED No permission to use the API
109  */
110 int tracker_stop_services(int services);
111
112 /**
113  * @}
114  */
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif /* __LIBTRACKER_TRACKER_H__ */