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_thermostat_get_local_temp(ZigbeeThermostat *thermostat_object,
22 GDBusMethodInvocation *invocation,
27 ZigBeeService *service = (ZigBeeService *)user_data;
29 NOT_USED(thermostat_object);
37 * Create and send request for processing
43 static gboolean on_thermostat_get_weekly_schedule(ZigbeeThermostat *thermostat_object,
44 GDBusMethodInvocation *invocation,
51 ZigBeeService *service = (ZigBeeService *)user_data;
53 NOT_USED(thermostat_object);
63 * Create and send request for processing
69 static gboolean on_thermostat_set_weekly_schedule(ZigbeeThermostat *thermostat_object,
70 GDBusMethodInvocation *invocation,
73 gchar no_of_transitions,
80 ZigBeeService *service = (ZigBeeService *)user_data;
82 NOT_USED(thermostat_object);
87 NOT_USED(no_of_transitions);
91 NOT_USED(payload_len);
95 * Create and send request for processing
101 static gboolean on_thermostat_clear_weekly_schedule(ZigbeeThermostat *thermostat_object,
102 GDBusMethodInvocation *invocation,
107 ZigBeeService *service = (ZigBeeService *)user_data;
109 NOT_USED(thermostat_object);
110 NOT_USED(invocation);
117 * Create and send request for processing
123 static gboolean on_thermostat_setpoint_raise_lower(ZigbeeThermostat *thermostat_object,
124 GDBusMethodInvocation *invocation,
131 ZigBeeService *service = (ZigBeeService *)user_data;
133 NOT_USED(thermostat_object);
134 NOT_USED(invocation);
143 * Create and send request for processing
149 gboolean zigbee_service_dbus_interface_thermostat_init(ZigBeeService *service,
150 ZigbeeObjectSkeleton *zigbee_object)
152 ZigbeeThermostat *thermostat_object;
154 if (NULL == service) {
155 Z_LOGE("service is NULL");
159 thermostat_object = zigbee_thermostat_skeleton_new();
160 zigbee_object_skeleton_set_thermostat(zigbee_object, thermostat_object);
161 g_object_unref(thermostat_object);
163 Z_LOGI("thermostat_object: [%p]", thermostat_object);
166 * Register signal handlers for 'thermostat' interface
168 g_signal_connect(thermostat_object,
169 "handle-get-local-temp",
170 G_CALLBACK(on_thermostat_get_local_temp), service);
172 g_signal_connect(thermostat_object,
173 "handle-get-weekly-schedule",
174 G_CALLBACK(on_thermostat_get_weekly_schedule), service);
176 g_signal_connect(thermostat_object,
177 "handle-set-weekly-schedule",
178 G_CALLBACK(on_thermostat_set_weekly_schedule), service);
180 g_signal_connect(thermostat_object,
181 "handle-clear-weekly-schedule",
182 G_CALLBACK(on_thermostat_clear_weekly_schedule), service);
184 g_signal_connect(thermostat_object,
185 "handle-setpoint-raise-lower",
186 G_CALLBACK(on_thermostat_setpoint_raise_lower), service);