diff --git a/com.zsmartsystems.zigbee.autocode/pom.xml b/com.zsmartsystems.zigbee.autocode/pom.xml index 13f067216..b2880c6e7 100644 --- a/com.zsmartsystems.zigbee.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.autocode/pom.xml @@ -15,7 +15,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console.ember/pom.xml b/com.zsmartsystems.zigbee.console.ember/pom.xml index 9ce129700..6a054a876 100644 --- a/com.zsmartsystems.zigbee.console.ember/pom.xml +++ b/com.zsmartsystems.zigbee.console.ember/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,19 +17,19 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.ember - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console.main/pom.xml b/com.zsmartsystems.zigbee.console.main/pom.xml index 2edd82da6..c2620be06 100644 --- a/com.zsmartsystems.zigbee.console.main/pom.xml +++ b/com.zsmartsystems.zigbee.console.main/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,61 +17,61 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.serial - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.cc2531 - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.xbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.conbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.ember - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.telegesis - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.ember - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.telegesis - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console.telegesis/pom.xml b/com.zsmartsystems.zigbee.console.telegesis/pom.xml index 0a8ebd69f..d97353193 100644 --- a/com.zsmartsystems.zigbee.console.telegesis/pom.xml +++ b/com.zsmartsystems.zigbee.console.telegesis/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,19 +17,19 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.telegesis - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console/pom.xml b/com.zsmartsystems.zigbee.console/pom.xml index 0c7e469d4..8b3e7dce1 100644 --- a/com.zsmartsystems.zigbee.console/pom.xml +++ b/com.zsmartsystems.zigbee.console/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,7 +17,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/pom.xml b/com.zsmartsystems.zigbee.dongle.cc2531/pom.xml index 01e344b31..0fb1ca58c 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.cc2531/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,7 +17,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.conbee/pom.xml b/com.zsmartsystems.zigbee.dongle.conbee/pom.xml index 029c39d66..6029cb9dc 100644 --- a/com.zsmartsystems.zigbee.dongle.conbee/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.conbee/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,7 +17,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.ember.autocode/pom.xml index c56761d47..d4c1b1c53 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/pom.xml @@ -14,7 +14,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.ember/pom.xml b/com.zsmartsystems.zigbee.dongle.ember/pom.xml index a544a5b33..7fadf4d43 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.ember/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,13 +17,13 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT tests test diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandler.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandler.java index 17d1b0f74..d0eb70b3a 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandler.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandler.java @@ -471,7 +471,7 @@ public void close() { try { parserThread.interrupt(); parserThread.join(); - logger.debug("AshFrameHandler parsed thread terminated."); + logger.debug("AshFrameHandler parser thread terminated."); } catch (InterruptedException e) { logger.debug("AshFrameHandler interrupted in packet parser thread shutdown join."); } diff --git a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/pom.xml index bf1925a79..40c8a1ee0 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/pom.xml @@ -4,7 +4,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.telegesis.autocode - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT UTF-8 @@ -15,7 +15,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/pom.xml b/com.zsmartsystems.zigbee.dongle.telegesis/pom.xml index 4122d924d..17f0482bf 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.telegesis/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,13 +17,13 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT tests test diff --git a/com.zsmartsystems.zigbee.dongle.xbee.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.xbee.autocode/pom.xml index 2311f0940..cf05c1732 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.xbee.autocode/pom.xml @@ -4,7 +4,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.xbee.autocode - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT UTF-8 @@ -15,7 +15,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.xbee/pom.xml b/com.zsmartsystems.zigbee.dongle.xbee/pom.xml index 19634d987..fbead5fe2 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.xbee/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -17,7 +17,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.serial/pom.xml b/com.zsmartsystems.zigbee.serial/pom.xml index f8c5cf205..03d022e39 100644 --- a/com.zsmartsystems.zigbee.serial/pom.xml +++ b/com.zsmartsystems.zigbee.serial/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT @@ -21,7 +21,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.test/pom.xml b/com.zsmartsystems.zigbee.test/pom.xml index 0b3ee5cf5..46d975f7c 100644 --- a/com.zsmartsystems.zigbee.test/pom.xml +++ b/com.zsmartsystems.zigbee.test/pom.xml @@ -8,39 +8,39 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.cc2531 - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.ember - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.telegesis - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.xbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.conbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee/pom.xml b/com.zsmartsystems.zigbee/pom.xml index 3545800e5..69efeb02f 100644 --- a/com.zsmartsystems.zigbee/pom.xml +++ b/com.zsmartsystems.zigbee/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeEndpoint.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeEndpoint.java index 765d59326..60557ca78 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeEndpoint.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeEndpoint.java @@ -399,17 +399,21 @@ public ZigBeeNode getParentNode() { * * @param application the new {@link ZigBeeApplication} * @return the {@link ZigBeeStatus} of the call. {@link ZigBeeStatus.SUCCESS} if the application was registered and - * started, and {@link ZigBeeStatus.INVALID_STATE} if an application is already registered to the cluster + * started, {@link ZigBeeStatus.INVALID_STATE} if an application is already registered to the cluster, and + * {@link ZigBeeStatus.UNSUPPORTED} if a valid cluster cannot be found in the endpoint */ public ZigBeeStatus addApplication(ZigBeeApplication application) { if (applications.get(application.getClusterId()) != null) { return ZigBeeStatus.INVALID_STATE; } - applications.put(application.getClusterId(), application); ZclCluster cluster = outputClusters.get(application.getClusterId()); if (cluster == null) { cluster = inputClusters.get(application.getClusterId()); } + if (cluster == null) { + return ZigBeeStatus.UNSUPPORTED; + } + applications.put(application.getClusterId(), application); return application.appStartup(cluster); } @@ -610,10 +614,10 @@ public Future sendTransaction(ZigBeeCommand command, ZigBeeTransa command.setDestinationAddress(getEndpointAddress()); return node.sendTransaction(command, responseMatcher); } - + /** * Gets the {@link NotificationService} provided by the {@link ZigBeeNetworkManager}. - * + * * @return the {@link NotificationService} provided by the {@link ZigBeeNetworkManager}. */ public NotificationService getNotificationService() { diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeNetworkManager.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeNetworkManager.java index bb857f6f7..0213851b4 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeNetworkManager.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeNetworkManager.java @@ -703,6 +703,7 @@ public ZigBeeStatus reinitialize() { */ public void shutdown() { logger.debug("ZigBeeNetworkManager shutdown: networkState={}", networkState); + setNetworkState(ZigBeeNetworkState.OFFLINE); // To avoid deferred writes while we shut down, set the deferred write time to 0. databaseManager.setDeferredWriteTime(0); diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transaction/ZigBeeTransactionQueue.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transaction/ZigBeeTransactionQueue.java index 7d66415fa..2694bce9a 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transaction/ZigBeeTransactionQueue.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transaction/ZigBeeTransactionQueue.java @@ -132,7 +132,11 @@ protected void shutdown() { isShutdown = true; // Cancel any queued transactions - for (ZigBeeTransaction transaction : queue) { + while (!queue.isEmpty()) { + ZigBeeTransaction transaction = queue.poll(); + if (transaction == null) { + break; + } transaction.cancel(); } diff --git a/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/ZigBeeEndpointTest.java b/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/ZigBeeEndpointTest.java index 4c7ca9619..626ab507a 100644 --- a/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/ZigBeeEndpointTest.java +++ b/com.zsmartsystems.zigbee/src/test/java/com/zsmartsystems/zigbee/ZigBeeEndpointTest.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.ArrayList; @@ -21,6 +22,7 @@ import org.mockito.Mockito; import com.zsmartsystems.zigbee.app.ZigBeeApplication; +import com.zsmartsystems.zigbee.app.otaserver.ZclOtaUpgradeServer; import com.zsmartsystems.zigbee.database.ZigBeeEndpointDao; import com.zsmartsystems.zigbee.transaction.ZigBeeTransactionMatcher; import com.zsmartsystems.zigbee.zcl.ZclCluster; @@ -32,6 +34,7 @@ import com.zsmartsystems.zigbee.zcl.clusters.ZclCustomCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclDoorLockCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclLevelControlCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclOtaUpgradeCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclScenesCluster; import com.zsmartsystems.zigbee.zcl.clusters.general.DefaultResponse; import com.zsmartsystems.zigbee.zcl.clusters.general.ReportAttributesCommand; @@ -270,6 +273,31 @@ public void setDao() { assertEquals(4, endpoint.getProfileId()); } + @Test + public void addApplication() { + ZigBeeEndpoint endpoint = getEndpoint(); + + ZclOtaUpgradeServer otaServer = (ZclOtaUpgradeServer) endpoint + .getApplication(ZclOtaUpgradeCluster.CLUSTER_ID); + + assertNull(endpoint.getApplication(ZclOtaUpgradeCluster.CLUSTER_ID)); + + assertEquals(ZigBeeStatus.UNSUPPORTED, endpoint.addApplication(new ZclOtaUpgradeServer())); + assertNull(endpoint.getApplication(ZclOtaUpgradeCluster.CLUSTER_ID)); + + endpoint.addInputCluster(new ZclOtaUpgradeCluster(endpoint)); + assertEquals(ZigBeeStatus.SUCCESS, endpoint.addApplication(new ZclOtaUpgradeServer())); + + endpoint.addInputCluster(new ZclOtaUpgradeCluster(endpoint)); + assertEquals(ZigBeeStatus.INVALID_STATE, endpoint.addApplication(new ZclOtaUpgradeServer())); + + otaServer = (ZclOtaUpgradeServer) endpoint.getApplication(ZclOtaUpgradeCluster.CLUSTER_ID); + assertNotNull(otaServer); + + endpoint.removeApplication(ZclOtaUpgradeCluster.CLUSTER_ID); + assertNull(endpoint.getApplication(ZclOtaUpgradeCluster.CLUSTER_ID)); + } + private ZigBeeEndpoint getEndpoint() { node = Mockito.mock(ZigBeeNode.class); Mockito.when(node.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF")); diff --git a/pom.xml b/pom.xml index 49ef7a70a..a2c29c8a7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT pom ZssBee diff --git a/releng/p2repo/pom.xml b/releng/p2repo/pom.xml index 1e05a70e3..1a8bea71a 100644 --- a/releng/p2repo/pom.xml +++ b/releng/p2repo/pom.xml @@ -10,7 +10,7 @@ com.zsmartsystems zigbee - 1.4.10-SNAPSHOT + 1.4.11-SNAPSHOT ../../