Base patch (skeleton code)
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_thermostat.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_thermostat_get_local_temp(ZigbeeThermostat *thermostat_object,
22         GDBusMethodInvocation *invocation,
23         GVariant *eui64,
24         gchar endpoint,
25         gpointer user_data)
26 {
27         ZigBeeService *service = (ZigBeeService *)user_data;
28
29         NOT_USED(thermostat_object);
30         NOT_USED(invocation);
31         NOT_USED(service);
32         NOT_USED(eui64);
33         NOT_USED(endpoint);
34
35         /*
36          * TODO -
37          * Create and send request for processing
38          */
39
40         return TRUE;
41 }
42
43 static gboolean on_thermostat_get_weekly_schedule(ZigbeeThermostat *thermostat_object,
44         GDBusMethodInvocation *invocation,
45         GVariant *eui64,
46         gchar endpoint,
47         gchar no_of_days,
48         gchar mode,
49         gpointer user_data)
50 {
51         ZigBeeService *service = (ZigBeeService *)user_data;
52
53         NOT_USED(thermostat_object);
54         NOT_USED(invocation);
55         NOT_USED(service);
56         NOT_USED(eui64);
57         NOT_USED(endpoint);
58         NOT_USED(no_of_days);
59         NOT_USED(mode);
60
61         /*
62          * TODO -
63          * Create and send request for processing
64          */
65
66         return TRUE;
67 }
68
69 static gboolean on_thermostat_set_weekly_schedule(ZigbeeThermostat *thermostat_object,
70         GDBusMethodInvocation *invocation,
71         GVariant *eui64,
72         gchar endpoint,
73         gchar no_of_transitions,
74         gchar no_of_days,
75         gchar mode,
76         GVariant *payload,
77         gchar payload_len,
78         gpointer user_data)
79 {
80         ZigBeeService *service = (ZigBeeService *)user_data;
81
82         NOT_USED(thermostat_object);
83         NOT_USED(invocation);
84         NOT_USED(service);
85         NOT_USED(eui64);
86         NOT_USED(endpoint);
87         NOT_USED(no_of_transitions);
88         NOT_USED(no_of_days);
89         NOT_USED(mode);
90         NOT_USED(payload);
91         NOT_USED(payload_len);
92
93         /*
94          * TODO -
95          * Create and send request for processing
96          */
97
98         return TRUE;
99 }
100
101 static gboolean on_thermostat_clear_weekly_schedule(ZigbeeThermostat *thermostat_object,
102         GDBusMethodInvocation *invocation,
103         GVariant *eui64,
104         gchar endpoint,
105         gpointer user_data)
106 {
107         ZigBeeService *service = (ZigBeeService *)user_data;
108
109         NOT_USED(thermostat_object);
110         NOT_USED(invocation);
111         NOT_USED(service);
112         NOT_USED(eui64);
113         NOT_USED(endpoint);
114
115         /*
116          * TODO -
117          * Create and send request for processing
118          */
119
120         return TRUE;
121 }
122
123 static gboolean on_thermostat_setpoint_raise_lower(ZigbeeThermostat *thermostat_object,
124         GDBusMethodInvocation *invocation,
125         gshort node_id,
126         gchar endpoint,
127         gchar mode,
128         gchar amount,
129         gpointer user_data)
130 {
131         ZigBeeService *service = (ZigBeeService *)user_data;
132
133         NOT_USED(thermostat_object);
134         NOT_USED(invocation);
135         NOT_USED(service);
136         NOT_USED(node_id);
137         NOT_USED(endpoint);
138         NOT_USED(mode);
139         NOT_USED(amount);
140
141         /*
142          * TODO -
143          * Create and send request for processing
144          */
145
146         return TRUE;
147 }
148
149 gboolean zigbee_service_dbus_interface_thermostat_init(ZigBeeService *service,
150         ZigbeeObjectSkeleton *zigbee_object)
151 {
152         ZigbeeThermostat *thermostat_object;
153
154         if (NULL == service) {
155                 Z_LOGE("service is NULL");
156                 return FALSE;
157         }
158
159         thermostat_object = zigbee_thermostat_skeleton_new();
160         zigbee_object_skeleton_set_thermostat(zigbee_object, thermostat_object);
161         g_object_unref(thermostat_object);
162
163         Z_LOGI("thermostat_object: [%p]", thermostat_object);
164
165         /*
166          * Register signal handlers for 'thermostat' interface
167          */
168         g_signal_connect(thermostat_object,
169                 "handle-get-local-temp",
170                 G_CALLBACK(on_thermostat_get_local_temp), service);
171
172         g_signal_connect(thermostat_object,
173                 "handle-get-weekly-schedule",
174                 G_CALLBACK(on_thermostat_get_weekly_schedule), service);
175
176         g_signal_connect(thermostat_object,
177                 "handle-set-weekly-schedule",
178                 G_CALLBACK(on_thermostat_set_weekly_schedule), service);
179
180         g_signal_connect(thermostat_object,
181                 "handle-clear-weekly-schedule",
182                 G_CALLBACK(on_thermostat_clear_weekly_schedule), service);
183
184         g_signal_connect(thermostat_object,
185                 "handle-setpoint-raise-lower",
186                 G_CALLBACK(on_thermostat_setpoint_raise_lower), service);
187
188         return TRUE;
189 }