c7cb20f383ea81be76e0287fc12f826f4a25e118
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_level_control.c
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Contact: Suresh Kumar N (suresh.n@samsung.com)
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 #include "zigbee_service_interface_common.h"
20
21 static gboolean on_level_control_move_to_level(ZigbeeLevel_control *level_control_object,
22         GDBusMethodInvocation *invocation,
23         gshort node_id,
24         gchar endpoint,
25         gchar level,
26         gshort transition,
27         gpointer user_data)
28 {
29         ZigBeeService *service = (ZigBeeService *)user_data;
30
31         NOT_USED(level_control_object);
32         NOT_USED(invocation);
33         NOT_USED(service);
34         NOT_USED(node_id);
35         NOT_USED(endpoint);
36         NOT_USED(level);
37         NOT_USED(transition);
38
39         /*
40          * TODO -
41          * Create and send request for processing
42          */
43
44         return TRUE;
45 }
46
47 static gboolean on_level_control_move(ZigbeeLevel_control *level_control_object,
48         GDBusMethodInvocation *invocation,
49         gshort node_id,
50         gchar endpoint,
51         gchar move_mode,
52         gchar rate,
53         gpointer user_data)
54 {
55         ZigBeeService *service = (ZigBeeService *)user_data;
56
57         NOT_USED(level_control_object);
58         NOT_USED(invocation);
59         NOT_USED(service);
60         NOT_USED(node_id);
61         NOT_USED(endpoint);
62         NOT_USED(move_mode);
63         NOT_USED(rate);
64
65         /*
66          * TODO -
67          * Create and send request for processing
68          */
69
70         return TRUE;
71 }
72
73 static gboolean on_level_control_step(ZigbeeLevel_control *level_control_object,
74         GDBusMethodInvocation *invocation,
75         gshort node_id,
76         gchar endpoint,
77         gchar step_mode,
78         gchar move_mode,
79         gshort transition_time,
80         gpointer user_data)
81 {
82         ZigBeeService *service = (ZigBeeService *)user_data;
83
84         NOT_USED(level_control_object);
85         NOT_USED(invocation);
86         NOT_USED(service);
87         NOT_USED(node_id);
88         NOT_USED(endpoint);
89         NOT_USED(step_mode);
90         NOT_USED(move_mode);
91         NOT_USED(transition_time);
92
93         /*
94          * TODO -
95          * Create and send request for processing
96          */
97
98         return TRUE;
99 }
100
101 static gboolean on_level_control_move_to_level_with_on_off(ZigbeeLevel_control *level_control_object,
102         GDBusMethodInvocation *invocation,
103         gshort node_id,
104         gchar endpoint,
105         gchar level,
106         gshort transition,
107         gpointer user_data)
108 {
109         ZigBeeService *service = (ZigBeeService *)user_data;
110
111         NOT_USED(level_control_object);
112         NOT_USED(invocation);
113         NOT_USED(service);
114         NOT_USED(node_id);
115         NOT_USED(endpoint);
116         NOT_USED(level);
117         NOT_USED(transition);
118
119         /*
120          * TODO -
121          * Create and send request for processing
122          */
123
124         return TRUE;
125 }
126
127 static gboolean on_level_control_move_with_on_off(ZigbeeLevel_control *level_control_object,
128         GDBusMethodInvocation *invocation,
129         gshort node_id,
130         gchar endpoint,
131         gchar move_mode,
132         gchar rate,
133         gpointer user_data)
134 {
135         ZigBeeService *service = (ZigBeeService *)user_data;
136
137         NOT_USED(level_control_object);
138         NOT_USED(invocation);
139         NOT_USED(service);
140         NOT_USED(node_id);
141         NOT_USED(endpoint);
142         NOT_USED(move_mode);
143         NOT_USED(rate);
144
145         /*
146          * TODO -
147          * Create and send request for processing
148          */
149
150         return TRUE;
151 }
152
153 static gboolean on_level_control_step_with_on_off(ZigbeeLevel_control *level_control_object,
154         GDBusMethodInvocation *invocation,
155         gshort node_id,
156         gchar endpoint,
157         gchar step_mode,
158         gchar move_mode,
159         gshort transition_time,
160         gpointer user_data)
161 {
162         ZigBeeService *service = (ZigBeeService *)user_data;
163
164         NOT_USED(level_control_object);
165         NOT_USED(invocation);
166         NOT_USED(service);
167         NOT_USED(node_id);
168         NOT_USED(endpoint);
169         NOT_USED(step_mode);
170         NOT_USED(move_mode);
171         NOT_USED(transition_time);
172
173         /*
174          * TODO -
175          * Create and send request for processing
176          */
177
178         return TRUE;
179 }
180
181 static gboolean on_level_control_stop(ZigbeeLevel_control *level_control_object,
182         GDBusMethodInvocation *invocation,
183         gshort node_id,
184         gchar endpoint,
185         gpointer user_data)
186 {
187         ZigBeeService *service = (ZigBeeService *)user_data;
188
189         NOT_USED(level_control_object);
190         NOT_USED(invocation);
191         NOT_USED(service);
192         NOT_USED(node_id);
193         NOT_USED(endpoint);
194
195         /*
196          * TODO -
197          * Create and send request for processing
198          */
199
200         return TRUE;
201 }
202
203 gboolean zigbee_service_dbus_interface_level_control_init(ZigBeeService *service,
204         ZigbeeObjectSkeleton *zigbee_object)
205 {
206         ZigbeeLevel_control *level_control_object;
207
208         if (NULL == service) {
209                 Z_LOGE("service is NULL");
210                 return FALSE;
211         }
212
213         level_control_object = zigbee_level_control_skeleton_new();
214         zigbee_object_skeleton_set_level_control(zigbee_object, level_control_object);
215         g_object_unref(level_control_object);
216
217         Z_LOGI("level_control_object: [%p]", level_control_object);
218
219         /*
220          * Register signal handlers for 'level_control' interface
221          */
222         g_signal_connect(level_control_object,
223                 "handle-move-to-level",
224                 G_CALLBACK(on_level_control_move_to_level), service);
225
226         g_signal_connect(level_control_object,
227                 "handle-move",
228                 G_CALLBACK(on_level_control_move), service);
229
230         g_signal_connect(level_control_object,
231                 "handle-step",
232                 G_CALLBACK(on_level_control_step), service);
233
234         g_signal_connect(level_control_object,
235                 "handle-move-to-level-with-on-off",
236                 G_CALLBACK(on_level_control_move_to_level_with_on_off), service);
237
238         g_signal_connect(level_control_object,
239                 "handle-move-with-on-off",
240                 G_CALLBACK(on_level_control_move_with_on_off), service);
241
242         g_signal_connect(level_control_object,
243                 "handle-step-with-on-off",
244                 G_CALLBACK(on_level_control_step_with_on_off), service);
245
246         g_signal_connect(level_control_object,
247                 "handle-stop",
248                 G_CALLBACK(on_level_control_stop), service);
249
250         return TRUE;
251 }