From: saerome kim Date: Wed, 8 Feb 2017 06:48:58 +0000 (+0900) Subject: Implement IAS-Zone, Basic cluster test-cases X-Git-Tag: submit/tizen/20170512.045637~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5d4e18e517e9c25f93fdc148b9fc0a48e02b9d7;p=platform%2Fcore%2Fapi%2Fzigbee.git Implement IAS-Zone, Basic cluster test-cases Change-Id: Ia64069dd1282c3ed5bf8c4623e52f53a89842884 Signed-off-by: saerome kim --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 501363a..64fa5a6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,9 +23,11 @@ SET(NEW_SOURCES menu.c custom.c zcl-cluster-alarm.c + zcl-cluster-basic.c zcl-cluster-colorctrl.c zcl-cluster-group.c zcl-cluster-identity.c + zcl-cluster-ias-zone.c zcl-cluster-levelctrl.c zcl-cluster-onoff.c zcl-cluster-pollctrl.c diff --git a/test/zcl-cluster-basic.c b/test/zcl-cluster-basic.c new file mode 100644 index 0000000..49943d4 --- /dev/null +++ b/test/zcl-cluster-basic.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "main.h" +#include "menu.h" + +extern zigbee_h handle; + +extern nwk_addr dest_addr16; +extern simple_desc_s st_ep1; + +static int run_reset_factory_default(MManager *mm, struct menu_data *menu) +{ + int ret = ZIGBEE_ERROR_NONE; + + ret = zb_zcl_basic_reset_factory_default(handle, dest_addr16, st_ep1.ep); + if (ZIGBEE_ERROR_NONE != ret) { + msg("zb_zcl_basic_reset_factory_default(0x%X) - FAILED!!!", ret); + return RET_FAILURE; + } + + msg(" - zb_zcl_basic_reset_factory_default() ret: [0x%X]", ret); + msg(""); + + return RET_SUCCESS; +} + +static struct menu_data _menu_reset_factory_default[] = { + { "1", "Run", NULL, run_reset_factory_default, NULL }, + { NULL, NULL, }, +}; + +struct menu_data menu_zcl_cluster_basic[] = { + { "1", "zb_zcl_basic_reset_factory_default", + _menu_reset_factory_default, NULL, NULL }, + { NULL, NULL, }, +}; diff --git a/test/zcl-cluster-ias-zone.c b/test/zcl-cluster-ias-zone.c new file mode 100644 index 0000000..c3570f9 --- /dev/null +++ b/test/zcl-cluster-ias-zone.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "main.h" +#include "menu.h" + +extern zigbee_h handle; + +extern nwk_addr dest_addr16; +extern simple_desc_s sj_ep1; + +static char data_enroll_response_code[MENU_DATA_SIZE + 1] = "10"; +static char data_zone_id[MENU_DATA_SIZE + 1] = "77"; + +static int run_enroll_response(MManager *mm, struct menu_data *menu) +{ + int ret = ZIGBEE_ERROR_NONE; + unsigned char enroll_response_code = 10; + unsigned char zone_id = 10; + + if (strlen(data_enroll_response_code)) + enroll_response_code = (unsigned short)strtol(data_enroll_response_code, NULL, 10); + + if (strlen(data_zone_id)) + zone_id = (unsigned short)strtol(data_zone_id, NULL, 10); + + ret = zb_zcl_zone_enroll_response(handle, dest_addr16, sj_ep1.ep, + enroll_response_code, zone_id); + if (ZIGBEE_ERROR_NONE != ret) { + msg("zb_zcl_zone_enroll_response(0x%X) - FAILED!!!", ret); + return RET_FAILURE; + } + + msg(" - zb_zcl_zone_enroll_response() ret: [0x%X]", ret); + msg(""); + + return RET_SUCCESS; +} + +static struct menu_data _menu_enroll_response[] = { + { "1", "Enroll response time", NULL, NULL, data_enroll_response_code }, + { "2", "Zone ID", NULL, NULL, data_zone_id }, + { "3", "Run", NULL, run_enroll_response, NULL }, + { NULL, NULL, }, +}; + +struct menu_data menu_zcl_cluster_ias_zone[] = { + { "1", "zb_zcl_enroll_response", _menu_enroll_response, NULL, NULL }, + { NULL, NULL, }, +}; diff --git a/test/zcl-global-cmd.c b/test/zcl-global-cmd.c index 2714ac6..f351f76 100644 --- a/test/zcl-global-cmd.c +++ b/test/zcl-global-cmd.c @@ -29,9 +29,11 @@ #include "menu.h" extern struct menu_data menu_zcl_cluster_alarm[]; +extern struct menu_data menu_zcl_cluster_basic[]; extern struct menu_data menu_zcl_cluster_colorctrl[]; extern struct menu_data menu_zcl_cluster_group[]; extern struct menu_data menu_zcl_cluster_identity[]; +extern struct menu_data menu_zcl_cluster_ias_zone[]; extern struct menu_data menu_zcl_cluster_levelctrl[]; extern struct menu_data menu_zcl_cluster_onoff[]; extern struct menu_data menu_zcl_cluster_pollctrl[]; @@ -693,10 +695,10 @@ struct menu_data menu_zcl_global[] = { struct menu_data menu_zcl_cluster[] = { { "1", "Alarm Cluster", menu_zcl_cluster_alarm, NULL, NULL }, - { "2", "Basic Cluster", NULL, NULL, NULL }, + { "2", "Basic Cluster", menu_zcl_cluster_basic, NULL, NULL }, { "3", "Color Control Cluster", menu_zcl_cluster_colorctrl, NULL, NULL }, { "4", "Group Cluster", menu_zcl_cluster_group, NULL, NULL }, - { "5", "IAS zone Cluster", NULL, NULL, NULL }, + { "5", "IAS zone Cluster", menu_zcl_cluster_ias_zone, NULL, NULL }, { "6", "Identity Cluster", menu_zcl_cluster_identity, NULL, NULL }, { "7", "Level Control Cluster", menu_zcl_cluster_levelctrl, NULL, NULL }, { "8", "On/Off Cluster", menu_zcl_cluster_onoff, NULL, NULL },