Modify gdbus structure(related to CRUD) and gvariant builder
[platform/core/iot/iotcon.git] / daemon / icd-ioty.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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 #ifndef __IOT_CONNECTIVITY_MANAGER_DAEMON_IOTIVITY_H__
17 #define __IOT_CONNECTIVITY_MANAGER_DAEMON_IOTIVITY_H__
18
19 #include <stdio.h>
20 #include <stdint.h>
21 #include <glib.h>
22
23 #include "iotcon.h"
24
25 #define ICD_IOTY_COAP "coap://"
26 #define ICD_IOTY_COAPS "coaps://"
27
28 typedef struct {
29         unsigned int signum;
30         char *bus_name;
31 } icd_sig_ctx_s;
32
33
34 void icd_ioty_csdk_lock();
35
36 void icd_ioty_csdk_unlock();
37
38 GThread* icd_ioty_init(const char *addr, unsigned short port);
39
40 void icd_ioty_deinit();
41
42 void* icd_ioty_register_resource(const char *uri_path, const char* const* res_types,
43                 int ifaces, uint8_t properties);
44
45 int icd_ioty_unregister_resource(void *resource_handle);
46
47 int icd_ioty_bind_interface(void *resource_handle, iotcon_interface_e iface);
48
49 int icd_ioty_bind_type(void *resource_handle, const char *resource_type);
50
51 int icd_ioty_bind_resource(void *parent, void *child);
52
53 int icd_ioty_unbind_resource(void *parent, void *child);
54
55 int icd_ioty_notify_list_of_observers(void *handle, GVariant *msg, GVariant *observers);
56
57 int icd_ioty_notify_all(void *handle);
58
59 int icd_ioty_send_response(GVariant *resp);
60
61 int icd_ioty_find_resource(const char *host_address, const char *resource_type,
62                 unsigned int signal_number, const char *bus_name);
63
64 void icd_ioty_get_complete(GDBusMethodInvocation *invocation, GVariant *value);
65 void icd_ioty_get_complete_error(GDBusMethodInvocation *invocation, int ret_val);
66 gboolean icd_ioty_get(icDbus *object, GDBusMethodInvocation *invocation,
67                 GVariant *resource, GVariant *query);
68
69 void icd_ioty_put_complete(GDBusMethodInvocation *invocation, GVariant *value);
70 void icd_ioty_put_complete_error(GDBusMethodInvocation *invocation, int ret_val);
71 gboolean icd_ioty_put(icDbus *object, GDBusMethodInvocation *invocation,
72                 GVariant *resource, const char *repr, GVariant *query);
73
74 void icd_ioty_post_complete(GDBusMethodInvocation *invocation, GVariant *value);
75 void icd_ioty_post_complete_error(GDBusMethodInvocation *invocation, int ret_val);
76 gboolean icd_ioty_post(icDbus *object, GDBusMethodInvocation *invocation,
77                 GVariant *resource, const char *repr, GVariant *query);
78
79 void icd_ioty_delete_complete(GDBusMethodInvocation *invocation, GVariant *value);
80 void icd_ioty_delete_complete_error(GDBusMethodInvocation *invocation, int ret_val);
81 gboolean icd_ioty_delete(icDbus *object, GDBusMethodInvocation *invocation,
82                 GVariant *resource);
83
84 int icd_ioty_observer_start(GVariant *resource, int observe_type, GVariant *query,
85                 unsigned int signal_number, const char *bus_name, int *observe_h);
86
87 int icd_ioty_observer_stop(void *observe_h);
88
89 #ifdef DEVICE_INFO_IMPL /* not implemented in iotivity 0.9.1 */
90 int icd_ioty_register_device_info(GVariant *value);
91
92 int icd_ioty_get_device_info(const char *host_address, unsigned int signal_number,
93                 const char *bus_name);
94 #endif
95
96 int icd_ioty_register_platform_info(GVariant *value);
97
98 int icd_ioty_get_platform_info(const char *host_address, unsigned int signal_number,
99                 const char *bus_name);
100
101 void* icd_ioty_subscribe_presence(const char *host_address, const char *resource_type,
102                 unsigned int signal_number, const char *bus_name);
103
104 int icd_ioty_unsubscribe_presence(void *presence_handle);
105
106 int icd_ioty_start_presence(unsigned int time_to_live);
107
108 int icd_ioty_stop_presence();
109
110 #endif /*__IOT_CONNECTIVITY_MANAGER_DAEMON_IOTIVITY_H__*/