Modify to connect only one infrared motion sensor & Fixed an issue the CBOR file...
[apps/native/position-finder-server.git] / inc / connectivity.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Contact: Jin Yoon <jinny.yoon@samsung.com>
5  *          Geunsun Lee <gs86.lee@samsung.com>
6  *          Eunyoung Lee <ey928.lee@samsung.com>
7  *          Junkyu Han <junkyu.han@samsung.com>
8  *
9  * Licensed under the Flora License, Version 1.1 (the License);
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://floralicense.org/license/
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an AS IS BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 #ifndef __POSITION_FINDER_CONNECTIVITY_H__
23 #define __POSITION_FINDER_CONNECTIVITY_H__
24
25 #include <iotcon.h>
26
27 #include "connectivity_internal.h"
28
29 struct connectivity_resource {
30         iotcon_resource_h res;
31         iotcon_observers_h observers;
32 };
33
34 typedef struct connectivity_resource connectivity_resource_s;
35
36 /**
37  * @brief Create connectivity resource and registers the resource in server.
38  * @param[in] uri_path The URI path of the resource
39  * @param[in] type The string data to insert into the resource types (e.g. "org.tizen.light")
40  * @param[out] out_resource_info A structure containing information about connectivity resource
41  * @return 0 on success, otherwise a negative error value
42  * @see uri_path length must be less than 128.
43  * @see You must destroy resource by calling connectivity_unset_resource() if resource is no longer needed.
44  */
45 extern int connectivity_set_resource(const char *uri_path, const char *type, connectivity_resource_s **out_resource_info);
46
47 /**
48  * @brief Releases all resource about connectivity.
49  * @param[in] resource_info A structure containing information about connectivity resource
50  */
51 extern void connectivity_unset_resource(connectivity_resource_s *resource);
52
53 /**
54  * @brief Notifies specific clients that resource's attributes have changed with boolean vaule.
55  * @param[in] resource_info A structure containing information about connectivity resource
56  * @param[in] key A new key to be added into attributes
57  * @param[in] value A boolean value to be added into attributes
58  * @return 0 on success, otherwise a negative error value
59  * @see If key is already exists, current value will be replaced with new value.
60  */
61 extern int connectivity_notify_bool(connectivity_resource_s *resource_info, const char *key, bool value);
62
63 /**
64  * @brief Notifies specific clients that resource's attributes have changed with int vaule.
65  * @param[in] resource_info A structure containing information about connectivity resource
66  * @param[in] key A new key to be added into attributes
67  * @param[in] value A int value to be added into attributes
68  * @return 0 on success, otherwise a negative error value
69  * @see If key is already exists, current value will be replaced with new value.
70  */
71 extern int connectivity_notify_int(connectivity_resource_s *resource_info, const char *key, int value);
72
73 /**
74  * @brief Notifies specific clients that resource's attributes have changed with double vaule.
75  * @param[in] resource_info A structure containing information about connectivity resource
76  * @param[in] key A new key to be added into attributes
77  * @param[in] value A double value to be added into attributes
78  * @return 0 on success, otherwise a negative error value
79  * @see If key is already exists, current value will be replaced with new value.
80  */
81 extern int connectivity_notify_double(connectivity_resource_s *resource_info, const char *key, double value);
82
83 #endif /* __POSITION_FINDER_CONNECTIVITY_H__ */