597da173672716c524216979df7aa166dce89fc9
[platform/core/api/zigbee.git] / test / zcl_cluster_basic.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
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <sys/time.h>
22 #include <unistd.h>
23 #include <glib.h>
24 #include <gio/gio.h>
25
26 #include <zigbee.h>
27
28 #include "main.h"
29 #include "menu.h"
30
31 extern zigbee_h  handle;
32
33 extern nwk_addr  dest_addr16;
34 extern simple_desc_s st_ep1;
35
36 static int run_reset_factory_default(MManager *mm, struct menu_data *menu)
37 {
38         int ret = ZIGBEE_ERROR_NONE;
39
40         ret = zb_zcl_basic_reset_factory_default(handle, dest_addr16, st_ep1.ep);
41         if (ZIGBEE_ERROR_NONE != ret) {
42                 msg("zb_zcl_basic_reset_factory_default(0x%X) - FAILED!!! [%s]", ret, zigbee_error_to_string(ret));
43                 return RET_FAILURE;
44         }
45
46         msg(" - zb_zcl_basic_reset_factory_default() ret: [0x%X] [%s]", ret, zigbee_error_to_string(ret));
47         msg("");
48
49         return RET_SUCCESS;
50 }
51
52 static struct menu_data _menu_reset_factory_default[] = {
53         { "1", "Run", NULL, run_reset_factory_default, NULL },
54         { NULL, NULL, },
55 };
56
57 struct menu_data menu_zcl_cluster_basic[] = {
58         { "1", "zb_zcl_basic_reset_factory_default",
59                         _menu_reset_factory_default, NULL, NULL },
60         { NULL, NULL, },
61 };