Base patch (skeleton code)
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_custom.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_custom_aps_send(ZigbeeCustom *custom_object,
22         GDBusMethodInvocation *invocation,
23         gshort node_id,
24         gchar aps_frame_ctrl,
25         gchar src_ep,
26         gchar dst_ep,
27         gshort cluster_id,
28         gshort profile_id,
29         gchar zcl_frame_ctrl,
30         gshort mfg_code,
31         GVariant *payload,
32         gpointer user_data)
33 {
34         ZigBeeService *service = (ZigBeeService *)user_data;
35
36         NOT_USED(custom_object);
37         NOT_USED(invocation);
38         NOT_USED(service);
39         NOT_USED(node_id);
40         NOT_USED(aps_frame_ctrl);
41         NOT_USED(src_ep);
42         NOT_USED(dst_ep);
43         NOT_USED(cluster_id);
44         NOT_USED(profile_id);
45         NOT_USED(zcl_frame_ctrl);
46         NOT_USED(mfg_code);
47         NOT_USED(payload);
48
49         /*
50          * TODO -
51          * Create and send request for processing
52          */
53
54         return TRUE;
55 }
56
57 static gboolean on_custom_zcl_send(ZigbeeCustom *custom_object,
58         GDBusMethodInvocation *invocation,
59         gshort node_id,
60         gchar src_ep,
61         gchar dst_ep,
62         gshort cluster_id,
63         gchar zcl_frame_ctrl,
64         gchar cmd_id,
65         GVariant *payload,
66         gpointer user_data)
67 {
68         ZigBeeService *service = (ZigBeeService *)user_data;
69
70         NOT_USED(custom_object);
71         NOT_USED(invocation);
72         NOT_USED(service);
73         NOT_USED(node_id);
74         NOT_USED(src_ep);
75         NOT_USED(dst_ep);
76         NOT_USED(cluster_id);
77         NOT_USED(zcl_frame_ctrl);
78         NOT_USED(cmd_id);
79         NOT_USED(payload);
80
81         /*
82          * TODO -
83          * Create and send request for processing
84          */
85
86         return TRUE;
87 }
88
89 static gboolean on_custom_send_to_local(ZigbeeCustom *custom_object,
90         GDBusMethodInvocation *invocation,
91         GVariant *data,
92         gpointer user_data)
93 {
94         ZigBeeService *service = (ZigBeeService *)user_data;
95
96         NOT_USED(custom_object);
97         NOT_USED(invocation);
98         NOT_USED(service);
99         NOT_USED(data);
100
101         /*
102          * TODO -
103          * Create and send request for processing
104          */
105
106         return TRUE;
107 }
108
109 gboolean zigbee_service_dbus_interface_custom_init(ZigBeeService *service,
110         ZigbeeObjectSkeleton *zigbee_object)
111 {
112         ZigbeeCustom *custom_object;
113
114         if (NULL == service) {
115                 Z_LOGE("service is NULL");
116                 return FALSE;
117         }
118
119         custom_object = zigbee_custom_skeleton_new();
120         zigbee_object_skeleton_set_custom(zigbee_object, custom_object);
121         g_object_unref(custom_object);
122
123         Z_LOGI("custom_object: [%p]", custom_object);
124
125         /*
126          * Register signal handlers for 'custom' interface
127          */
128         g_signal_connect(custom_object,
129                 "handle-aps-send",
130                 G_CALLBACK(on_custom_aps_send), service);
131
132         g_signal_connect(custom_object,
133                 "handle-zcl-send",
134                 G_CALLBACK(on_custom_zcl_send), service);
135
136         g_signal_connect(custom_object,
137                 "handle-send-to-local",
138                 G_CALLBACK(on_custom_send_to_local), service);
139
140         return TRUE;
141 }