2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Contact: Suresh Kumar N (suresh.n@samsung.com)
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include "zigbee_service_interface_common.h"
21 static gboolean on_zcl_color_move_to_hue(ZigbeeZcl_color *zcl_color_object,
22 GDBusMethodInvocation *invocation,
29 ZigBeeService *service = (ZigBeeService *)user_data;
31 NOT_USED(zcl_color_object);
41 * Create and send request for processing
47 static gboolean on_zcl_color_move_hue(ZigbeeZcl_color *zcl_color_object,
48 GDBusMethodInvocation *invocation,
55 ZigBeeService *service = (ZigBeeService *)user_data;
57 NOT_USED(zcl_color_object);
67 * Create and send request for processing
73 static gboolean on_zcl_color_step_hue(ZigbeeZcl_color *zcl_color_object,
74 GDBusMethodInvocation *invocation,
79 gchar transition_time,
82 ZigBeeService *service = (ZigBeeService *)user_data;
84 NOT_USED(zcl_color_object);
91 NOT_USED(transition_time);
95 * Create and send request for processing
101 static gboolean on_zcl_color_move_to_saturation(ZigbeeZcl_color *zcl_color_object,
102 GDBusMethodInvocation *invocation,
106 gshort transition_time,
109 ZigBeeService *service = (ZigBeeService *)user_data;
111 NOT_USED(zcl_color_object);
112 NOT_USED(invocation);
116 NOT_USED(saturation);
117 NOT_USED(transition_time);
121 * Create and send request for processing
127 static gboolean on_zcl_color_move_saturation(ZigbeeZcl_color *zcl_color_object,
128 GDBusMethodInvocation *invocation,
135 ZigBeeService *service = (ZigBeeService *)user_data;
137 NOT_USED(zcl_color_object);
138 NOT_USED(invocation);
147 * Create and send request for processing
153 static gboolean on_zcl_color_step_saturation(ZigbeeZcl_color *zcl_color_object,
154 GDBusMethodInvocation *invocation,
159 gchar transition_time,
162 ZigBeeService *service = (ZigBeeService *)user_data;
164 NOT_USED(zcl_color_object);
165 NOT_USED(invocation);
171 NOT_USED(transition_time);
175 * Create and send request for processing
181 static gboolean on_zcl_color_move_to_hue_and_saturation(ZigbeeZcl_color *zcl_color_object,
182 GDBusMethodInvocation *invocation,
187 gshort transition_time,
190 ZigBeeService *service = (ZigBeeService *)user_data;
192 NOT_USED(zcl_color_object);
193 NOT_USED(invocation);
198 NOT_USED(saturation);
199 NOT_USED(transition_time);
203 * Create and send request for processing
209 static gboolean on_zcl_color_move_to_color(ZigbeeZcl_color *zcl_color_object,
210 GDBusMethodInvocation *invocation,
215 gshort transition_time,
218 ZigBeeService *service = (ZigBeeService *)user_data;
220 NOT_USED(zcl_color_object);
221 NOT_USED(invocation);
227 NOT_USED(transition_time);
231 * Create and send request for processing
237 static gboolean on_zcl_color_move_color(ZigbeeZcl_color *zcl_color_object,
238 GDBusMethodInvocation *invocation,
245 ZigBeeService *service = (ZigBeeService *)user_data;
247 NOT_USED(zcl_color_object);
248 NOT_USED(invocation);
257 * Create and send request for processing
263 static gboolean on_zcl_color_step_color(ZigbeeZcl_color *zcl_color_object,
264 GDBusMethodInvocation *invocation,
269 gshort transition_time,
272 ZigBeeService *service = (ZigBeeService *)user_data;
274 NOT_USED(zcl_color_object);
275 NOT_USED(invocation);
281 NOT_USED(transition_time);
285 * Create and send request for processing
291 static gboolean on_zcl_color_move_color_temperature(ZigbeeZcl_color *zcl_color_object,
292 GDBusMethodInvocation *invocation,
295 gshort color_temperature,
296 gshort transition_time,
299 ZigBeeService *service = (ZigBeeService *)user_data;
301 NOT_USED(zcl_color_object);
302 NOT_USED(invocation);
306 NOT_USED(color_temperature);
307 NOT_USED(transition_time);
311 * Create and send request for processing
317 gboolean zigbee_service_dbus_interface_zcl_color_init(ZigBeeService *service,
318 ZigbeeObjectSkeleton *zigbee_object)
320 ZigbeeZcl_color *zcl_color_object;
322 if (NULL == service) {
323 Z_LOGE("service is NULL");
327 zcl_color_object = zigbee_zcl_color_skeleton_new();
328 zigbee_object_skeleton_set_zcl_color(zigbee_object, zcl_color_object);
329 g_object_unref(zcl_color_object);
331 Z_LOGI("zcl_color_object: [%p]", zcl_color_object);
334 * Register signal handlers for 'zcl_color' interface
336 g_signal_connect(zcl_color_object,
337 "handle-move-to-hue",
338 G_CALLBACK(on_zcl_color_move_to_hue), service);
340 g_signal_connect(zcl_color_object,
342 G_CALLBACK(on_zcl_color_move_hue), service);
344 g_signal_connect(zcl_color_object,
346 G_CALLBACK(on_zcl_color_step_hue), service);
348 g_signal_connect(zcl_color_object,
349 "handle-move-to-saturation",
350 G_CALLBACK(on_zcl_color_move_to_saturation), service);
352 g_signal_connect(zcl_color_object,
353 "handle-move-saturation",
354 G_CALLBACK(on_zcl_color_move_saturation), service);
356 g_signal_connect(zcl_color_object,
357 "handle-step-saturation",
358 G_CALLBACK(on_zcl_color_step_saturation), service);
360 g_signal_connect(zcl_color_object,
361 "handle-move-to-hue-and-saturation",
362 G_CALLBACK(on_zcl_color_move_to_hue_and_saturation), service);
364 g_signal_connect(zcl_color_object,
365 "handle-move-to-color",
366 G_CALLBACK(on_zcl_color_move_to_color), service);
368 g_signal_connect(zcl_color_object,
370 G_CALLBACK(on_zcl_color_move_color), service);
372 g_signal_connect(zcl_color_object,
374 G_CALLBACK(on_zcl_color_step_color), service);
376 g_signal_connect(zcl_color_object,
377 "handle-move-color-temperature",
378 G_CALLBACK(on_zcl_color_move_color_temperature), service);