Fix custom cluster to meet zigbee-daemon GDbus interface
[platform/core/api/zigbee.git] / lib / zbl-custom.c
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <glib.h>
18 #include <errno.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <zb-log.h>
22 #include <zb-common.h>
23 #include <zb-custom.h>
24
25 #include "zbl.h"
26 #include "zbl-dbus.h"
27 #include "zigbee.h"
28
29 API int zb_aps_send(zigbee_h handle, nwk_addr addr16, unsigned char aps_frame_ctl,
30                 unsigned char src_ep, unsigned char dst_ep, unsigned short cluster_id,
31                 unsigned short profile_id, unsigned char zcl_frame_ctl, unsigned short mfg_code,
32                 unsigned char cmd_id, unsigned short payload_len, unsigned char *payload,
33                 zb_aps_send_rsp cb, void *user_data)
34 {
35         int ret = ZIGBEE_ERROR_NONE;
36         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
37
38         ret = zbl_aps_send(addr16, aps_frame_ctl, src_ep, dst_ep, cluster_id, profile_id,
39                 zcl_frame_ctl, mfg_code, cmd_id, payload_len, payload, cb, user_data);
40         DBG("zbl_aps_send()=0x%X", ret);
41         return ret;
42 }
43
44 API int zb_zcl_send(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
45                 unsigned char dst_ep, unsigned short cluster_id, unsigned char zcl_frame_ctl,
46                 unsigned char cmd, unsigned short payload_len, unsigned char *payload,
47                 zb_zcl_send_rsp cb, void *user_data)
48 {
49         int ret = ZIGBEE_ERROR_NONE;
50         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
51
52         ret = zbl_zcl_send(addr16, src_ep, dst_ep, cluster_id, zcl_frame_ctl,
53                                 cmd, payload_len, payload, cb, user_data);
54         DBG("zbl_zcl_send()=0x%X", ret);
55         return ret;
56 }
57
58 API int zb_send_to_local(zigbee_h handle, unsigned short length, unsigned char *data,
59                 zb_send_to_local_rsp cb, void *user_data)
60 {
61         int ret = ZIGBEE_ERROR_NONE;
62         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
63
64         ret = zbl_send_to_local(length, data, cb, user_data);
65         DBG("zbl_send_to_local()=0x%X", ret);
66         return ret;
67 }