Add 3.0 APIs and sync APIs same as 2.4
[platform/core/convergence/service-adaptor.git] / adaptor / resource-adaptor / resource_adaptor.h
1 /*
2  * Resource Adaptor
3  *
4  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __RESOURCE_ADAPTOR_H__
21 #define __RESOURCE_ADAPTOR_H__
22
23 #ifndef API
24 #define API __attribute__ ((visibility("default")))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <stdio.h>
33 #include <glib.h>
34
35 #include "service_adaptor_errors.h"
36
37 /**
38  * @file resource_adaptor.h
39  */
40
41 /**
42  * @ingroup
43  * @defgroup
44  *
45  * @brief
46  *
47  * @section
48  *  \#include <resource_adaptor.h>
49  *
50  * <BR>
51  * @{
52  */
53
54 /**
55  * @brief Handle of Resource Plugin
56  */
57 typedef struct resource_plugin_s *resource_plugin_h;
58
59 /**
60  * @brief Describes infromation about SmartThings Service
61  * @key access token, ...
62  */
63  typedef struct _resource_plugin_smartthings_service_s
64  {
65         int (*smartthings_get_resource)(resource_plugin_h plugin, char **resource_uri, void *user_data);
66  } resource_plugin_smartthings_service_s;
67  typedef struct resource_plugin_smartthings_service_s *resource_plugin_smartthings_service_h;
68
69 /**
70  * @brief Describes infromation about Resource Plugin
71  */
72 typedef struct _resource_plugin_s
73 {
74         char *uri;
75         char *name;
76
77         resource_plugin_smartthings_service_h smartthings;
78
79         GMutex mutex;
80         int start;
81 } resource_plugin_s;
82
83 /**
84  * @brief Describes infromation about Resource Adaptor
85  */
86 typedef struct _resource_adaptor_s
87 {
88         GList *plugins;         // resource_plugin_h
89
90         GMutex mutex;
91         int start;
92 } resource_adaptor_s;
93 typedef struct resource_adaptor_s *resource_adaptor_h;
94
95 /**
96  * @brief Describes infromation about Resource Adaptor Listener
97  */
98 typedef struct _resource_adaptor_listener_s
99 {
100         void (*login_cb)(char *uri, void *user_data);
101 } resource_adaptor_listener_s;
102 typedef struct resource_adaptor_listener_s *resource_adaptor_listener_h;
103
104 resource_adaptor_h resource_adaptor_create();
105 service_adaptor_error_e resource_adaptor_destroy(resource_adaptor_h resource);
106 service_adaptor_error_e resource_adaptor_start(resource_adaptor_h resource);
107 service_adaptor_error_e resource_adaptor_stop(resource_adaptor_h resource);
108 service_adaptor_error_e resource_adaptor_register_listener(resource_adaptor_h resource, resource_adaptor_listener_h listener);
109 service_adaptor_error_e resource_adaptor_unregister_listener(resource_adaptor_h resource, resource_adaptor_listener_h listener);
110
111 /**
112  * @}
113  */
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif /* __RESOURCE_ADAPTOR_H__ */