2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef _RRS_CONTROL_DATA_H_
19 #define _RRS_CONTROL_DATA_H_
24 * @ingroup CAPI_RRS_CLIENT
25 * @defgroup CAPI_RRS_CONTROL_DATA_MODULE Control data
27 * @file rrs_control_data.h
28 * @brief This file contains the RRS Control Data API
29 * @addtogroup CAPI_RRS_CONTROL_DATA_MODULE
31 * @brief This provides APIs related to control data handling
40 * @brief Handle of control data.
41 * @details The handle to generate control data for controlling remote resource.
44 * @remarks To release the handle use rrs_control_data_destroy().
46 * @see rrs_control_data_destroy()
48 typedef void * rrs_control_data_h;
52 * @brief Creates an instance of structured control data.
53 * @details This function creates an instance of structured control data and issues a new handle for it.
56 * @remarks @a data handle must be released using rrs_control_data_destroy().
58 * @param[in] type Resource type
59 * @param[out] data The handle of newly created data instance
60 * @return 0 on success, otherwise a negative error value
61 * @retval #RRS_ERROR_NONE Successful
62 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
63 * @retval #RRS_ERROR_INVALID_TYPE Invalid type
64 * @retval #RRS_ERROR_OUT_OF_MEMORY Out of memory
66 * @see rrs_control_data_destroy()
67 * @see rrs_control_data_clone()
70 int rrs_control_data_create(const rrs_resource_e type,
71 rrs_control_data_h *data);
75 * @brief Destroys the data handle.
76 * @details This function releases the data handle.
79 * @param[in] data The data handle to destroy
80 * @return 0 on success, otherwise a negative error value
81 * @retval #RRS_ERROR_NONE Successful
82 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
84 * @pre @a data handle is created with rrs_control_data_create() functions.
86 * @see rrs_control_data_create()
87 * @see rrs_control_data_clone()
89 int rrs_control_data_destroy(rrs_control_data_h data);
93 * @brief Clones the data handle.
94 * @details This function clones the structured data handle @a origin.
97 * @remarks @a cloned must be released using rrs_control_data_destroy().
99 * @param[in] origin The original data handle
100 * @param[out] cloned A cloned data handle
101 * @return 0 on success, otherwise a negative error data
102 * @retval #RRS_ERROR_NONE Successful
103 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
104 * @retval #RRS_ERROR_OUT_OF_MEMORY Out of memory
106 * @see rrs_control_data_create()
107 * @see rrs_control_data_destroy()
109 int rrs_control_data_clone(const rrs_control_data_h origin,
110 rrs_control_data_h *cloned);
114 * @brief Sets boolean field value.
115 * @details This function sets the boolean field value.
118 * @param[in] data The data handle
119 * @param[in] name The name of the field
120 * @param[in] value The value of the field
121 * @return 0 on success, otherwise a negative error value
122 * @retval #RRS_ERROR_NONE Successful
123 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
125 * @pre @a data handle is created with rrs_control_data_create() functions.
127 * @see rrs_control_data_create()
128 * @see rrs_resource_send_control()
130 int rrs_control_data_set_bool(rrs_control_data_h data,
136 * @brief Sets integer field value.
137 * @details This function sets the integer field value.
140 * @param[in] data The data handle
141 * @param[in] name The name of the field
142 * @param[in] value The value of the field
143 * @return 0 on success, otherwise a negative error value
144 * @retval #RRS_ERROR_NONE Successful
145 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
147 * @pre @a data handle is created with rrs_control_data_create() functions.
149 * @see rrs_control_data_create()
150 * @see rrs_resource_send_control()
152 int rrs_control_data_set_int(rrs_control_data_h data,
158 * @brief Sets floating point field value.
159 * @details This function sets the floating point field value.
162 * @param[in] data The data handle
163 * @param[in] name The name of the field
164 * @param[in] value The value of the field
165 * @return 0 on success, otherwise a negative error value
166 * @retval #RRS_ERROR_NONE Successful
167 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
169 * @pre @a data handle is created with rrs_control_data_create() functions.
171 * @see rrs_control_data_create()
172 * @see rrs_resource_send_control()
174 int rrs_control_data_set_double(rrs_control_data_h data,
180 * @brief Sets string field value.
181 * @details This function sets the string field value.
184 * @param[in] data The data handle
185 * @param[in] name The name of the field
186 * @param[in] value The value of the field
187 * @return 0 on success, otherwise a negative error value
188 * @retval #RRS_ERROR_NONE Successful
189 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
191 * @pre @a data handle is created with rrs_control_data_create() functions.
193 * @see rrs_control_data_create()
194 * @see rrs_resource_send_control()
196 int rrs_control_data_set_string(rrs_control_data_h data,
202 * @brief Gets boolean field value.
203 * @details This function gets the boolean field value.
206 * @param[in] data The data handle
207 * @param[in] name The name of the field
208 * @param[out] value The pointer to bool in which to store the
210 * @return 0 on success, otherwise a negative error value
211 * @retval #RRS_ERROR_NONE Successful
212 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
214 * @pre @a data handle is created with rrs_control_data_create() functions.
216 * @see rrs_control_data_create()
217 * @see rrs_resource_monitor_control()
219 int rrs_control_data_get_bool(const rrs_control_data_h data,
225 * @brief Gets integer field value.
226 * @details This function gets the integer field value.
229 * @param[in] data The data handle
230 * @param[in] name The name of the field
231 * @param[out] value The pointer to int in which to store the
233 * @return 0 on success, otherwise a negative error value
234 * @retval #RRS_ERROR_NONE Successful
235 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
237 * @pre @a data handle is created with rrs_control_data_create() functions.
239 * @see rrs_control_data_create()
240 * @see rrs_resource_monitor_control()
242 int rrs_control_data_get_int(const rrs_control_data_h data,
248 * @brief Gets floating point field value.
249 * @details This function gets the floating point field value.
252 * @param[in] data The data handle
253 * @param[in] name The name of the field
254 * @param[out] value The pointer to double in which to store the
256 * @return 0 on success, otherwise a negative error value
257 * @retval #RRS_ERROR_NONE Successful
258 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
260 * @pre @a data handle is created with rrs_control_data_create() functions.
262 * @see rrs_control_data_create()
263 * @see rrs_resource_monitor_control()
265 int rrs_control_data_get_double(const rrs_control_data_h data,
271 * @brief Gets string field value.
272 * @details This function gets the sting field value.
275 * @remarks Release the value @a value using free().
277 * @param[in] data The data handle
278 * @param[in] name The name of the field
279 * @param[out] value The pointer to char * in which to store the
281 * @return 0 on success, otherwise a negative error value
282 * @retval #RRS_ERROR_NONE Successful
283 * @retval #RRS_ERROR_INVALID_PARAMETER Invalid parameter
285 * @pre @a data handle is created with rrs_control_data_create() functions.
287 * @see rrs_control_data_create()
288 * @see rrs_resource_monitor_control()
290 int rrs_control_data_get_string(const rrs_control_data_h data,
301 #endif /* _RRS_CONTROL_DATA_H_ */