Implement IAS-Zone, Basic cluster test-cases
authorsaerome kim <saerome.kim@samsung.com>
Wed, 8 Feb 2017 06:48:58 +0000 (15:48 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:07:20 +0000 (18:07 +0900)
Change-Id: Ia64069dd1282c3ed5bf8c4623e52f53a89842884
Signed-off-by: saerome kim <saerome.kim@samsung.com>
test/CMakeLists.txt
test/zcl-cluster-basic.c [new file with mode: 0644]
test/zcl-cluster-ias-zone.c [new file with mode: 0644]
test/zcl-global-cmd.c

index 501363ace9d4da55b6bfd03a62e59e23b8d3515a..64fa5a6b2c73d6e146abe89634bf36c958b215b5 100644 (file)
@@ -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 (file)
index 0000000..49943d4
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#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 (file)
index 0000000..c3570f9
--- /dev/null
@@ -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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#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, },
+};
index 2714ac63d1a9dc8b957afe05e608277f9b173216..f351f7666a0d485f818dc58bcffcc23d6466fbe2 100644 (file)
 #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 },