From e59d65fac0b958b39dd52915216d46a315a19bf3 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Fri, 1 Jan 2021 23:19:16 +0100 Subject: [PATCH] Small updates --- .../hal/plugin/zigbee/HalZigbeeController.java | 6 +----- .../plugin/zigbee/HalZigbeeControllerTest.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java index 8320a40a..a12afce8 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java @@ -22,7 +22,7 @@ public class HalZigbeeController implements HalSensorController, HalEventControl private static final String CONFIG_ZIGBEE_PANID = "zigbee.pan_id"; private SerialPort port; - private ZigBeeApiDongleImpl zigbeeApi; + protected ZigBeeApiDongleImpl zigbeeApi; private HalSensorReportListener sensorListener; private HalEventReportListener eventListener; @@ -51,10 +51,6 @@ public class HalZigbeeController implements HalSensorController, HalEventControl false); zigbeeApi.startup(); - - for (ZigBeeDevice device : zigbeeApi.getDevices()) { - System.out.println("Device: " + device.getLabel()); - } } @Override diff --git a/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java b/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java index 7d5e5c20..6cef9cae 100644 --- a/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java +++ b/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java @@ -24,6 +24,7 @@ package se.hal.plugin.zigbee; +import org.bubblecloud.zigbee.v3.ZigBeeDevice; import zutil.log.CompactLogFormatter; import zutil.log.LogUtil; @@ -32,13 +33,23 @@ import java.util.logging.Level; public class HalZigbeeControllerTest { - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws IOException, InterruptedException { LogUtil.setGlobalFormatter(new CompactLogFormatter()); LogUtil.setGlobalLevel(Level.ALL); HalZigbeeController controller = new HalZigbeeController(); - controller.initialize( - "COM3"); + controller.initialize("COM3", -6); + + System.out.println("Enable pairing."); + controller.zigbeeApi.permitJoin(true); + + //controller.zigbeeApi + + Thread.sleep(10000); + + for (ZigBeeDevice device : controller.zigbeeApi.getDevices()) { + System.out.println("Device: " + device); + } System.out.println("Press ENTER to exit application."); System.in.read();