Publishing project from SPIN to public
[platform/core/convergence/remote-rsc-svc.git] / include / rrs_main.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
18 #ifndef _RRS_MAIN_H_
19 #define _RRS_MAIN_H_
20
21 #include <tizen_type.h>
22 #include <iotcon.h>
23 #include <common.h>
24 #include "rrs_error.h"
25
26 /**
27  * @ingroup     CAPI_RRS_MODULE
28  * @defgroup    CAPI_RRS_MAIN_MODULE General
29  *
30  * @file rrs_main.h
31  * @brief This file contains functions related to RRS API.
32  * @addtogroup CAPI_RRS_MAIN_MODULE
33  * @{
34  * @brief This provides APIs related to RRS
35  */
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42
43 /**
44  * @brief       Handle of the RRS.
45  * @details The RRS handle can be obtained via call of rrs_create().
46  * @since_tizen 3.0
47  *
48  * @remarks To release the handle use rrs_destroy().
49  *
50  * @par Example
51  * @code
52  * #include <rrs.h>
53  * // Usage of RRS in the app
54  * int main(void) {
55  *      // Creating RRS
56  *      rrs_h rrs = 0;
57  *      rrs_create(&rrs);
58  *
59  *      // Do something with RRS
60  *      // Destroy schema and data when no more needed
61  *      rrs_destroy(rrs);
62  *
63  *      return 0;
64  * }
65  * @endcode
66  *
67  * @see rrs_create()
68  * @see rrs_destroy()
69  */
70 typedef int rrs_h;
71
72
73 /**
74  * @brief       Enumerations of resources, supported by RRS
75  * @since_tizen 3.0
76  */
77 typedef enum _rrs_resource_e {
78         RRS_RESOURCE_NONE = 0,                  /**< Invalid sensor */
79         RRS_RESOURCE_DISCOVERY = 1,             /**< Discovery resource */
80         RRS_RESOURCE_ACCELEROMETER,             /**< Accelerometer sensor */
81         RRS_RESOURCE_PROXIMITY,                 /**< Proximity sensor */
82         RRS_RESOURCE_AUTO_ROTATION,             /**< Auto rotation sensor */
83         RRS_RESOURCE_HRM,                               /**< Bio HRM sensor */
84         RRS_RESOURCE_HRM_LED_GREEN,             /**< Bio LED green sensor */
85         RRS_RESOURCE_HRM_LED_RED,               /**< Bio LED RED sensor */
86         RRS_RESOURCE_HRM_LED_IR,                /**< Bio LED IR sensor */
87         RRS_RESOURCE_GYROSCOPE,                 /**< Gyroscope sensor */
88         RRS_RESOURCE_MAGNETOMETER,              /**< Geomagnetic sensor */
89         RRS_RESOURCE_LIGHT,                             /**< Light sensor */
90         RRS_RESOURCE_PRESSURE,                  /**< Pressure sensor */
91         RRS_RESOURCE_TEMPERATURE,               /**< Temperature sensor */
92         RRS_RESOURCE_HUMIDITY,                  /**< Humidity sensor */
93         RRS_RESOURCE_UV,                                /**< Ultraviolet sensor */
94         RRS_RESOURCE_ORIENTATION,               /**< Orientation sensor */
95         RRS_RESOURCE_GRAVITY,                   /**< Gravity sensor */
96         RRS_RESOURCE_LINEAR_ACCELERATION,/**< Linear acceleration sensor */
97         RRS_RESOURCE_ROTATION_VECTOR,   /**< Rotation vector sensor */
98         RRS_RESOURCE_GYROSCOPE_ROTATION_VECTOR,         /**< Gyroscope Rotation Vector sensor */
99         RRS_RESOURCE_GEOMAGNETIC_ROTATION_VECTOR,       /**< Geomagnetic Rotation Vector sensor */
100         RRS_RESOURCE_UNCALIBRATED_GYROSCOPE,            /**< Uncalibrated gyroscope sensor */
101         RRS_RESOURCE_UNCALIBRATED_MAGNETOMETER,         /**< Uncalibrated geomagnetic sensor */
102         RRS_RESOURCE_ALL
103 } rrs_resource_e;
104
105 /**
106  * @brief       Creates an RRS and assigns it with a handle.
107  * @details This function creates an RRS and issues a new handle for it.
108  * \n The handle is used to discover resources.
109  * @since_tizen 3.0
110  *
111  * @remarks @a rrs handle must be released using rrs_destroy().
112  *
113  * @param[out]  rrs             A handle of the newly created RRS
114  * @return      0 on success, otherwise a negative error value
115  * @retval      #RRS_ERROR_NONE Successful
116  * @retval      #RRS_ERROR_OUT_OF_MEMORY Out of memory
117  * @retval      #RRS_ERROR_INVALID_PARAMETER Invalid parameter
118  * @retval      #RRS_ERROR_PERMISSION_DENIED Permission Denied
119  *
120  * @see rrs_destroy()
121  */
122 int rrs_create(rrs_h *rrs);
123
124
125 /**
126  * @brief       Destroys the RRS handle.
127  * @details This function releases the RRS handle.
128  * @since_tizen 3.0
129  *
130  * @param[in]   rrs             The RRS handle to destroy
131  * @return      0 on success, otherwise a negative error value
132  * @retval      #RRS_ERROR_NONE Successful
133  * @retval      #RRS_ERROR_INVALID_PARAMETER Invalid parameter
134  * @retval      #RRS_ERROR_NOT_SUPPORTED Not supported
135  *
136  * @pre Call rrs_create() to create RRS and get its handle.
137  *
138  * @see rrs_create()
139  */
140 int rrs_destroy(const rrs_h rrs);
141
142
143 #ifdef __cplusplus
144 }
145 #endif
146 /**
147  * @}
148  */
149
150 #endif  /* _RRS_MAIN_H_ */