Fixed ACR issue.
[platform/core/api/zigbee.git] / src / 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
24 #include "zbl.h"
25 #include "zbl-dbus.h"
26 #include "zigbee.h"
27
28 API int zb_aps_send(zb_zigbee_h handle, zb_nwk_addr addr16, unsigned char aps_fc,
29         unsigned char src_ep, unsigned char dst_ep, unsigned short clusterid,
30         unsigned short profileid, unsigned char zcl_fc, unsigned short mfg_code,
31         unsigned char cmd_id, unsigned short payload_len, unsigned char *payload,
32         zb_aps_send_cb cb, void *user_data)
33 {
34         CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
35
36         int ret = ZIGBEE_ERROR_NONE;
37         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
38
39         ret = zbl_aps_send(addr16, aps_fc, src_ep, dst_ep, clusterid, profileid,
40                 zcl_fc, mfg_code, cmd_id, payload_len, payload, cb, user_data);
41         DBG("zbl_aps_send()=0x%X", ret);
42         return ret;
43 }
44
45 API int zb_zcl_send(zb_zigbee_h handle, zb_nwk_addr addr16, unsigned char src_ep,
46         unsigned char dst_ep, zb_cluster_id clusterid, unsigned char zcl_fc,
47         unsigned char cmd, unsigned short payload_len, unsigned char *payload,
48         zb_zcl_send_cb cb, void *user_data)
49 {
50         CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
51
52         int ret = ZIGBEE_ERROR_NONE;
53         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
54
55         ret = zbl_zcl_send(addr16, src_ep, dst_ep, clusterid, zcl_fc,
56                                 cmd, payload_len, payload, cb, user_data);
57         DBG("zbl_zcl_send()=0x%X", ret);
58         return ret;
59 }
60
61 API int zb_send_to_local(zb_zigbee_h handle, unsigned short length,
62         unsigned char *data, zb_send_to_local_cb cb, void *user_data)
63 {
64         CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
65
66         int ret = ZIGBEE_ERROR_NONE;
67         RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
68
69         ret = zbl_send_to_local(length, data, cb, user_data);
70         DBG("zbl_send_to_local()=0x%X", ret);
71         return ret;
72 }