From ad8cc8704922b1f197aa0d18125278b19947717c Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 9 Mar 2019 16:41:20 +0000 Subject: [PATCH 01/33] Initial Z-Stack driver Signed-off-by: Chris Jackson --- com.zsmartsystems.zigbee.console.main/pom.xml | 24 + .../console/main/ZigBeeConsoleMain.java | 14 +- .../.project | 23 + .../build.gradle | 7 + .../pom.xml | 38 + .../zstack/ZstackConsoleAbstractCommand.java | 75 + .../ZstackConsoleNcpDiagnosticsCommand.java | 69 + .../ZstackConsoleNcpSecurityCommand.java | 73 + .../zstack/ZstackConsoleNcpStateCommand.java | 115 + .../network/impl/CommandInterfaceImpl.java | 12 + .../ember/autocode/CommandGenerator.java | 2 +- .../.project | 23 + .../pom.xml | 66 + .../zstack/autocode/ClassGenerator.java | 220 ++ .../zstack/autocode/CommandGenerator.java | 775 +++++ .../zstack/autocode/ZstackAutocoder.java | 250 ++ .../dongle/zstack/autocode/xml/Command.java | 32 + .../zstack/autocode/xml/Enumeration.java | 24 + .../dongle/zstack/autocode/xml/Parameter.java | 23 + .../dongle/zstack/autocode/xml/Protocol.java | 21 + .../dongle/zstack/autocode/xml/Structure.java | 21 + .../dongle/zstack/autocode/xml/Value.java | 19 + .../src/main/resources/zstack_protocol.xml | 3028 +++++++++++++++++ .../.gitignore | 1 + .../.project | 23 + .../build.gradle | 7 + .../pom.xml | 33 + .../dongle/zstack/ZigBeeDongleZstack.java | 815 +++++ .../zigbee/dongle/zstack/ZstackNcp.java | 596 ++++ .../dongle/zstack/api/ZstackCommand.java | 44 + .../dongle/zstack/api/ZstackFrameFactory.java | 233 ++ .../dongle/zstack/api/ZstackFrameRequest.java | 114 + .../zstack/api/ZstackFrameResponse.java | 78 + .../dongle/zstack/api/ZstackResponseCode.java | 124 + .../dongle/zstack/api/af/AfDataOptions.java | 84 + .../api/af/ZstackAfDataConfirmAreq.java | 124 + .../api/af/ZstackAfDataRequestSreq.java | 290 ++ .../api/af/ZstackAfDataRequestSrsp.java | 68 + .../api/af/ZstackAfIncomingMsgAreq.java | 334 ++ .../zstack/api/af/ZstackAfRegisterSreq.java | 248 ++ .../zstack/api/af/ZstackAfRegisterSrsp.java | 71 + .../ZstackAppCnfBdbAddInstallcodeSreq.java | 134 + .../ZstackAppCnfBdbAddInstallcodeSrsp.java | 68 + ...ppCnfBdbCommissioningNotificationAreq.java | 136 + ...BdbSetActiveDefaultCentralizedKeySreq.java | 103 + ...BdbSetActiveDefaultCentralizedKeySrsp.java | 68 + ...ppCnfBdbSetJoinusesinstallcodekeySreq.java | 101 + ...ppCnfBdbSetJoinusesinstallcodekeySrsp.java | 68 + ...kAppCnfBdbSetTcRequireKeyExchangeSreq.java | 89 + ...kAppCnfBdbSetTcRequireKeyExchangeSrsp.java | 68 + ...stackAppCnfSetAllowrejoinTcPolicySreq.java | 77 + ...stackAppCnfSetAllowrejoinTcPolicySrsp.java | 68 + .../appcnf/ZstackBdbCommissioningMode.java | 97 + .../ZstackBdbRemainingCommissioningModes.java | 97 + .../zstack/api/appcnf/ZstackBdbStatus.java | 142 + .../appcnf/ZstackCentralizedLinkKeyMode.java | 96 + .../api/appcnf/ZstackInstallCodeFormat.java | 77 + .../zstack/api/mac/ZstackMacScanReqSreq.java | 271 ++ .../zstack/api/mac/ZstackMacScanReqSrsp.java | 39 + .../api/rpc/ZstackRpcSreqErrorSrsp.java | 119 + .../zstack/api/rpc/ZstackSreqErrorCode.java | 89 + .../api/sapi/ZstackDeviceInformation.java | 109 + .../api/sapi/ZstackZbGetDeviceInfoSreq.java | 77 + .../api/sapi/ZstackZbGetDeviceInfoSrsp.java | 93 + .../sapi/ZstackZbReadConfigurationSreq.java | 78 + .../sapi/ZstackZbReadConfigurationSrsp.java | 127 + .../sapi/ZstackZbWriteConfigurationSreq.java | 110 + .../sapi/ZstackZbWriteConfigurationSrsp.java | 68 + .../api/sbl/ZstackSbHandshakeCmdSreq.java | 47 + .../api/sbl/ZstackSbHandshakeCmdSrsp.java | 168 + .../zstack/api/sbl/ZstackSbWriteCmdSreq.java | 81 + .../zstack/api/sbl/ZstackSbWriteCmdSrsp.java | 66 + .../dongle/zstack/api/sys/ZstackConfigId.java | 638 ++++ .../api/sys/ZstackDiagnosticAttribute.java | 144 + .../zstack/api/sys/ZstackResetReason.java | 84 + .../zstack/api/sys/ZstackResetType.java | 79 + .../api/sys/ZstackSysGetExtAddrSreq.java | 49 + .../api/sys/ZstackSysGetExtAddrSrsp.java | 68 + .../api/sys/ZstackSysOsalNvReadSreq.java | 104 + .../api/sys/ZstackSysOsalNvReadSrsp.java | 101 + .../api/sys/ZstackSysOsalNvWriteSreq.java | 136 + .../api/sys/ZstackSysOsalNvWriteSrsp.java | 69 + .../zstack/api/sys/ZstackSysPingSreq.java | 49 + .../zstack/api/sys/ZstackSysPingSrsp.java | 67 + .../zstack/api/sys/ZstackSysResetIndAreq.java | 195 ++ .../zstack/api/sys/ZstackSysResetReqAcmd.java | 74 + .../api/sys/ZstackSysSetExtAddrSreq.java | 78 + .../api/sys/ZstackSysSetExtAddrSrsp.java | 68 + .../api/sys/ZstackSysSetTxPowerSreq.java | 78 + .../api/sys/ZstackSysSetTxPowerSrsp.java | 68 + .../zstack/api/sys/ZstackSysVersionSreq.java | 49 + .../zstack/api/sys/ZstackSysVersionSrsp.java | 171 + .../sys/ZstackSysZdiagsClearStatsSreq.java | 78 + .../sys/ZstackSysZdiagsClearStatsSrsp.java | 68 + .../api/sys/ZstackSysZdiagsGetStatsSreq.java | 77 + .../api/sys/ZstackSysZdiagsGetStatsSrsp.java | 67 + .../api/sys/ZstackSysZdiagsInitStatsSreq.java | 49 + .../api/sys/ZstackSysZdiagsInitStatsSrsp.java | 68 + .../ZstackSysZdiagsRestoreStatsNvSreq.java | 77 + .../ZstackSysZdiagsRestoreStatsNvSrsp.java | 68 + .../sys/ZstackSysZdiagsSaveStatsToNvSreq.java | 49 + .../sys/ZstackSysZdiagsSaveStatsToNvSrsp.java | 67 + .../api/sys/ZstackSystemCapabilities.java | 119 + .../dongle/zstack/api/sys/ZstackZdoState.java | 122 + .../ZstackUtilApsmeLinkKeyDataGetSreq.java | 78 + .../ZstackUtilApsmeLinkKeyDataGetSrsp.java | 147 + .../ZstackUtilApsmeLinkKeyNvIdGetSreq.java | 78 + .../ZstackUtilApsmeLinkKeyNvIdGetSrsp.java | 94 + .../api/util/ZstackUtilGetDeviceInfoSreq.java | 49 + .../api/util/ZstackUtilGetDeviceInfoSrsp.java | 212 ++ .../api/util/ZstackUtilGetNvInfoSreq.java | 49 + .../api/util/ZstackUtilGetNvInfoSrsp.java | 205 ++ .../api/util/ZstackUtilLedControlSreq.java | 103 + .../api/util/ZstackUtilLedControlSrsp.java | 68 + .../api/util/ZstackUtilSetChannelsSreq.java | 78 + .../api/util/ZstackUtilSetChannelsSrsp.java | 69 + .../api/util/ZstackUtilSetPanidSreq.java | 77 + .../api/util/ZstackUtilSetPanidSrsp.java | 68 + .../api/util/ZstackUtilSetPrecfgkeySreq.java | 79 + .../api/util/ZstackUtilSetPrecfgkeySrsp.java | 69 + .../api/util/ZstackUtilSetSeclevelSreq.java | 78 + .../api/util/ZstackUtilSetSeclevelSrsp.java | 69 + .../api/zdo/ZstackZdoGetLinkKeySreq.java | 78 + .../api/zdo/ZstackZdoGetLinkKeySrsp.java | 122 + .../zstack/api/zdo/ZstackZdoLeaveIndAreq.java | 170 + .../api/zdo/ZstackZdoMsgCbIncomingAreq.java | 226 ++ .../api/zdo/ZstackZdoMsgCbRegisterSreq.java | 77 + .../api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 68 + .../api/zdo/ZstackZdoNwkDiscoveryReqSreq.java | 103 + .../api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java | 77 + .../api/zdo/ZstackZdoRemoveLinkKeySreq.java | 78 + .../api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 68 + .../api/zdo/ZstackZdoSetLinkKeySreq.java | 131 + .../api/zdo/ZstackZdoSetLinkKeySrsp.java | 68 + .../api/zdo/ZstackZdoStartupFromAppSreq.java | 77 + .../api/zdo/ZstackZdoStartupFromAppSrsp.java | 68 + .../api/zdo/ZstackZdoStateChangeIndAreq.java | 66 + .../zstack/api/zdo/ZstackZdoTcDevIndAreq.java | 119 + .../zstack/internal/ZstackFrameHandler.java | 33 + .../internal/ZstackNetworkInitialisation.java | 272 ++ .../internal/ZstackProtocolHandler.java | 539 +++ .../internal/ZstackStackConfiguration.java | 76 + .../ZstackSingleResponseTransaction.java | 76 + .../transaction/ZstackTransaction.java | 58 + .../zigbee/dongle/zstack/ZStackNcpTest.java | 145 + .../dongle/zstack/ZigBeeDongleZstackTest.java | 245 ++ .../zstack/api/ZstackFrameRequestTest.java | 69 + .../zstack/api/ZstackFrameResponseTest.java | 57 + .../api/rpc/ZstackRpcSreqErrorSrspTest.java | 30 + .../api/sys/ZstackSysResetReqAcmdTest.java | 38 + .../api/sys/ZstackSysVersionSreqTest.java | 51 + .../util/ZstackUtilGetDeviceInfoSrspTest.java | 39 + .../internal/ZstackProtocolHandlerTest.java | 151 + .../ZstackSingleResponseTransactionTest.java | 64 + pom.xml | 3 + 155 files changed, 19760 insertions(+), 2 deletions(-) create mode 100644 com.zsmartsystems.zigbee.console.zstack/.project create mode 100644 com.zsmartsystems.zigbee.console.zstack/build.gradle create mode 100644 com.zsmartsystems.zigbee.console.zstack/pom.xml create mode 100644 com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java create mode 100644 com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java create mode 100644 com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java create mode 100644 com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/.project create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/.gitignore create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/.project create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/build.gradle create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/pom.xml create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java diff --git a/com.zsmartsystems.zigbee.console.main/pom.xml b/com.zsmartsystems.zigbee.console.main/pom.xml index 68fa3e73f3..e23fbe535f 100644 --- a/com.zsmartsystems.zigbee.console.main/pom.xml +++ b/com.zsmartsystems.zigbee.console.main/pom.xml @@ -32,6 +32,12 @@ 1.4.8-SNAPSHOT + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.dongle.zstack + 1.1.11-SNAPSHOT + + com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.xbee @@ -74,6 +80,24 @@ 1.4.8-SNAPSHOT + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.console.zstack + 1.1.11-SNAPSHOT + + + + commons-lang + commons-lang + 2.6 + + + + commons-io + commons-io + 2.4 + + commons-cli commons-cli diff --git a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java index 9486206b44..e53f8cab1f 100644 --- a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java +++ b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java @@ -52,6 +52,9 @@ import com.zsmartsystems.zigbee.console.ember.EmberConsoleSecurityStateCommand; import com.zsmartsystems.zigbee.console.ember.EmberConsoleTransientKeyCommand; import com.zsmartsystems.zigbee.console.telegesis.TelegesisConsoleSecurityStateCommand; +import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpDiagnosticsCommand; +import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpSecurityCommand; +import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpStateCommand; import com.zsmartsystems.zigbee.database.ZigBeeNetworkDataStore; import com.zsmartsystems.zigbee.dongle.cc2531.ZigBeeDongleTiCc2531; import com.zsmartsystems.zigbee.dongle.conbee.ZigBeeDongleConBee; @@ -59,6 +62,7 @@ import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspConfigId; import com.zsmartsystems.zigbee.dongle.telegesis.ZigBeeDongleTelegesis; import com.zsmartsystems.zigbee.dongle.xbee.ZigBeeDongleXBee; +import com.zsmartsystems.zigbee.dongle.zstack.ZigBeeDongleZstack; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.serial.ZigBeeSerialPort; import com.zsmartsystems.zigbee.serialization.DefaultDeserializer; @@ -150,7 +154,8 @@ public static void main(final String[] args) { Options options = new Options(); options.addOption(Option.builder("d").longOpt("dongle").hasArg().argName("dongle type") - .desc("Set the dongle type to use (EMBER | CC2531 | TELEGESIS | CONBEE | XBEE)").required().build()); + .desc("Set the dongle type to use (EMBER | CC2531 | ZSTACK | TELEGESIS | CONBEE | XBEE)").required() + .build()); options.addOption(Option.builder("p").longOpt("port").argName("port name").hasArg().desc("Set the port") .required().build()); options.addOption( @@ -250,6 +255,13 @@ public static void main(final String[] args) { if (dongleName.toUpperCase().equals("CC2531")) { dongle = new ZigBeeDongleTiCc2531(serialPort); transportOptions.addOption(TransportConfigOption.RADIO_TX_POWER, 3); + } else if (dongleName.toUpperCase().equals("ZSTACK")) { + dongle = new ZigBeeDongleZstack(serialPort); + transportOptions.addOption(TransportConfigOption.RADIO_TX_POWER, 3); + + commands.add(ZstackConsoleNcpStateCommand.class); + commands.add(ZstackConsoleNcpSecurityCommand.class); + commands.add(ZstackConsoleNcpDiagnosticsCommand.class); } else if (dongleName.toUpperCase().equals("EMBER")) { ZigBeeDongleEzsp emberDongle = new ZigBeeDongleEzsp(serialPort); dongle = emberDongle; diff --git a/com.zsmartsystems.zigbee.console.zstack/.project b/com.zsmartsystems.zigbee.console.zstack/.project new file mode 100644 index 0000000000..5d70aa078c --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/.project @@ -0,0 +1,23 @@ + + + com.zsmartsystems.zigbee.console.zstack + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/com.zsmartsystems.zigbee.console.zstack/build.gradle b/com.zsmartsystems.zigbee.console.zstack/build.gradle new file mode 100644 index 0000000000..230a086c44 --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/build.gradle @@ -0,0 +1,7 @@ +group = 'com.zsmartsystems.zigbee' +description = '' +dependencies { + compile project(':com.zsmartsystems.zigbee') + compile project(':com.zsmartsystems.zigbee.console') + compile project(':com.zsmartsystems.zigbee.dongle.zstack’) +} \ No newline at end of file diff --git a/com.zsmartsystems.zigbee.console.zstack/pom.xml b/com.zsmartsystems.zigbee.console.zstack/pom.xml new file mode 100644 index 0000000000..bf89ee6063 --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.console.zstack + jar + + + com.zsmartsystems + zigbee + 1.1.11-SNAPSHOT + + + + + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee + 1.1.11-SNAPSHOT + + + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.console + 1.1.11-SNAPSHOT + + + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.dongle.zstack + 1.1.11-SNAPSHOT + + + + + + diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java new file mode 100644 index 0000000000..a15577c110 --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.console.zstack; + +import java.io.UnsupportedEncodingException; +import java.util.Arrays; + +import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.console.ZigBeeConsoleCommand; +import com.zsmartsystems.zigbee.dongle.zstack.ZigBeeDongleZstack; +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; + +/** + * + * @author Chris Jackson - Initial Contribution + * + */ +public abstract class ZstackConsoleAbstractCommand implements ZigBeeConsoleCommand { + private static String CFG_UNSUPPORTED = "Not Supported"; + + protected ZstackNcp getZstackNcp(ZigBeeNetworkManager networkManager) + throws IllegalArgumentException, IllegalStateException { + if (!(networkManager.getZigBeeTransport() instanceof ZigBeeDongleZstack)) { + throw new IllegalArgumentException("Dongle is not an ZStack NCP."); + } + ZigBeeDongleZstack dongle = (ZigBeeDongleZstack) networkManager.getZigBeeTransport(); + if (dongle == null) { + throw new IllegalStateException("Dongle is not an ZStack NCP."); + } + return dongle.getZstackNcp(); + } + + protected String hex2Boolean(int[] bytes) { + if (bytes == null) { + return CFG_UNSUPPORTED; + } + + return Boolean.valueOf(bytes[0] != 0).toString(); + } + + protected String hex2Uint8(int[] bytes) { + if (bytes == null) { + return CFG_UNSUPPORTED; + } + + return Integer.valueOf(bytes[0]).toString(); + } + + protected String hex2String(int[] bytes) { + if (bytes == null) { + return CFG_UNSUPPORTED; + } + + int length = bytes.length; + byte[] output = new byte[length]; + + for (int cnt = 0; cnt < bytes.length; cnt++) { + output[cnt] = (byte) bytes[cnt]; + if (output[cnt] == 0) { + length = cnt; + break; + } + } + try { + return new String(Arrays.copyOfRange(output, 0, length), "UTF-8"); + } catch (UnsupportedEncodingException e) { + return null; + } + } +} diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java new file mode 100644 index 0000000000..884132c289 --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.console.zstack; + +import java.io.PrintStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackDiagnosticAttribute; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackConsoleNcpDiagnosticsCommand extends ZstackConsoleAbstractCommand { + @Override + public String getCommand() { + return "ncpdiags"; + } + + @Override + public String getDescription() { + return "Gets the NCP diagnostics counters."; + } + + @Override + public String getSyntax() { + return ""; + } + + @Override + public String getHelp() { + return ""; + } + + @Override + public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) + throws IllegalArgumentException { + ZstackNcp ncp = getZstackNcp(networkManager); + Map diagnostics = new HashMap<>(); + + for (ZstackDiagnosticAttribute attribute : ZstackDiagnosticAttribute.values()) { + if (attribute == ZstackDiagnosticAttribute.UNKNOWN) { + continue; + } + + Long value = ncp.getDiagnosticsAttribute(attribute); + + if (value == null) { + continue; + } + diagnostics.put(attribute, value); + } + + for (Entry diagnosticsEntry : diagnostics.entrySet()) { + out.println(String.format("%-40s %d", diagnosticsEntry.getKey(), diagnosticsEntry.getValue())); + } + } + +} diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java new file mode 100644 index 0000000000..6cea11313f --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.console.zstack; + +import java.io.PrintStream; + +import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackConsoleNcpSecurityCommand extends ZstackConsoleAbstractCommand { + @Override + public String getCommand() { + return "ncpsecurity"; + } + + @Override + public String getDescription() { + return "Gets the NCP security information."; + } + + @Override + public String getSyntax() { + return ""; + } + + @Override + public String getHelp() { + return ""; + } + + @Override + public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) + throws IllegalArgumentException { + ZstackNcp ncp = getZstackNcp(networkManager); + + ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); + int[] nwkKeyConfig = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWKKEY); + int[] apsKeyTable = ncp.readConfiguration(ZstackConfigId.ZCD_NV_APS_LINK_KEY_TABLE); + int[] altKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ALTERN_KEY_INFO); + int[] nwkActiveKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ACTIVE_KEY_INFO); + + if (nvInfo == null) { + out.println("NV Device info : ERROR"); + } else { + out.println("Preconfigured Network Key : " + nvInfo.getPreConfigKey()); + } + + if (nwkKeyConfig == null) { + out.println("NWK Key Info : Not Supported"); + } else { + + } + + if (apsKeyTable == null) { + out.println("APS Key Info : Not Supported"); + } else { + + } + } + +} diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java new file mode 100644 index 0000000000..4df7acee86 --- /dev/null +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.console.zstack; + +import java.io.PrintStream; +import java.util.Set; + +import com.zsmartsystems.zigbee.ZigBeeChannelMask; +import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackConsoleNcpStateCommand extends ZstackConsoleAbstractCommand { + @Override + public String getCommand() { + return "ncpstate"; + } + + @Override + public String getDescription() { + return "Gets the NCP network state."; + } + + @Override + public String getSyntax() { + return ""; + } + + @Override + public String getHelp() { + return ""; + } + + @Override + public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) + throws IllegalArgumentException { + ncpState(networkManager, out); + } + + private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { + ZstackNcp ncp = getZstackNcp(networkManager); + + ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); + ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); + ZstackSysVersionSrsp ncpVersion = ncp.getVersion(); + Set ncpCapabilities = ncp.pingNcp(); + + int[] userDesc = ncp.readConfiguration(ZstackConfigId.ZCD_NV_USERDESC); + int[] bdbDeviceOnNwk = ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); + int[] concentratorRadius = ncp.readConfiguration(ZstackConfigId.ZCD_NV_CONCENTRATOR_RADIUS); + int[] concentratorEnable = ncp.readConfiguration(ZstackConfigId.ZCD_NV_CONCENTRATOR_ENABLE); + int[] concentratorRc = ncp.readConfiguration(ZstackConfigId.ZCD_NV_CONCENTRATOR_RC); + int[] concentratorDiscovery = ncp.readConfiguration(ZstackConfigId.ZCD_NV_CONCENTRATOR_DISCOVERY); + int[] routeExpiry = ncp.readConfiguration(ZstackConfigId.ZCD_NV_ROUTE_EXPIRY_TIME); + int[] stackProfile = ncp.readConfiguration(ZstackConfigId.ZCD_NV_STACK_PROFILE); + + out.println("User Description : " + hex2String(userDesc)); + out.println("BDB Device On Network : " + hex2Boolean(bdbDeviceOnNwk)); + out.println("Stack Profile : " + hex2Uint8(stackProfile)); + out.println("Route Expiry : " + hex2Uint8(routeExpiry)); + + out.println("Concentrator Enabled : " + hex2Boolean(concentratorEnable)); + out.println("Concentrator Radius : " + hex2Uint8(concentratorRadius)); + out.println("Concentrator Discovery Enabled : " + hex2Boolean(concentratorDiscovery)); + out.println("Concentrator Route Cache Enabled : " + hex2Boolean(concentratorRc)); + + if (deviceInfo == null) { + out.println("Device info : ERROR"); + } else { + out.println("Device State : " + deviceInfo.getDeviceState()); + out.println("NWK Address : " + deviceInfo.getShortAddr()); + out.println("IEEE Address : " + deviceInfo.getIeeeAddress()); + } + + if (nvInfo == null) { + out.println("NV Device info : ERROR"); + } else { + ZigBeeChannelMask channels = new ZigBeeChannelMask(nvInfo.getScanChannels()); + out.println("PAN ID : " + nvInfo.getPanId()); + out.println("Scan Channel : " + channels); + out.println("Preconfigured Key : " + nvInfo.getPreConfigKey()); + out.println("NV IEEE Address : " + nvInfo.getIeeeAddress()); + } + + if (ncpVersion == null) { + out.println("NCP Version : ERROR"); + } else { + out.println("Firmware version : " + ncpVersion.getMajorRel() + "." + + ncpVersion.getMinorRel() + "." + ncpVersion.getMaintRel()); + out.println("Product version : " + ncpVersion.getProduct()); + out.println("Transport version : " + ncpVersion.getTransportRev()); + } + + if (ncpCapabilities == null) { + out.println("NCP API Capabilities : ERROR"); + } else { + out.println("NCP API Capabilities : " + ncpCapabilities); + } + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/src/main/java/com/zsmartsystems/zigbee/dongle/cc2531/network/impl/CommandInterfaceImpl.java b/com.zsmartsystems.zigbee.dongle.cc2531/src/main/java/com/zsmartsystems/zigbee/dongle/cc2531/network/impl/CommandInterfaceImpl.java index 9089ca12c0..3229471353 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/src/main/java/com/zsmartsystems/zigbee/dongle/cc2531/network/impl/CommandInterfaceImpl.java +++ b/com.zsmartsystems.zigbee.dongle.cc2531/src/main/java/com/zsmartsystems/zigbee/dongle/cc2531/network/impl/CommandInterfaceImpl.java @@ -173,6 +173,17 @@ public void handlePacket(final ZToolPacket packet) { } } + private String frameToString(int[] inputBuffer) { + if (inputBuffer == null) { + return ""; + } + StringBuilder result = new StringBuilder(); + for (int data : inputBuffer) { + result.append(String.format("%02X ", data)); + } + return result.toString(); + } + /** * Send packet to dongle. * @@ -183,6 +194,7 @@ public void handlePacket(final ZToolPacket packet) { public void sendPacket(final ZToolPacket packet) throws IOException { logger.debug("-> {} ({}) ", packet.getClass().getSimpleName(), packet); final int[] pck = packet.getPacket(); + logger.debug("Sending frame {}", frameToString(pck)); sendRaw(pck); } diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java index a8d4d78a40..396530fee3 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java @@ -470,7 +470,7 @@ private void createStructureClass(Structure structure) throws FileNotFoundExcept continue; } if (autoSizers.get(parameter.name) != null) { - out.println(" " + parameter.name + "= deserializer.deserialize" + out.println(" " + parameter.name + " = deserializer.deserialize" + getTypeSerializer(parameter.data_type) + "(" + autoSizers.get(parameter.name) + ");"); continue; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project new file mode 100644 index 0000000000..eefabd1d51 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project @@ -0,0 +1,23 @@ + + + com.zsmartsystems.zigbee.dongle.zstack.autocode + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml new file mode 100644 index 0000000000..1f83e1b2d2 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.dongle.zstack.autocode + jar + + + UTF-8 + UTF-8 + + + + com.zsmartsystems + zigbee + 1.1.11-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.5 + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + + + + + + commons-io + commons-io + 2.4 + + + + commons-lang + commons-lang + 2.6 + + + + commons-codec + commons-codec + 1.8 + + + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java new file mode 100644 index 0000000000..b3a77cac08 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -0,0 +1,220 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Parameter; + +/** + * + * @author Chris Jackson + * + */ +public abstract class ClassGenerator { + protected int lineLen = 110; + protected String sourceRootPath = "../com.zsmartsystems.zigbee.dongle.zstack/src/main/java/"; + protected List importList = new ArrayList(); + + protected String stringToConstant(String value) { + value = value.replaceAll("\\(.*?\\) ?", ""); + value = value.trim(); + value = value.replace("+", "_Plus"); + value = value.replace(" ", "_"); + value = value.replace("-", "_"); + value = value.replace(".", "_"); + value = value.replace("/", "_"); + value = value.replaceAll("_+", "_"); + return value.toUpperCase(); + } + + private String toProperCase(String str) { + return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); + } + + private String toCamelCase(String value) { + value = value.replaceAll("\\(.*?\\) ?", ""); + value = value.replace("+", "_Plus"); + value = value.replace(" ", "_"); + value = value.replace("-", "_"); + value = value.replace(".", "_"); + value = value.replace("/", "_"); + value = value.replaceAll("_+", "_"); + String[] parts = value.split("_"); + String camelCaseString = ""; + for (String part : parts) { + camelCaseString = camelCaseString + toProperCase(part); + } + return camelCaseString; + } + + private String splitCamelCase(String str) { + String output = ""; + for (String w : str.split("(?") && line.contains("")) { + year = line.substring(line.indexOf("") + 14, line.indexOf("")); + break; + } + line = br.readLine(); + } + + br.close(); + + br = new BufferedReader(new FileReader("../src/etc/header.txt")); + line = br.readLine(); + + out.println("/**"); + while (line != null) { + out.println(" * " + line.replaceFirst("\\$\\{year\\}", year)); + line = br.readLine(); + } + out.println(" */"); + br.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected void outputWithLinebreak(PrintWriter out, String indent, String line) { + String[] words = line.replace("\t", " ").replace("\n", " ").split(" "); + if (words.length == 0) { + return; + } + + out.print(indent + " *"); + + int len = 2; + for (String word : words) { + if (word.trim().isEmpty()) { + continue; + } + if (word.equalsIgnoreCase("note:")) { + if (len > 2) { + out.println(); + } + out.println(indent + " *

"); + out.print(indent + " * Note:"); + len = 15; + continue; + } + if (len + word.length() > lineLen) { + out.println(); + out.print(indent + " *"); + len = 2; + } + out.print(" "); + out.print(word); + len += word.length(); + } + + if (len != 0) { + out.println(); + } + } + + protected String formatParameterString(Parameter parameter) { + if (parameter.displayType != null) { + switch (parameter.displayType.toLowerCase()) { + case "hex": + String size = ""; + if (parameter.displayLength != 0) { + size = "0" + parameter.displayLength; + } + return "String.format(\"%" + size + "X\", " + camelCaseToLowerCamelCase(parameter.name) + ")"; + default: + break; + } + } + return camelCaseToLowerCamelCase(parameter.name); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java new file mode 100644 index 0000000000..d18a3a08d4 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -0,0 +1,775 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Command; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Command.ZstackRequestType; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Enumeration; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Parameter; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Protocol; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Structure; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Value; + +/** + * + * @author Chris Jackson + * + */ +public class CommandGenerator extends ClassGenerator { + protected final String zssPackage = "com.zsmartsystems.zigbee"; + protected final String zstackCommandPackage = "com.zsmartsystems.zigbee.dongle.zstack.api"; + + private List enumerations; + + public void go(Protocol protocol) throws FileNotFoundException { + enumerations = protocol.enumerations; + + String className; + for (Command command : protocol.commands) { + String name = camelCaseToUpperCamelCase(command.name); + if (command.requestType == ZstackRequestType.ASYNC) { + className = "Zstack" + name + "Areq"; + createCommandClass(className, command, command.request_parameters); + } else if (command.requestType == ZstackRequestType.ASYNCMD) { + className = "Zstack" + name + "Acmd"; + createCommandClass(className, command, command.request_parameters); + } else { + if (command.request_parameters != null) { + className = "Zstack" + name + "Sreq"; + createCommandClass(className, command, command.request_parameters); + } + + if (command.response_parameters != null) { + className = "Zstack" + name + "Srsp"; + createCommandClass(className, command, command.response_parameters); + } + } + } + + createZstackFrameFactory(protocol); + + for (Structure structure : protocol.structures) { + // createStructureClass(structure); + } + + for (Enumeration enumeration : protocol.enumerations) { + createEnumClass(enumeration); + } + } + + private void createCommandClass(String className, Command command, List parameters) + throws FileNotFoundException { + + System.out.println("Processing command class " + command.name + " [" + className + "()]"); + + StringWriter stringWriter = new StringWriter(); + PrintWriter out = new PrintWriter(stringWriter); + + clearImports(); + + out.println("/**"); + out.println(" * Class to implement the Z-Stack command " + command.name + "."); + out.println(" *

"); + if (command.description != null && !command.description.isEmpty()) { + outputWithLinebreak(out, "", command.description); + out.println(" *

"); + } + out.println(" * Note that this code is autogenerated. Manual changes may be overwritten."); + out.println(" *"); + out.println(" * @author Chris Jackson"); + out.println(" */"); + + if (className.endsWith("Srsp") || className.endsWith("Areq")) { + addImport(zstackCommandPackage + ".ZstackFrameResponse"); + out.println("public class " + className + " extends ZstackFrameResponse {"); + } else { + addImport(zstackCommandPackage + ".ZstackFrameRequest"); + out.println("public class " + className + " extends ZstackFrameRequest {"); + } + + for (Parameter parameter : parameters) { + if (parameter.auto_size != null) { + continue; + } + + out.println(); + out.println(" /**"); + if (parameter.description != null && !parameter.description.isEmpty()) { + outputWithLinebreak(out, " ", parameter.description); + } + if (parameter.multiple) { + out.println(" *

"); + out.println(" * Parameter allows multiple options so implemented as a {@link Set}."); + } + out.println(" */"); + if (parameter.multiple) { + addImport("java.util.Set"); + addImport("java.util.HashSet"); + out.println(" private Set<" + getTypeClass(command.subsystem, parameter.data_type) + "> " + + camelCaseToLowerCamelCase(parameter.name) + " = new HashSet<>();"); + } else { + out.println(" private " + getTypeClass(command.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ";"); + } + + // out.println(" private " + getTypeClass(command.subsystem, parameter.data_type) + " " + // + camelCaseToLowerCamelCase(parameter.name) + ";"); + } + + if (className.endsWith("Srsp") || className.endsWith("Areq")) { + out.println(); + out.println(" /**"); + out.println(" * Response and Handler constructor"); + out.println(" */"); + out.println(" public " + className + "(int[] inputBuffer) {"); + out.println(" // Super creates deserializer and reads header fields"); + out.println(" super(inputBuffer);"); + if (className.endsWith("Srsp")) { + out.println(); + out.println(" synchronousCommand = true;"); + } + out.println(); + out.println(" // Deserialize the fields"); + Map autoSizers = new HashMap(); + for (Parameter parameter : parameters) { + if (parameter.auto_size != null) { + out.println(" int " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "();"); + autoSizers.put(parameter.auto_size, camelCaseToLowerCamelCase(parameter.name)); + continue; + } + if (autoSizers.get(parameter.name) != null) { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + + autoSizers.get(parameter.name) + ");"); + continue; + } + if (parameter.data_type.contains("[") && parameter.data_type.contains("]") + && !parameter.data_type.contains("[]")) { + int length = Integer.parseInt(parameter.data_type.substring(parameter.data_type.indexOf("[") + 1, + parameter.data_type.indexOf("]"))); + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + length + ");"); + continue; + } + if (getDataType(parameter.data_type) != parameter.data_type) { + if (parameter.multiple) { + out.println(" " + getTypeClass(command.subsystem, getDataType(parameter.data_type)) + + " tmp" + upperCaseFirstCharacter(parameter.name) + " = deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "();"); + out.println(" for (" + getTypeClass(parameter.data_type) + " value : " + + getTypeClass(parameter.data_type) + ".values()) {"); + out.println(" if ((tmp" + upperCaseFirstCharacter(parameter.name) + + " & value.getKey()) != 0) {"); + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + ".add(value);"); + out.println(" }"); + out.println(" }"); + } else { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = " + parameter.data_type + + ".valueOf(deserialize" + getTypeSerializer(command.subsystem, parameter.data_type) + + "());"); + } + } else { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "();"); + } + } + out.println(" }"); + } else { + out.println(); + out.println(" /**"); + out.println(" * Request constructor"); + out.println(" */"); + out.println(" public " + className + "() {"); + if (className.endsWith("Sreq")) { + out.println(" synchronousCommand = true;"); + } + out.println(" }"); + } + + for (Parameter parameter : parameters) { + if (parameter.auto_size != null) { + continue; + } + + out.println(); + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + if (parameter.multiple) { + out.println(" * @return the current " + camelCaseToLowerCamelCase(parameter.name) + + " as {@link Set} of {@link " + getTypeClass(command.subsystem, parameter.data_type) + "}"); + } else { + out.println(" * @return the current " + camelCaseToLowerCamelCase(parameter.name) + " as {@link " + + getTypeClass(command.subsystem, parameter.data_type) + "}"); + } + out.println(" */"); + if (parameter.multiple) { + out.println(" public Set<" + getTypeClass(command.subsystem, parameter.data_type) + "> get" + + upperCaseFirstCharacter(parameter.name) + "() {"); + } else { + out.println(" public " + getTypeClass(command.subsystem, parameter.data_type) + " get" + + upperCaseFirstCharacter(parameter.name) + "() {"); + } + + out.println(" return " + camelCaseToLowerCamelCase(parameter.name) + ";"); + out.println(" }"); + out.println(); + + if (parameter.multiple) { + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to add to the {@link Set} as {@link " + getTypeClass(command.subsystem, parameter.data_type) + + "}"); + out.println(" */"); + out.println(" public void add" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(command.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + ".add(" + + camelCaseToLowerCamelCase(parameter.name) + ");"); + out.println(" }"); + out.println(); + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to remove to the {@link Set} as {@link " + + getTypeClass(command.subsystem, parameter.data_type) + "}"); + out.println(" */"); + out.println(" public void remove" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(command.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + ".remove(" + + camelCaseToLowerCamelCase(parameter.name) + ");"); + out.println(" }"); + } else { + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to set as {@link " + getTypeClass(command.subsystem, parameter.data_type) + "}"); + out.println(" */"); + out.println(" public void set" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(command.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + " = " + + camelCaseToLowerCamelCase(parameter.name) + ";"); + out.println(" }"); + } + } + + if (className.endsWith("Srsp") || className.endsWith("Areq")) { + } else { + if (className.endsWith("Sreq")) { + addImport(zstackCommandPackage + ".rpc.ZstackRpcSreqErrorSrsp"); + out.println(); + out.println(" @Override"); + out.println(" public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) {"); + out.println(" return (((response.getReqCmd0() & 0x1F) == ZSTACK_" + command.subsystem + + ") && (response.getReqCmd1() == " + String.format("0x%02X", command.id) + "));"); + out.println(" }"); + } + + out.println(); + out.println(" @Override"); + out.println(" public int[] serialize() {"); + out.println(" // Serialize the header"); + out.println(" serializeHeader(ZSTACK_" + className.substring(className.length() - 4).toUpperCase() + + ", ZSTACK_" + command.subsystem + ", " + String.format("0x%02X", command.id) + ");"); + out.println(); + out.println(" // Serialize the fields"); + for (Parameter parameter : parameters) { + String enumModifier = ""; + if (getDataType(parameter.data_type) != parameter.data_type) { + enumModifier = ".getKey()"; + } + if (parameter.auto_size != null) { + out.println(" serialize" + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + + camelCaseToLowerCamelCase(parameter.auto_size) + ".length);"); + continue; + } + if (parameter.multiple) { + out.println(" " + getTypeClass(command.subsystem, getDataType(parameter.data_type)) + " tmp" + + upperCaseFirstCharacter(parameter.name) + " = 0;"); + out.println(" for (" + getTypeClass(parameter.data_type) + " value : " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" tmp" + upperCaseFirstCharacter(parameter.name) + " += value.getKey();"); + out.println(" }"); + out.println(" serialize" + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + + "tmp" + upperCaseFirstCharacter(parameter.name) + ");"); + } else { + out.println(" serialize" + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + + camelCaseToLowerCamelCase(parameter.name) + enumModifier + ");"); + } + } + out.println(" return getPayload();"); + out.println(" }"); + } + + out.println(); + out.println(" @Override"); + out.println(" public String toString() {"); + + if (parameters == null || parameters.size() == 0) { + out.println(" return \"" + className + " []\";"); + } else { + out.println(" final StringBuilder builder = new StringBuilder(" + + (className.length() + 3 + parameters.size() * 25) + ");"); + boolean first = true; + for (Parameter parameter : parameters) { + if (parameter.auto_size != null) { + continue; + } + + if (first) { + out.println(" builder.append(\"" + className + " [" + + camelCaseToLowerCamelCase(parameter.name) + "=\");"); + } else { + out.println(" builder.append(\", " + camelCaseToLowerCamelCase(parameter.name) + "=\");"); + } + first = false; + if (parameter.data_type.contains("[")) { + out.println(" for (int c = 0; c < " + camelCaseToLowerCamelCase(parameter.name) + + ".length; c++) {"); + out.println(" if (c > 0) {"); + out.println(" builder.append(' ');"); + out.println(" }"); + out.println(" builder.append(String.format(\"%02X\", " + formatParameterString(parameter) + + "[c]));"); + out.println(" }"); + } else { + out.println(" builder.append(" + formatParameterString(parameter) + ");"); + } + } + out.println(" builder.append(']');"); + out.println(" return builder.toString();"); + } + out.println(" }"); + + out.println("}"); + + out.flush(); + + String cmdPackage = zstackCommandPackage + "." + command.subsystem.toLowerCase().replace("_", ""); + File packageFile = new File(sourceRootPath + cmdPackage.replace(".", "/")); + packageFile.mkdirs(); + PrintWriter outFile = getClassOut(packageFile, className); + + outputCopywrite(outFile); + outFile.println("package " + cmdPackage + ";"); + + outFile.println(); + + outputImports(outFile); + + outFile.println(); + outFile.print(stringWriter.toString()); + + outFile.flush(); + outFile.close(); + + out.close(); + } + + private void createEnumClass(Enumeration enumeration) throws FileNotFoundException { + String className = upperCaseFirstCharacter(enumeration.name); + System.out.println("Processing enum class " + enumeration.name + " [" + className + "()]"); + + StringWriter stringWriter = new StringWriter(); + PrintWriter out = new PrintWriter(stringWriter); + + clearImports(); + + addImport("java.util.Map"); + addImport("java.util.HashMap"); + + out.println("/**"); + out.println(" * Class to implement the Z-Stack Enumeration " + enumeration.name + "."); + if (enumeration.description != null && enumeration.description.trim().length() > 0) { + out.println(" *

"); + outputWithLinebreak(out, "", enumeration.description); + } + out.println(" *

"); + out.println(" * Note that this code is autogenerated. Manual changes may be overwritten."); + out.println(" *"); + out.println(" * @author Chris Jackson"); + out.println(" */"); + + out.println("public enum " + className + " {"); + + out.println(" /**"); + out.println(" * Default unknown value"); + out.println(" */"); + out.println(" UNKNOWN(-1),"); + + boolean first = true; + for (Value value : enumeration.values) { + if (!first) { + out.println(","); + } + first = false; + out.println(); + out.println(" /**"); + outputWithLinebreak(out, " ", value.description); + out.println(" */"); + out.print(" " + super.stringToConstant(value.name) + "(0x" + String.format("%04X", value.enum_value) + + ")"); + } + + out.println(";"); + + out.println(); + out.println(" /**"); + out.println(" * A mapping between the integer code and its corresponding type to"); + out.println(" * facilitate lookup by code."); + out.println(" */"); + out.println(" private static Map codeMapping;"); + out.println(); + + out.println(" private int key;"); + out.println(); + + out.println(" static {"); + out.println(" codeMapping = new HashMap();"); + out.println(" for (" + className + " s : values()) {"); + out.println(" codeMapping.put(s.key, s);"); + out.println(" }"); + out.println(" }"); + out.println(); + + out.println(" private " + className + "(int key) {"); + out.println(" this.key = key;"); + out.println(" }"); + out.println(); + + out.println(" /**"); + out.println(" * Lookup function based on the type code. Returns null if the code does not exist."); + out.println(" *"); + out.println(" * @param code the code to lookup"); + out.println(" * @return enumeration value of the alarm type."); + out.println(" */"); + out.println(" public static " + className + " valueOf(int code) {"); + out.println(" if (codeMapping.get(code) == null) {"); + out.println(" return UNKNOWN;"); + out.println(" }"); + out.println(); + + out.println(" return codeMapping.get(code);"); + out.println(" }"); + out.println(); + out.println(" /**"); + out.println(" * Returns the Z-Stack protocol defined value for this enumeration."); + out.println(" *"); + out.println(" * @return the Z-Stack protocol key"); + out.println(" */"); + out.println(" public int getKey() {"); + out.println(" return key;"); + out.println(" }"); + + out.println("}"); + + out.flush(); + + String packageName = zstackCommandPackage; + if (!enumeration.subsystem.isEmpty()) { + packageName += "." + enumeration.subsystem.toLowerCase().replace("_", ""); + } + + File packageFile = new File(sourceRootPath + packageName.replace(".", "/")); + PrintWriter outFile = getClassOut(packageFile, className); + + outputCopywrite(outFile); + outFile.println("package " + packageName + ";"); + + outFile.println(); + + outputImports(outFile); + + outFile.println(); + outFile.print(stringWriter.toString()); + + outFile.flush(); + outFile.close(); + + out.close(); + } + + protected String getDataType(String dataType) { + for (Enumeration enumeration : enumerations) { + if (enumeration.name.equals(dataType) && enumeration.data_type != null) { + return enumeration.data_type; + } + } + + return dataType; + } + + protected String getTypeClass(String dataType) { + return getTypeClass("", dataType); + } + + protected String getTypeClass(String subsystem, String dataType) { + if (dataType == null || dataType.isEmpty()) { + throw new IllegalArgumentException("dataType cannot be empty"); + } + String dataTypeLocal = new String(dataType); + if (dataType.contains("[")) { + dataTypeLocal = dataTypeLocal.substring(0, dataTypeLocal.indexOf("[") + 1); + } + + for (Enumeration enumeration : enumerations) { + if (enumeration.name.equals(dataType) && !enumeration.subsystem.equals(subsystem)) { + String packageName = zstackCommandPackage; + if (!enumeration.subsystem.isEmpty()) { + packageName += "." + enumeration.subsystem.toLowerCase().replace("_", ""); + } + + addImport(packageName + "." + dataTypeLocal); + } + } + + switch (dataTypeLocal) { + case "int8": + case "uint8": + case "uint16": + case "uint32": + return "int"; + case "uint8[": + case "uint16[": + return "int[]"; + case "IeeeAddress": + addImport(zssPackage + "." + dataTypeLocal); + return dataTypeLocal; + case "ZigBeeKey": + addImport(zssPackage + ".security." + dataTypeLocal); + return dataTypeLocal; + case "": + addImport(zstackCommandPackage + "." + dataTypeLocal); + return dataTypeLocal; + case "AfDataOptions": + addImport(zstackCommandPackage + ".af." + dataTypeLocal); + return dataTypeLocal; + default: + return dataType; + } + } + + protected String getTypeSerializer(String subsystem, String dataType) { + String dataTypeLocal = new String(dataType); + if (dataType.contains("[")) { + dataTypeLocal = dataTypeLocal.substring(0, dataTypeLocal.indexOf("[") + 1); + } + + for (Enumeration enumeration : enumerations) { + if (enumeration.name.equals(dataType) && enumeration.data_type != null) { + dataTypeLocal = enumeration.data_type; + } + } + + switch (dataTypeLocal) { + case "int8": + case "uint8": + return "UInt8"; + case "uint16": + return "UInt16"; + case "uint32": + return "UInt32"; + case "uint8[": + return "UInt8Array"; + case "uint16[": + return "UInt16Array"; + case "boolean": + return "Boolean"; + case "AF_DISCV_ROUTE": + case "AfDataOptions": + return dataTypeLocal; + default: + return dataType; + } + } + + private void createZstackFrameFactory(Protocol protocol) throws FileNotFoundException { + StringWriter stringWriter = new StringWriter(); + PrintWriter out = new PrintWriter(stringWriter); + + clearImports(); + + addImport("java.lang.reflect.Constructor"); + addImport("java.lang.reflect.InvocationTargetException"); + addImport("java.util.HashMap"); + addImport("java.util.Map"); + addImport("org.slf4j.Logger"); + addImport("org.slf4j.LoggerFactory"); + + Map commandMap = new TreeMap<>(); + for (Command command : protocol.commands) { + commandMap.put(command.name, command); + } + + out.println(); + + out.println("/**"); + out.println( + " * Factory class to create Z-Stack commands from incoming data. This will only create {@link ZstackFrameResponse}s."); + out.println(" *

"); + out.println(" * Note that this code is autogenerated. Manual changes may be overwritten."); + out.println(" *"); + out.println(" * @author Chris Jackson"); + out.println(" */"); + out.println("public class ZstackFrameFactory {"); + out.println(" /**"); + out.println(" * Logger"); + out.println(" */"); + out.println(" private static Logger logger = LoggerFactory.getLogger(ZstackFrameFactory.class);"); + + out.println(); + + out.println(" /*"); + out.println(" * Subsystem definitions"); + out.println(" */"); + out.println(" public static int ZSTACK_RPC = 0x0000;"); + out.println(" public static int ZSTACK_SYS = 0x0100;"); + out.println(" public static int ZSTACK_MAC = 0x0200;"); + out.println(" public static int ZSTACK_AF = 0x0400;"); + out.println(" public static int ZSTACK_ZDO = 0x0500;"); + out.println(" public static int ZSTACK_SAPI = 0x0600;"); + out.println(" public static int ZSTACK_UTIL = 0x0700;"); + out.println(" public static int ZSTACK_APP_CNF = 0x0F00;"); + out.println(" public static int ZSTACK_SBL = 0x0D00;"); + out.println(); + out.println(" /**"); + out.println(" * Subsystem definition mask"); + out.println(" */"); + out.println(" private static int ZSTACK_SUBSYSTEM_MASK = 0x1F;"); + out.println(); + + for (Command command : commandMap.values()) { + if (command.requestType == ZstackRequestType.ASYNCMD) { + continue; + } + + String reference = camelCaseToConstant( + command.name.substring(0, 1).toUpperCase() + command.name.substring(1)); + out.println( + " private static final int " + reference + " = 0x" + String.format("%02X", command.id) + ";"); + } + + out.println(); + out.println(" private static Map> zstackFrameMap = new HashMap>();"); + out.println(); + out.println(" static {"); + for (Command command : commandMap.values()) { + String name = camelCaseToUpperCamelCase(command.name); + String className; + + String cmdPackage = zstackCommandPackage + "." + command.subsystem.toLowerCase().replace("_", ""); + + if (command.requestType == ZstackRequestType.ASYNC) { + className = "Zstack" + name + "Areq"; + addImport(cmdPackage + "." + className); + + String reference = camelCaseToConstant( + command.name.substring(0, 1).toUpperCase() + command.name.substring(1)); + out.println(" zstackFrameMap.put(ZSTACK_" + command.subsystem + " + " + reference + ", " + + className + ".class);"); + } else if (command.requestType == ZstackRequestType.ASYNCMD) { + // className = "Zstack" + name + "Acmd"; + // addImport(cmdPackage + "." + className); + + // String reference = camelCaseToConstant( + // command.name.substring(0, 1).toUpperCase() + command.name.substring(1)); + // out.println(" zstackFrameMap.put(ZSTACK_" + command.subsystem + " + " + reference + ", " + // + className + ".class);"); + } else { + // className = "Zstack" + name + "Sreq"; + // addImport(cmdPackage + "." + className); + + // String reference = camelCaseToConstant( + // command.name.substring(0, 1).toUpperCase() + command.name.substring(1)); + // out.println(" zstackFrameMap.put(ZSTACK_" + command.subsystem + " + " + reference + ", " + // + className + ".class);"); + + className = "Zstack" + name + "Srsp"; + addImport(cmdPackage + "." + className); + + String reference = camelCaseToConstant( + command.name.substring(0, 1).toUpperCase() + command.name.substring(1)); + out.println(" zstackFrameMap.put(ZSTACK_" + command.subsystem + " + " + reference + ", " + + className + ".class);"); + } + } + + out.println(" }"); + out.println(); + + out.println(" /**"); + out.println(" * Creates and {@link ZstackFrameResponse} from the incoming data."); + out.println(" *"); + out.println(" * @param data the int[] containing the ZStack data from which to generate the frame"); + out.println(" * @return the {@link ZstackFrameResponse} or null if the response can't be created."); + out.println(" */"); + out.println(" public static ZstackFrameResponse createFrame(int[] data) {"); + out.println(" if (data.length < 2) {"); + out.println(" return null;"); + out.println(" }"); + out.println(); + out.println(" int cmdId = ((data[0] & ZSTACK_SUBSYSTEM_MASK) << 8) + data[1];"); + out.println(" Class zstackClass = zstackFrameMap.get(cmdId);"); + out.println(); + out.println(" if (zstackClass == null) {"); + out.println(" return null;"); + out.println(" }"); + out.println(); + out.println(" Constructor ctor;"); + out.println(" try {"); + out.println(" ctor = zstackClass.getConstructor(int[].class);"); + out.println(" return (ZstackFrameResponse) ctor.newInstance(data);"); + out.println( + " } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | InstantiationException"); + out.println(" | IllegalAccessException | InvocationTargetException e) {"); + out.println(" logger.debug(\"Error creating instance of ZstackCommand\", e);"); + out.println(" }"); + out.println(); + out.println(" return null;"); + out.println(" }"); + out.println(); + + out.println(); + out.println("}"); + + out.flush(); + + File packageFile = new File(sourceRootPath + zstackCommandPackage.replace(".", "/")); + PrintWriter outFile = getClassOut(packageFile, "ZstackFrameFactory"); + + outputCopywrite(outFile); + + outFile.println("package " + zstackCommandPackage + ";"); + outFile.println(); + outputImports(outFile); + + outFile.println(); + outFile.print(stringWriter.toString()); + + outFile.flush(); + outFile.close(); + + out.close(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java new file mode 100644 index 0000000000..fbad33afac --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java @@ -0,0 +1,250 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Command; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Command.ZstackRequestType; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Enumeration; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Parameter; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Protocol; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Structure; +import com.zsmartsystems.zigbee.dongle.zstack.autocode.xml.Value; + +/** + * Autocoder to generate Java class files for Z-Stack dongle + * + * @author Chris Jackson + * + */ +public class ZstackAutocoder { + public static void main(final String[] args) { + + Protocol protocol; + try { + // Load the class definitions + File fXmlFile = new File("src/main/resources/zstack_protocol.xml"); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(fXmlFile); + doc.getDocumentElement().normalize(); + + NodeList nList = doc.getElementsByTagName("protocol"); + protocol = (Protocol) processNode(nList.item(0)); + + } catch (Exception e) { + e.printStackTrace(); + return; + } + + System.out.println("Generating code..."); + + try { + new CommandGenerator().go(protocol); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + private static Object processNode(Node node) { + System.out.println("\nCurrent Element :" + node.getNodeName()); + + NodeList nodes = node.getChildNodes(); + + switch (node.getNodeName()) { + case "protocol": + Protocol protocol = new Protocol(); + protocol.commands = new ArrayList<>(); + protocol.structures = new ArrayList<>(); + protocol.enumerations = new ArrayList<>(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("command")) { + protocol.commands.add((Command) processNode(nodes.item(temp))); + } + if (nodes.item(temp).getNodeName().equals("structure")) { + protocol.structures.add((Structure) processNode(nodes.item(temp))); + } + if (nodes.item(temp).getNodeName().equals("enum")) { + protocol.enumerations.add((Enumeration) processNode(nodes.item(temp))); + } + } + return protocol; + case "command": + Command command = new Command(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("name")) { + command.name = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("id")) { + String id = nodes.item(temp).getTextContent(); + if (id.startsWith("0x")) { + command.id = Integer.parseInt(id.substring(2), 16); + } else { + command.id = Integer.parseInt(id.substring(2)); + } + } + if (nodes.item(temp).getNodeName().equals("description")) { + command.description = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("subsystem")) { + command.subsystem = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("type")) { + command.requestType = ZstackRequestType.valueOf(nodes.item(temp).getTextContent().trim()); + } + + if (nodes.item(temp).getNodeName().equals("request")) { + if (command.request_parameters == null) { + command.request_parameters = new ArrayList<>(); + } + command.request_parameters = (List) processNode(nodes.item(temp)); + } + if (nodes.item(temp).getNodeName().equals("response")) { + if (command.response_parameters == null) { + command.response_parameters = new ArrayList<>(); + } + command.response_parameters = (List) processNode(nodes.item(temp)); + } + } + System.out.println("Done: Command - " + command.name); + return command; + case "request": + case "response": + case "parameters": + List parameters = new ArrayList<>(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("parameter")) { + parameters.add((Parameter) processNode(nodes.item(temp))); + } + } + return parameters; + case "parameter": + Parameter parameter = new Parameter(); + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("data_type")) { + parameter.data_type = nodes.item(temp).getTextContent(); + Element dataTypeElement = (Element) nodes.item(temp); + parameter.multiple = dataTypeElement.getAttribute("multiple").equalsIgnoreCase("true"); + } + if (nodes.item(temp).getNodeName().equals("name")) { + parameter.name = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("description")) { + parameter.description = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("auto_size")) { + parameter.auto_size = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("display")) { + String display = nodes.item(temp).getTextContent().trim(); + if (display.contains("[") && display.contains("]")) { + parameter.displayType = display.substring(0, display.indexOf('[')); + parameter.displayLength = Integer + .parseInt(display.substring(display.indexOf('[') + 1, display.indexOf(']'))); + } + } + } + System.out.println("Done: Parameter - " + parameter.name); + return parameter; + case "structure": + Structure structure = new Structure(); + structure.parameters = new ArrayList<>(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("name")) { + structure.name = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("description")) { + structure.description = nodes.item(temp).getTextContent().trim(); + } + + if (nodes.item(temp).getNodeName().equals("parameters")) { + structure.parameters = (List) processNode(nodes.item(temp)); + } + } + System.out.println("Done: Structure - " + structure.name); + return structure; + case "enum": + Enumeration enumeration = new Enumeration(); + enumeration.values = new ArrayList(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("name")) { + enumeration.name = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("data_type")) { + enumeration.data_type = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("description")) { + enumeration.description = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("values")) { + enumeration.values = (List) processNode(nodes.item(temp)); + } + if (nodes.item(temp).getNodeName().equals("format")) { + enumeration.format = nodes.item(temp).getTextContent().trim(); + } + if (nodes.item(temp).getNodeName().equals("subsystem")) { + enumeration.subsystem = nodes.item(temp).getTextContent().trim(); + } + } + System.out.println("Done: Enum - " + enumeration.name); + return enumeration; + case "values": + List values = new ArrayList<>(); + + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("value")) { + values.add((Value) processNode(nodes.item(temp))); + } + } + return values; + case "value": + Value value = new Value(); + for (int temp = 0; temp < nodes.getLength(); temp++) { + if (nodes.item(temp).getNodeName().equals("name")) { + value.name = nodes.item(temp).getTextContent(); + } + if (nodes.item(temp).getNodeName().equals("enum_value")) { + String id = nodes.item(temp).getTextContent().trim(); + if (id.startsWith("0x")) { + value.enum_value = Integer.parseInt(id.substring(2), 16); + } else { + value.enum_value = Integer.parseInt(id); + } + } + if (nodes.item(temp).getNodeName().equals("description")) { + value.description = nodes.item(temp).getTextContent().trim(); + } + } + System.out.println("Done: Value - " + value.name); + return value; + default: + System.out.println("Uknown node " + node.getNodeName()); + break; + } + + return null; + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java new file mode 100644 index 0000000000..cdf11509cb --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +import java.util.List; + +/** + * + * @author Chris Jackson + * + */ +public class Command { + public String name; + public String subsystem; + public Integer id; + public String description; + public ZstackRequestType requestType; + public List request_parameters; + public List response_parameters; + + public enum ZstackRequestType { + SYNC, + ASYNC, + ASYNCMD, + BOOT + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java new file mode 100644 index 0000000000..dab179bdb1 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +import java.util.List; + +/** + * + * @author Chris Jackson + * + */ +public class Enumeration { + public String name; + public String description; + public String subsystem; + public String format; + public List values; + public String data_type; +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java new file mode 100644 index 0000000000..757f2c68fc --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +/** + * + * @author Chris Jackson + * + */ +public class Parameter { + public String data_type; + public String name; + public String description; + public String auto_size; + public Boolean multiple; + public String displayType; + public int displayLength; +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java new file mode 100644 index 0000000000..6d5384f150 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +import java.util.List; + +/** + * + * @author Chris Jackson + * + */ +public class Protocol { + public List commands; + public List structures; + public List enumerations; +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java new file mode 100644 index 0000000000..4e34ee948d --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +import java.util.List; + +/** + * + * @author Chris Jackson + * + */ +public class Structure { + public String name; + public String description; + public List parameters; +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java new file mode 100644 index 0000000000..5ba82665ee --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.autocode.xml; + +/** + * + * @author Chris Jackson + * + */ +public class Value { + public String name; + public String description; + public Integer enum_value; +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml new file mode 100644 index 0000000000..650f04a865 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -0,0 +1,3028 @@ + + + + RPC_SREQ_ERROR + RPC + 0x00 + When the ZNP cannot recognize an SREQ command from the host processor, the following SRSP is returned. + + SYNC + + + ZstackSreqErrorCode + ErrorCode + The error code maps to one of the enumerated values. + + + uint8 + ReqCmd0 + hex[2] + The Cmd0 value of the processed SREQ + + + uint8 + ReqCmd1 + hex[2] + The Cmd1 value of the processed SREQ + + + + + + + SYS_RESET_REQ + SYS + 0x00 + This command is issued by the application processor to reset the CC2530 device. The reset is achieved + through an internal watchdog reset on the CC2530. Note that the hardware reset interface is recommended over using + this interface. + + ASYNCMD + + + ZstackResetType + Type + This requests a target device reset (0) or serial bootloader reset (1). If the target device does not + support serial bootloading, bootloader reset commands are ignored and no response is sent from the target. + + + + + + + + + SYS_VERSION + SYS + 0x02 + This command is used to request for the device’s version string. + SYNC + + + + + uint8 + TransportRev + Transport protocol revision + + + uint8 + Product + Product Id + + + uint8 + MajorRel + Software major release number + + + uint8 + MinorRel + Software minor release number + + + uint8 + HwRev + Hardware revision number. + + + + + + SYS_RESET_IND + SYS + 0x80 + This command is generated by the CC2530 device automatically immediately after a reset. + ASYNC + + + ZstackResetReason + Reason + One of the following values indicating the reason for the reset. Power=0x00, External=0x01, + Watchdog=0x02 + + + + uint8 + TransportRev + Transport protocol revision + + + uint8 + Product + Product Id + + + uint8 + MajorRel + Software major release number + + + uint8 + MinorRel + Software minor release number + + + uint8 + HwRev + Hardware revision number. + + + + + + + + SYS_PING + SYS + 0x01 + This command issues PING requests to verify if a device is active and check the capability of the device. + + SYNC + + + + + uint16 + Capabilities + This field represents the interfaces that this device can handle (compiled into the device). + + hex[4] + + + + + + SYS_VERSION + SYS + 0x02 + This command issues PING requests to verify if a device is active and check the capability of the device. + + SYNC + + + + + uint8 + TransportRev + Transport protocol revision + + + uint8 + Product + Product Id + + + uint8 + MajorRel + Software major release number + + + uint8 + MinorRel + Software minor release number + + + uint8 + MaintRel + Software maintenance release number + + + + + + SYS_SET_EXT_ADDR + SYS + 0x03 + This command is used to set the extended address of the device. + SYNC + + + IeeeAddress + ExtAddress + The device’s extended address. + + + + + ZstackResponseCode + Status + Status is either Success (1) or Failure (0) + + + + + + SYS_GET_EXT_ADDR + SYS + 0x04 + This command is used to set the extended address of the device. + SYNC + + + + + IeeeAddress + ExtAddress + The device’s extended address. + + + + + + SYS_OSAL_NV_READ + SYS + 0x08 + This command is used to read a single memory item from the target non-volatile memory. The command + accepts an attribute Id value and data offset and returns the memory value present in the target for the specified + attribute Id. + + SYNC + + + ZstackConfigId + id + The Id of the NV item. + + + uint8 + Offset + Number of bytes offset from the beginning or the NV value. + + + + + ZstackResponseCode + status + Status is either Success (0) or Failure (1). + + + uint8 + Len + Value + Length of the NV value. + + + uint8[] + Value + Value of the NV item. + + + + + + SYS_OSAL_NV_WRITE + SYS + 0x09 + This command is used to write to a particular item in non-volatile memory. The command accepts an + attribute Id, data offset, data length, and attribute value. The attribute value is written to the location specified + for the attribute Id in the target. + + SYNC + + + ZstackConfigId + Id + The Id of the NV item. + + + uint8 + Offset + Number of bytes offset from the beginning or the NV value. + + + uint8 + Length + Value + Length of the NV value. + + + uint8[] + Value + Value of the NV item. + + + + + ZstackResponseCode + status + Status is either Success (0) or Failure (1). + + + + + + SYS_SET_TX_POWER + SYS + 0x14 + This command is used by the tester to set the target system radio transmit power. The returned TX power + is the actual setting applied to the radio – nearest characterized value for the specific radio. + + SYNC + + + int8 + TxPower + Requested TX power setting, in dBm. + + + + + int8 + TxPower + Requested TX power setting, in dBm. + + + + + + SYS_ZDIAGS_INIT_STATS + SYS + 0x17 + This command is used to initialize the statistics table in NV memory. + SYNC + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + SYS_ZDIAGS_CLEAR_STATS + SYS + 0x18 + This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the + clearNV flag shall be set to TRUE. + + SYNC + + + boolean + clearNV + TRUE – Clears statistics in NV memory including Boot Counter. + FALSE – Clears statistics in RAM only. + Boot Counter is preserved. + + + + + + uint32 + SysClock + Milliseconds since last reset. + + + + + + SYS_ZDIAGS_GET_STATS + SYS + 0x19 + This command is used to read a specific system (attribute) ID statistics and/or metrics value. + + SYNC + + + ZstackDiagnosticAttribute + AttributeID + System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + + + + + uint32 + AttributeValue + Value of the requested attribute. + + + + + + SYS_ZDIAGS_RESTORE_STATS_NV + SYS + 0x1A + This command is used to restore the statistics table from NV into the RAM table. + SYNC + + + ZstackDiagnosticAttribute + AttributeID + System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + SYS_ZDIAGS_SAVE_STATS_TO_NV + SYS + 0x1B + This command is used to save the statistics table from RAM to NV. + SYNC + + + + + uint32 + SysClock + Milliseconds since last reset. + + + + + + + + + + + AF_REGISTER + AF + 0x00 + This command enables the host processor to register an application’s endpoint description (and its simple + descriptor). Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be + useful in the case where the device needs to support multiple application profiles, where each AF_REGISTER call would + register a unique endpoint description per application profile. + + SYNC + + + uint8 + EndPoint + hex[2] + Specifies the endpoint of this simple descriptor. + + + uint16 + AppProfId + Specifies the profile id of the application. + + + uint16 + AppDeviceId + Specifies the device description id for this endpoint. + + + uint8 + AppDevVer + Specifies the device version number. + + + uint8 + LatencyReq + Specifies latency. For ZigBee the only applicable value is 0x00. + 0x00-No latency 0x01-fast beacons + 0x02-slow beacons + + + + uint8 + AppNumInClusters + AppInClusterList + the number of Input cluster Ids following in the AppInClusterList + + + uint16[] + AppInClusterList + Specifies the list of Input Cluster Ids ( 2bytes each ). + + + uint8 + AppNumOutClusters + AppOutClusterList + Specifies the number of Output cluster Ids following in the AppOutClusterList. + + + uint16[] + AppOutClusterList + Specifies the list of Output Cluster Ids ( 2bytes each ) + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + AF_DATA_REQUEST + AF + 0x01 + This command is used by the App processor to build and send a message through AF layer. + SYNC + + + uint16 + DstAddr + hex[4] + Short address of the destination device. + + + uint8 + DestEndpoint + hex[2] + Endpoint of the destination device. + + + uint8 + SrcEndpoint + hex[2] + Endpoint of the source device. + + + uint16 + ClusterID + hex[4] + Specifies the cluster ID. + + + uint8 + TransID + hex[2] + Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have + the same TransID. This can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + + + + AfDataOptions + Options + The transmit options field is organized as a bitmask. The following enumerates the values for the + various supported bitmasks. For example, a value of 0x10 means that bit 4 is set. + + + + uint8 + Radius + Specifies the list of Input Cluster Ids ( 2bytes each ). + + + uint8 + Len + Data + Length of the data. + + + uint8[] + Data + 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS + security (64 bytes). + + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + AF_DATA_CONFIRM + AF + 0x80 + This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each + AF_DATA_REQUEST, a AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the + confirm carries the status of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS + acknowledgement was not used, then the confirm carries the status of whether the MAC acknowledgement (“next hop” + acknowledgment) was received or not (ZMacNoACK – 0xe9). This also applies to packets that are sent using + AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of the configuration item + ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS acknowledgement is + received. + + ASYNC + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + uint8 + Endpoint + hex[2] + Endpoint of the device. + + + uint8 + TransId + hex[2] + Specifies the transaction sequence number of the message. + + + + + + + + AF_INCOMING_MSG + AF + 0x81 + This callback message is in response to incoming data to any of the registered endpoints on this device. + + ASYNC + + + uint16 + GroupId + hex[4] + Specifies the group ID of the device. + + + uint16 + ClusterId + hex[4] + Specifies the cluster ID. + + + uint16 + SrcAddr + hex[4] + Specifies the ZigBee network address of the source device sending the message. + + + uint8 + SrcEndpoint + hex[2] + Specifies the source endpoint of the message. + + + uint8 + DestEndpoint + hex[2] + Specifies the destination endpoint of the message. + + + boolean + WasBroadcast + Specifies if the message was a broadcast or not. + + + uint8 + LinkQuality + Indicates the link quality measured during reception. + + + boolean + SecurityUse + Specifies if the security is used or not. + + + uint32 + TimeStamp + hex[8] + Specifies the timestamp of the message. + + + uint8 + SeqNumber + hex[2] + Specifies transaction sequence number of the message. + + + uint8 + Len + Data + Specifies the length of the data. + + + uint8[] + Data + Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK + and APS security (64 bytes). + + + + + + + + + + ZDO_SET_LINK_KEY + ZDO + 0x23 + This command sets the application link key for a given device. + SYNC + + + uint16 + ShortAddr + hex[4] + Specifies the short address of the pair device of the link key. + + + IeeeAddress + IeeeAddr + Specifies the IEEE address of the pair device of the link key + + + ZigBeeKey + LinkKeyData + 128 bit link key data of the device. + + + + + ZstackResponseCode + Status + 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + + + + + + + ZDO_REMOVE_LINK_KEY + ZDO + 0x24 + This command removes the application link key of a given device. + SYNC + + + IeeeAddress + IeeeAddr + Specifies the IEEE address of the pair device of the link key + + + + + ZstackResponseCode + Status + 0x00 – Success. 0xC8 – Unknown device. + + + + + + ZDO_GET_LINK_KEY + ZDO + 0x25 + This command retrieves the application link key of a given device. + SYNC + + + IeeeAddress + IeeeAddr + Specifies the IEEE address of the pair device of the link key + + + + + ZstackResponseCode + Status + 0x00 – Success. 0xC8 – Unknown device. + + + IeeeAddress + IeeeAddr + Specifies the IEEE address of the pair device of the link key + + + ZigBeeKey + LinkKeyData + Link key data of the device + + + + + + ZDO_NWK_DISCOVERY_REQ + ZDO + 0x26 + This command is used to initiate a network discovery (active scan). + SYNC + + + uint32 + ScanChannels + Bit mask for channels to scan. + + + uint8 + ScanDuration + A value used to calculate the length of time to spend scanning each channel + + + + + ZstackResponseCode + Status + Success (0) + Invalid_Parameter (0x02). + ZNwkInvalidRequest (0xC2) if the device is already on a network. + User ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then + initiate the request. + MAC_SCAN_IN_PROGRESS + (0xFC) if a channel change is in progress. + MAC_NO_RESOURCE (0x1A) if the operation could not complete because no + memory resource were available. + + + + + + + ZDO_MSG_CB_REGISTER + ZDO + 0x3E + This command registers for a ZDO callback. + SYNC + + + uint16 + ClusterId + hex[4] + Specifies the ZDO Cluster Id for which to receive a ZDO callback. + + + + + ZstackResponseCode + Status + 0x00 – Success. + + + + + + ZDO_STARTUP_FROM_APP + ZDO + 0x40 + This command starts the device in the network. + SYNC + + + uint16 + StartDelay + Specifies the time delay before the device starts in milliseconds. + + + + + ZstackResponseCode + Status + This field indicates either SUCCESS (0) or FAILURE (1). + + + + + + ZDO_STATE_CHANGE_IND + ZDO + 0xC0 + This callback message indicates the ZDO state change. + ASYNC + + + ZstackZdoState + State + Specifies the changed ZDO state. An enumerated list starting from 0. + + + + + + + + ZDO_LEAVE_IND + ZDO + 0xC9 + This message is an indication to inform the host of a device leaving the network. + ASYNC + + + uint16 + SrcAddr + hex[4] + Short address (LSB-MSB) of the source of the leave indication. + + + IeeeAddress + ExtAddr + Extended address (LSB-MSB) of the source of the leave indication. + + + boolean + Request + Boolean, TRUE = request, FALSE = indication. + + + boolean + Remove + Boolean, TRUE = remove children. + + + boolean + Rejoin + Boolean, TRUE = rejoin. + + + + + + + + ZDO_TC_DEV_IND + ZDO + 0xCA + This message is a ZDO callback for TC Device Indication. This is an indication that the TC has delivered + the key to a recently joined device. + + ASYNC + + + uint16 + SrcAddr + hex[4] + Source network Address + + + IeeeAddress + ExtAddr + IEEE Address of the source + + + uint16 + ParentAddr + hex[4] + Network address of the parent + + + + + + + + ZDO_MSG_CB_INCOMING + ZDO + 0xFF + This message is a ZDO callback for a Cluster Id that the host requested to receive with a ZDO_ + MSG_CB_REGISTER request. + + ASYNC + + + uint16 + SrcAddr + hex[4] + Short address (LSB-MSB) of the source of the ZDO message. + + + boolean + WasBroadcast + This field indicates whether or not this ZDO message was broadcast. + + + uint16 + ClusterId + hex[4] + The ZDO Cluster Id of this message. + + + boolean + SecurityUse + N/A – not used. + + + uint8 + SeqNumber + hex[2] + The sequence number of this ZDO message. + + + uint16 + DstAddr + hex[4] + The MAC destination short address (LSB-MSB) of the ZDO message. + + + uint8[] + Data + The data that corresponds to the Cluster Id of the message + + + + + + + + + + + ZB_READ_CONFIGURATION + SAPI + 0x04 + This command is used to get a configuration property from non-volatile memory. + SYNC + + + ZstackConfigId + ConfigId + Specifies the Identifier for the configuration property. + + + + + ZstackResponseCode + Status + This field indicates either SUCCESS (0) or FAILURE (1). + + + ZstackConfigId + ConfigId + Specifies the Identifier for the configuration property. + + + uint8 + Len + Value + Specifies the size of the Value buffer in bytes. + + + uint8[] + Value + Buffer to hold the configuration property. + + + + + + ZB_WRITE_CONFIGURATION + SAPI + 0x05 + This command is used to write a configuration property to nonvolatile memory. + SYNC + + + ZstackConfigId + ConfigId + Specifies the Identifier for the configuration property. + + + uint8 + Len + Specifies the size of the Value buffer in bytes. + Value + + + uint8[] + Value + Buffer to hold the configuration property. + + + + + ZstackResponseCode + Status + This field indicates either SUCCESS (0) or FAILURE (1). + + + + + + ZB_GET_DEVICE_INFO + SAPI + 0x06 + This command retrieves a Device Information Property. + SYNC + + + uint8 + Param + The Identifier for the device information. + + + + + uint8 + Param + The Identifier for the device information. + + + uint16 + Value + A buffer to hold the device information + + + + + + + + + UTIL_GET_DEVICE_INFO + UTIL + 0x00 + This command is used to retrieve the device info. + SYNC + + + + + ZstackResponseCode + Status + Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the + address value in the command message was not within the valid range. + + + + IeeeAddress + IeeeAddress + IEEE address of the device. + + + uint16 + ShortAddr + hex[4] + Short address of the device. + + + uint8 + DeviceType + Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a + coordinator, router, or end device, respectively. + + + + ZstackZdoState + DeviceState + Indicates the state of the device. + + + uint8 + NumAssocDevices + Specifies the number of devices being associated to the target device. + AssocDevicesList + + + uint16[] + AssocDevicesList + Array of 16-bits specifies the network address associated with the device. + + + + + + UTIL_GET_NV_INFO + UTIL + 0x01 + This command is used to read a block of parameters from non-volatile storage of the target device. + + SYNC + + + + + uint8 + Status + A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of + each item that failed to be retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the + second item (ScanChannels), and so forth. Data values for failed items are returned as one or more bytes of 0xFF, + the typical value read from erased NV memory. + + + + IeeeAddress + IeeeAddress + IEEE address of the device. + + + uint32 + ScanChannels + This represents a bit-mask of channels to be scanned when starting the device. + + + uint16 + PanId + hex[4] + Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + + + uint8 + SecurityLevel + This specifies the network messaging security level, zero disables security. + + + ZigBeeKey + PreConfigKey + This specifies the pre-configured security key. + + + + + + UTIL_SET_PANID + UTIL + 0x02 + Store a PanId value into Non-Volatile memory to be used the next time the target device resets. + + SYNC + + + uint16 + PanId + hex[4] + PanId that will be set. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + UTIL_SET_CHANNELS + UTIL + 0x03 + This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time + the target device resets. + + SYNC + + + uint32 + Channels + A bit-mask representing the channel(s) to scan the next time the target device resets. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + UTIL_SET_SECLEVEL + UTIL + 0x04 + This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time + the target device resets. + + SYNC + + + uint8 + SecLevel + Security level to use the next time the target device resets. Zero is used to disable security. + + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + UTIL_SET_PRECFGKEY + UTIL + 0x05 + This command is used to store a pre-configured key array into Non-Volatile memory to be used the next + time the target device resets. + + SYNC + + + ZigBeeKey + PreCfgKey + An array representing the pre-configured key to use the next time the target device resets. + + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + UTIL_LED_CONTROL + UTIL + 0x09 + This command is used by the tester to control the LEDs on the board. + SYNC + + + uint8 + LedId + The LED number. + + + boolean + Mode + 0: OFF, 1: ON. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + UTIL_APSME_LINK_KEY_DATA_GET + UTIL + 0x44 + This command retrieves APS link key data, Tx and Rx frame counters. + SYNC + + + IeeeAddress + ExtAddr + The extended address for which to get the link key data. + + + + + ZstackResponseCode + Status + The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + + + ZigBeeKey + SecKey + On success, the security key looked up; otherwise N/A. + + + uint32 + TxFrmCntr + hex[8] + On success, the TX frame counter; otherwise N/A. + + + uint32 + RxFrmCntr + hex[8] + On success, the RX frame counter; otherwise N/A. + + + + + + UTIL_APSME_LINK_KEY_NV_ID_GET + UTIL + 0x45 + This command is a proxy call to the APSME_LinkKeyNvIdGet() function. + SYNC + + + IeeeAddress + ExtAddr + The extended address for which to get the link key NV Id. + + + + + ZstackResponseCode + Status + The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + + + uint16 + LinkKeyNvId + On success, link key NV ID. Otherwise 0xFFFF + + + + + + + MAC_SCAN_REQ + MAC + 0x0C + This command is used to send a request to the device to perform a network scan. + SYNC + + + uint32 + ScanChannels + This represents a bit-mask of channels to be scanned when starting the device: + NONE = 0x00000000, + ALL_CHANNELS = 0x07FFF800, + CHANNEL 11 = 0x00000800, + CHANNEL 12 = 0x00001000, + CHANNEL 13 = 0x00002000, + CHANNEL 14 = + 0x00004000, + CHANNEL 15 = 0x00008000, + CHANNEL 16 = 0x00010000, + CHANNEL 17 = 0x00020000, + CHANNEL 18 = 0x00040000, + CHANNEL_19 = 0x00080000, + CHANNEL 20 = 0x00100000, + CHANNEL 21 = 0x00200000, + CHANNEL 22 = 0x00400000, + CHANNEL 23 = + 0x00800000, + CHANNEL 24 = 0x01000000 + CHANNEL 25 = 0x02000000, + CHANNEL 26 = 0x04000000 + + + + uint8 + ScanType + Specifies the scan type: + + + uint8 + ScanDuration + Duration of the scan - The exponent used in the scan duration calculation. + + + uint8 + ChannelPage + The channel page on which to perform the scan. + + + uint8 + KeySource + Key Source of this data frame. + + + uint8 + SecurityLevel + Security Level of this data frame: + + + uint8 + KeyIdMode + Key Id Mode of this data frame: + + + uint8 + KeyIndex + Key Index of this data frame. + + + + + + + + + + + + + + APP_CNF_SET_ALLOWREJOIN_TC_POLICY + APP_CNF + 0x02 + Sets the AllowRejoin TC policy. + SYNC + + + boolean + AllowRejoin + This value specifies whether or not the Trust Center allows devices to rejoin. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + APP_CNF_BDB_ADD_INSTALLCODE + APP_CNF + 0x02 + Add a preconfigured key (plain key or IC) to Trust Center device. + SYNC + + + ZstackInstallCodeFormat + InstallCodeFormat + This value specifies the format in which the install code is being added. The following list contains the values corresponding to the supported formats: +0x01 Install Code + CRC +0x02 Key derived from Install Code + + + IeeeAddress + IeeeAddress + Full IEEE address for the device joining the network + + + ZigBeeKey + InstallCode + 16 Bytes for the Key derived from the IC. +18 Bytes for the Install Code +CRC + + + + + ZstackResponseCode + Status + Status values: +0x00 Success. +0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + + + + + + APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY + APP_CNF + 0x06 + Sets the policy to mandate or not the usage of an Install Code upon joining. + SYNC + + + boolean + JoinUsesInstallCodeKey + If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL + terminate the procedure for adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and + the installation code derived link key is stored, the Trust Center SHALL first find the entry in + apsDeviceKeyPairSet that corresponds to the joining node and then overwrite the LinkKey entry with the installation + code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set + OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If bdbJoinUsesInstallCodeKey is equal to + FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and + then overwrite the LinkKey entry with the default global Trust Center link key and set the KeyAttributes field to + PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set IncomingFrameCounter to 0. + + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY + APP_CNF + 0x07 + Sets the policy to mandate or not the usage of an Install Code upon joining. + SYNC + + + ZstackCentralizedLinkKeyMode + CentralizedLinkKeyMode + This parameter controls which key will be used when performing association to a centralized network. + + + + uint8 + InstallCode + Buffer with the key in any of its formats. + + + + + ZstackResponseCode + Status + 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + + + + + + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE + APP_CNF + 0x09 + Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + SYNC + + + boolean + TrustCenterRequireKeyExchange + The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining + device to exchange its initial link key with a new link key generated by the Trust Center. If + bdbTrustCenterRequireKeyExchange is equal to TRUE, the joining node must undergo the link key exchange procedure; + failure to exchange the link key will result in the node being removed from the network. If + bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining node to remain on the + network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + + + APP_CNF_BDB_COMMISSIONING_NOTIFICATION + APP_CNF + 0x80 + Callback to receive notifications from BDB process. + ASYNC + + + ZstackBdbStatus + Status + Status of the commissioning mode being notified + + + ZstackBdbCommissioningMode + CommissioningMode + Commissioning mode for which the notification is done and to which the status is related + + + ZstackBdbRemainingCommissioningModes + RemainingCommissioningModes + Bitmask of the remaining commissioning modes after this notification. + + + + + + + + + SB_WRITE_CMD + SBL + 0x00 + + + BOOT + + + uint32 + Length32 + Payload + Payload length. + + + uint8[] + Payload + Payload data. + + + + + ZstackResponseCode + Status + 0x00 - SUCCESS 0x01 - FAILURE + + + + + + SB_HANDSHAKE_CMD + SBL + 0x04 + + + BOOT + + + + + ZstackResponseCode + Status + 0x00 - SUCCESS 0x01 - FAILURE + + + uint32 + BootloaderRevision + + + + uint8 + DeviceType + + + + uint32 + BufferLength + The maximum data size to use with Read / Write command + + + uint32 + PageSize + 0x800 – CC2538 flash page size + + + + + + + + AfDataOptions + uint8 + Options applied when sending frames + AF + + + AF_ACK_REQUEST + 0x10 + Set this bit to request APS acknowledgement for this packet + + + AF_DISCV_ROUTE + 0x20 + Set this bit to force route discovery if a routing table entry doesn’t exist + + + AF_EN_SECURITY + 0x40 + Set this bit to enable APS security for this packet. + + + + + + ZstackConfigId + uint8 + Device specific configuration parameters. + SYS + + + ZCD_NV_EXTADDR + 0x0000 + + + + ZCD_NV_BOOTCOUNTER + 0x0001 + + + + ZCD_NV_STARTUP_OPTION + 0x0003 + This parameter controls the device startup options. Size: 1 byte; Default value: 0 + + + ZCD_NV_START_DELAY + 0x0004 + + + + ZCD_NV_POLL_RATE_OLD16 + 0x0035 + If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device + will wake up periodically with this duration to check for data with its parent device. This value is specified in + milliseconds and can range from 1 to 65000. + If this parameter is set to zero, the device will not automatically wake + up to poll for data. Instead, an external + trigger or an internal event (for example, via a software timer event) can + be used to wake up the device. + Size: 4 bytes; Default value: 2000 + + + + ZCD_NV_QUEUED_POLL_RATE + 0x0025 + When an end-device polls for data with its parent and finds that it does have data, it can poll again + with a shorter duration in case there is more data queued for it at its parent device. This value is specified in + milliseconds. This feature can be turned off by setting this value to zero. + Size: 2 bytes; Default value: 100 + + + + ZCD_NV_RESPONSE_POLL_RATE + 0x0026 + When an end-device sends a data packet, it can poll again with a shorter duration, specified by this + parameter, if the application is expecting to receive an application level packet in response. This value is + specified in milliseconds. This feature can be turned off by setting the value to zero. + Note: The setting of the + queued and response poll rates has to be done with caution if the device is sending and + receiving at the same time + or if the device is sending data too fast. + If the device is sending data too fast, setting a queued poll rate with a + higher duration than the sending rate will + cause the poll event to be continuously rescheduled to the future. Then + the device will never poll for data with + its parent and consequently it may miss any packets destined for it. + Size: 2 + bytes; Default value: 100 + + + + ZCD_NV_REJOIN_POLL_RATE + 0x0027 + + + + ZCD_NV_DATA_RETRIES + 0x0028 + + + + ZCD_NV_POLL_FAILURE_RETRIES + 0x0029 + The number of times an end-device will fail when communicating with its parent before invoking the + rejoin mechanism to find and join a new parent. + Size: 1 byte; Default value: 2. + + + + ZCD_NV_STACK_PROFILE + 0x002A + + + + ZCD_NV_INDIRECT_MSG_TIMEOUT + 0x002B + The amount of time (in seconds) that a router or coordinator device will buffer messages destined to + their end-device child nodes. It is recommended that this is at least greater than the poll rate (ZCD_NV_POLL_RATE) + to ensure that end-device will have a chance to wakeup and poll for the data. + Size: 1 byte; Default value: 7 + + + + ZCD_NV_ROUTE_EXPIRY_TIME + 0x002C + The amount of time (in seconds) for which a route must be idle (i.e. no packets are transmitted on that + route) before that routing entry is marked as expired. An expired entry may be deleted if the table is full and the + space is needed for another new routing entry. + This can be set to a special value of 0 to turn off route expiry. In + this case, route entries are not expired. + Size: 1 byte; Default value: 60. + + + + ZCD_NV_EXTPANID + 0x002D + This parameter configures the EXTENDED PAN ID in Z-Stack. The extended pan id is used to further + segregate the sub network(s) among a bigger PAN network. + + + + ZCD_NV_BCAST_RETRIES + 0x002E + The maximum number of retransmissions that a device will attempt when trying to transmit a broadcast + packet. The typical range is from 1 through 3. + Size: 1 byte; Default value: 2. + + + + ZCD_NV_PASSIVE_ACK_TIMEOUT + 0x002F + The amount of time (in units of 100milliseconds) a device will wait before retransmitting a broadcast + packet. The retransmission will not happen if the node hears that each of its neighbor nodes have all transmitted + that packet. + Size: 1 byte; Default value: 5 + + + + ZCD_NV_BCAST_DELIVERY_TIME + 0x0030 + The maximum amount of time (in units of 100ms) that it can take for a broadcast packet to propagate + through the entire network. This includes time for all retransmissions. + Note: This parameter must be set with + caution. It must be set to a value of at least + (ZCD_NV_BCAST_RETRIES + 1) * ZCD_NV_PASSIVE_ACK_TIMEOUT + To be safe, + the actual value should be higher than the above minimum by about 500ms or more. + Size: 1 byte; Default value: 30. + + + + ZCD_NV_NWK_MODE + 0x0031 + Holds the value of the network operational mode. The default value is NWK_MODE_MESH and must not be modified. + + + ZCD_NV_CONCENTRATOR_ENABLE + 0x0032 + + + + ZCD_NV_CONCENTRATOR_DISCOVERY + 0x0033 + + + + + ZCD_NV_CONCENTRATOR_RADIUS + 0x0034 + + + + + ZCD_NV_POLL_RATE + 0x0035 + If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device + will wake up periodically with this duration to check for data with its parent device. This value is specified in + milliseconds and can range from 1 to 65000. + If this parameter is set to zero, the device will not automatically wake + up to poll for data. Instead, an external + trigger or an internal event (for example, via a software timer event) can + be used to wake up the device. + Size: 4 bytes; Default value: 2000 + + + + ZCD_NV_CONCENTRATOR_RC + 0x0036 + Holds the value of route cache flag. This enables or disables the route cache for coordinator and is FALSE by default. + + + + ZCD_NV_NWK_MGR_MODE + 0x0037 + + + + ZCD_NV_SRC_RTG_EXPIRY_TIME + 0x0038 + + + + ZCD_NV_ROUTE_DISCOVERY_TIME + 0x0039 + + + + ZCD_NV_NWK_ACTIVE_KEY_INFO + 0x003A + + + + ZCD_NV_NWK_ALTERN_KEY_INFO + 0x003B + + + + ZCD_NV_ROUTER_OFF_ASSOC_CLEANUP + 0x003C + + + + ZCD_NV_NWK_LEAVE_REQ_ALLOWED + 0x003D + + + + ZCD_NV_NWK_CHILD_AGE_ENABLE + 0x003E + Holds the value of Child Aging capability flag. This enables or disables child aging and must be set to TRUE for Zigbee 3.0 compliance. + + + ZCD_NV_DEVICE_LIST_KA_TIMEOUT + 0x003F + + + + ZCD_NV_BINDING_TABLE + 0x0041 + + + + ZCD_NV_GROUP_TABLE + 0x0042 + + + + ZCD_NV_APS_FRAME_RETRIES + 0x0043 + The number of retransmissions performed on a data packet at the application layer if the packet was + transmitted with the end-to-end acknowledgement option enabled. + Size: 1 byte; Default value: 3 + + + + ZCD_NV_APS_ACK_WAIT_DURATION + 0x0044 + The amount of time (in milliseconds) a device will wait before re-transmitting a packet that used the + APS acknowledgement option. If the APS acknowledgement is not received by this time, the sending device will assume + a failure and attempt a re-transmission. + Note: This is recommended to be set to approximately the expected round + trip time for the packet. Note that if the + destination (or source) device is an end-device, the round trip time for + the packet will include an additional + delay up to the poll duration. This is in addition to the delay normally + caused by the network. + Size: 2 bytes; Default value: 3000 + + + + ZCD_NV_APS_ACK_WAIT_MULTIPLIER + 0x0045 + + + + ZCD_NV_BINDING_TIME + 0x0046 + The amount of time (in milliseconds) a device will wait for a response to a binding request. + Size: 2 + bytes; Default value: 8000 + + + + ZCD_NV_APS_USE_EXT_PANID + 0x0047 + + + + ZCD_NV_COMMISSIONED_NWK_ADDR + 0x0049 + + + + ZCD_NV_APS_NONMEMBER_RADIUS + 0x004B + + + + ZCD_NV_APS_LINK_KEY_TABLE + 0x004C + Holds the security manager entries of type ZDSecMgrEntry_t to store the TCKL used to talk with devices in the network that require APS security. The number of entries is controled by ZDSECMGR_DEVICE_MAX=3 by default. + + + ZCD_NV_APS_DUPREJ_TIMEOUT_INC + 0x004D + + + + ZCD_NV_APS_DUPREJ_TIMEOUT_COUNT + 0x004E + + + + ZCD_NV_APS_DUPREJ_TABLE_SIZE + 0x004F + + + + ZCD_NV_DIAGNOSTIC_STATS + 0x0050 + + + + ZCD_NV_NWK_PARENT_INFO + 0x0051 + + + + ZCD_NV_NWK_ENDDEV_TIMEOUT_DEF + 0x0052 + + + + ZCD_NV_END_DEV_TIMEOUT_VALUE + 0x0053 + Holds the value of Child Aging Timeout. This is the time in seconds used by END DEVICE when sending End Device Timeout Request that tells a COORDINATOR the timeout to remove this END DEVICE after no data poll is received. + + + ZCD_NV_END_DEV_CONFIGURATION + 0x0054 + Holds the value of End Device Configuration field when END DEVICE when sending End Device Timeout Request. Is set to 0x00 by default which is the only valid value accourding to Zigbee Core spec R21. + + + ZCD_NV_BDBNODEISONANETWORK + 0x0055 + + + + ZCD_NV_BDBREPORTINGCONFIG + 0x0056 + + + + ZCD_NV_PRECFGKEY + 0x0062 + holds the value of network key that is generated by default. The key can be set to a fixed value by setting DEFAULT_KEY macro. This is used for securing and un-securing packets in the network, if security is enabled for the + network. + NOTE: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. + Size: 16 bytes; Default value: [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, + 0x0E, 0x0F] + + + + ZCD_NV_PRECFGKEYS_ENABLE + 0x0063 + If security functionality is enabled, there are two options to distribute the security key to all + devices in the network. If this parameter is true, the same security key is assumed to be pre-configured in all + devices in the network.If it is set to false, then the key only needs to be configured on the coordinator device. + In this case, the key is distributed to each device upon joining by the coordinator. This key distribution will + happen in the “clear” on the last hop of the packet transmission and this constitutes a brief “period of + vulnerability” during which a malicious device can capture the key. Hence it is not recommended unless it can be + ensured that there are no malicious devices in the vicinity at the time of network formation. + NOTE: Use of this + configuration item requires the ZNP code to be built with the SECURE=1 compile option. + Size: 1 byte; Default value: + TRUE + + + + ZCD_NV_SECURITY_MODE + 0x0064 + This parameter determines if security is used or not in this network. It can be set to 0 (to turn off + NWK security) or 1 (to turn on NWK security). Size: 1 byte; Default value: 0. + + + + ZCD_NV_SECURE_PERMIT_JOIN + 0x0065 + This value tells if only secure joins are allowed. Set to TRUE by default which is the only valid value according to Zigbee Core spec R21. + + + ZCD_NV_APS_LINK_KEY_TYPE + 0x0066 + Is equal to ZG_GLOBAL_LINK_KEY=1 and must not be modified according to Zigbee Core spec R21. + + + ZCD_NV_APS_ALLOW_R19_SECURITY + 0x0067 + + + + ZCD_NV_DISTRIBUTED_KEY + 0x0068 + Default distributed nwk key Id. Nv ID not in use + + + ZCD_NV_IMPLICIT_CERTIFICATE + 0x0069 + + + + ZCD_NV_DEVICE_PRIVATE_KEY + 0x006A + + + + ZCD_NV_CA_PUBLIC_KEY + 0x006B + + + + ZCD_NV_KE_MAX_DEVICES + 0x006C + + + + ZCD_NV_USE_DEFAULT_TCLK + 0x006D + Controls whether a single pre-configured trust center link key is used or whether multiple pre- + configured trust center link keys are used, hereby referred to as Single Key Mode and Multiple Key Mode, + respectively. + In multiple key mode, unique pre-configured trust center link keys are used between the trust center + and each individual device joining the network. Multiple key mode is required by the recommended secure procedure + in ZigBeeSE profile Specification. In single key mode, all devices are using the same pre-configured trust center + link key to join the network. The single key mode provides a simplified alternative procedure to set up the + network. + It can be used for testing and debugging purpose. + Size: 1 byte; Default value: TRUE + + + + ZCD_NV_RNG_COUNTER + 0x006F + + + + ZCD_NV_RANDOM_SEED + 0x0070 + + + + ZCD_NV_TRUSTCENTER_ADDR + 0x0071 + + + + ZCD_NV_CERT_283 + 0x0072 + + + + ZCD_NV_PRIVATE_KEY_283 + 0x0073 + + + + ZCD_NV_PUBLIC_KEY_283 + 0x0074 + + + + ZCD_NV_NWK_SEC_MATERIAL_TABLE_START + 0x0075 + + + + ZCD_NV_NWK_SEC_MATERIAL_TABLE_END + 0x0080 + + + + ZCD_NV_USERDESC + 0x0081 + An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it + can easily identified or described later. The first byte is the length of the user descriptor data and must not be + greater than 16. + Size: 17 bytes; Default value: “CC2530-ZNP x......” (dots represent the device IEEE address) + + + + ZCD_NV_NWKKEY + 0x0082 + This holds the value of nwkActiveKeyItems structure and restores the NWK key counter after power cycles. + + + ZCD_NV_PANID + 0x0083 + This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. + Networks that exist in the same vicinity must have different values for this parameter. It can be set to a special + value of 0xFFFF to indicate “don’t care”. + Size: 2 bytes; Default value: 0xFFFF + + + + ZCD_NV_CHANLIST + 0x0084 + This parameter is a bit mask of the channels on which this network can operate (note that multiple + channels can be selected). See section 4.5.16 for a table of the bitmap representation that maps to each channel. + Multiple networks that exist in the same vicinity are encouraged to have different values. + If multiple channels are + selected, the coordinator will pick one of the channels for network operation. First, an + energy scan is performed on + each channel and those channels with a high energy level are discarded. Then, the + coordinator determines the number + of existing ZigBee networks on each of the remaining channels and picks the one + with the fewest networks. For + routers and end-devices, the device will simply scan all the selected channels until + it finds the ZigBee network. + Size: 4 bytes; Default value: 0x00000800 + + + + ZCD_NV_SCAN_DURATION + 0x0086 + + + + ZCD_NV_LOGICAL_TYPE + 0x0087 + This is the logical type of the device in the ZigBee network. This can be set to a COORDINATOR + (0x00), + ROUTER (0x01) or ENDDEVICE (0x02). + Note: + This parameter is read by the CC2530-ZNP device immediately when it powers + up after a reset. + Size: 1 byte; Default value: 0x00 + + + + ZCD_NV_NWKMGR_MIN_TX + 0x0088 + + + + ZCD_NV_NWKMGR_ADDR + 0x0089 + + + + ZCD_NV_ZDO_DIRECT_CB + 0x008F + This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the + host processor. By default, this item is set to FALSE, which means that the host processor must use the + ZDO_MSG_CB_REGISTER command to subscribe to a specific ZDO callback in order to receive it. The ZDO callback is + then conveyed as part of the ZDO_MSG_CB_INCOMING command. If ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host + processor will receive the “verbose” response. For example, the host processor would receive the ZDO_IEEE_ADDR_RSP + command in response to ZDO_IEEE_ADDR_REQ. + Size: 1 byte; Default value: FALSE + + + + ZCD_NV_SAS_SHORT_ADDR + 0x00B1 + + + + ZCD_NV_SAS_EXT_PANID + 0x00B2 + + + + ZCD_NV_SAS_PANID + 0x00B3 + + + + ZCD_NV_SAS_CHANNEL_MASK + 0x00B4 + + + + ZCD_NV_SAS_PROTOCOL_VER + 0x00B5 + + + + ZCD_NV_SAS_STACK_PROFILE + 0x00B6 + + + + ZCD_NV_SAS_STARTUP_CTRL + 0x00B7 + + + + ZCD_NV_SAS_TC_ADDR + 0x00C1 + + + + ZCD_NV_SAS_TC_MASTER_KEY + 0x00C2 + + + + ZCD_NV_SAS_NWK_KEY + 0x00C3 + + + + ZCD_NV_SAS_USE_INSEC_JOIN + 0x00C4 + + + + ZCD_NV_SAS_PRECFG_LINK_KEY + 0x00C5 + + + + ZCD_NV_SAS_NWK_KEY_SEQ_NUM + 0x00C6 + + + + ZCD_NV_SAS_NWK_KEY_TYPE + 0x00C7 + + + + ZCD_NV_SAS_NWK_MGR_ADDR + 0x00C8 + + + + ZCD_NV_SAS_CURR_TC_MASTER_KEY + 0x00D1 + + + + ZCD_NV_SAS_CURR_NWK_KEY + 0x00D2 + + + + + + + ZstackDiagnosticAttribute + uint16 + Diagnostics attribute IDs. + SYS + + + ZDIAGS_SYSTEM_CLOCK + 0x0000 + System Clock when stats were saved/cleared + + + ZDIAGS_NUMBER_OF_RESETS + 0x0001 + Increments every time the system resets + + + ZDIAGS_MAC_RX_CRC_PASS + 0x0064 + MAC diagnostic CRC success counter + + + ZDIAGS_MAC_RX_CRC_FAIL + 0x0065 + MAC diagnostic CRC failure counter + + + ZDIAGS_MAC_TX_UCAST_RETRY + 0x006A + MAC layer retries a unicast + + + ZDIAGS_MAC_TX_UCAST_FAIL + 0x006B + Mac layer fails to send a unicast + + + ZDIAGS_NWK_DECRYPT_FAILURES + 0x00CF + NWK packet decryption failed + + + ZDIAGS_PACKET_VALIDATE_DROP_COUNT + 0x00D3 + NWK packet drop because of validation error + + + ZDIAGS_APS_TX_BCAST + 0x012D + APS layer transmits broadcast + + + ZDIAGS_APS_TX_UCAST_SUCCESS + 0x012F + APS layer successfully transmits a unicast + + + ZDIAGS_APS_TX_UCAST_RETRY + 0x0130 + APS layer retries the sending of a unicast + + + ZDIAGS_APS_TX_UCAST_FAIL + 0x0131 + APS layer fails to send a unicast + + + ZDIAGS_APS_DECRYPT_FAILURES + 0x0134 + APS packet decryption failed + + + ZDIAGS_APS_INVALID_PACKETS + 0x0135 + APS invalid packet dropped + + + ZDIAGS_MAC_RETRIES_PER_APS_TX_SUCCESS + 0x0136 + Number of MAC retries per APS message + + + + + + ZstackZdoState + uint8 + + SYS + + + DEV_HOLD + 0x0000 + Initialized - not started automatically + + + DEV_INIT + 0x0001 + Initialized - not connected to anything + + + DEV_NWK_DISC + 0x0002 + Discovering PAN's to join + + + DEV_NWK_JOINING + 0x0003 + Joining a PAN + + + DEV_NWK_REJOIN + 0x0004 + ReJoining a PAN, only for end devices + + + DEV_END_DEVICE_UNAUTH + 0x0005 + Joined but not yet authenticated by trust center + + + DEV_END_DEVICE + 0x0006 + Started as device after authentication + + + DEV_ROUTER + 0x0007 + Device joined, authenticated and is a router + + + DEV_COORD_STARTING + 0x0008 + Starting as Zigbee Coordinator + + + DEV_ZB_COORD + 0x0009 + Started as Zigbee Coordinator + + + DEV_NWK_ORPHAN + 0x0000A + Device has lost information about its parent + + + + + + ZstackSystemCapabilities + uint16 + Subsystem capabilities bitmap + SYS + + + MT_CAP_SYS + 0x0001 + + + + MT_CAP_MAC + 0x0002 + + + + MT_CAP_NWK + 0x0004 + + + + MT_CAP_AF + 0x0008 + + + + MT_CAP_ZDO + 0x0010 + + + + MT_CAP_SAPI + 0x0020 + + + + MT_CAP_UTIL + 0x0040 + + + + MT_CAP_DEBUG + 0x0080 + + + + MT_CAP_APP + 0x0100 + + + + MT_CAP_ZOAD + 0x1000 + + + + + + + ZstackDeviceInformation + uint16 + Device Info Constants + SAPI + + + ZB_INFO_DEV_STATE + 0x0000 + + + + ZB_INFO_IEEE_ADDR + 0x0001 + + + + ZB_INFO_SHORT_ADDR + 0x0002 + + + + ZB_INFO_PARENT_SHORT_ADDR + 0x0003 + + + + ZB_INFO_PARENT_IEEE_ADDR + 0x0004 + + + + ZB_INFO_CHANNEL + 0x0005 + + + + ZB_INFO_PAN_ID + 0x0006 + + + + ZB_INFO_EXT_PAN_ID + 0x0007 + + + + + + + ZstackResetType + uint8 + Reset Command Type + SYS + + + target device + 0x0000 + + + + serial bootloader + 0x0001 + + + + + + + ZstackResetReason + uint8 + Reasons for reset + SYS + + + Power-up + 0x0000 + + + + External + 0x0001 + + + + Watch-dog + 0x0002 + + + + + + + ZstackSreqErrorCode + uint8 + SREQ RPC Error code + RPC + + + Invalid subsystem + 0x0001 + + + + Invalid command ID + 0x0002 + + + + Invalid parameter + 0x0003 + + + + Invalid length + 0x0003 + + + + + + + ZstackResponseCode + uint8 + Global response codes + + + + Success + 0x0000 + + + + Failure + 0x0001 + + + + AF_INVALID_PARAMETER + 0x0002 + + + + AF_MEM_FAIL + 0x0010 + Security manager key table full + + + Key table full + 0x0011 + Security manager key table full + + + MAC_NO_RESOURCES + 0x001A + The operation could not be completed because no memory resources were available + + + Invalid Request + 0x00C2 + Invalid Request + + + Not Permitted + 0x00C3 + Not Permitted + + + Unknown Device + 0x00C8 + Unknown Device + + + AF_NO_ROUTE + 0x00CD + + + + MAC_SCAN_IN_PROGRESS + 0x00FC + The scan request failed because a scan is already in progress + + + + + + ZstackCentralizedLinkKeyMode + uint8 + Central link key policies + APP_CNF + + + Default Global Key + 0x0000 + Instruct joining node to use Default Global Trust Center link key. No key buffer required + + + Provided Install Code + 0x0001 + Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link + key to be used during joining + + + + Provided Install Code then default global key + 0x0002 + Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link + key to be used during joining. If it fails to decrypt Transport Key, it will automatically try Default Global Trust + Center Link Key + + + + Provided APS Key + 0x0003 + Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 + bytes) + + + + Provided APS Code then default global key + 0x0004 + Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 + bytes). If it fails to decrypt Transport Key, it will automatically try Default Global Trust Center Link Key + + + + + + + ZstackBdbStatus + uint8 + + APP_CNF + + + BDB_COMMISSIONING_SUCCESS + 0x0000 + + + + BDB_COMMISSIONING_IN_PROGRESS + 0x0001 + + + + BDB_COMMISSIONING_NO_NETWORK + 0x0002 + + + + BDB_COMMISSIONING_TL_TARGET_FAILURE + 0x0003 + + + + BDB_COMMISSIONING_TL_NOT_AA_CAPABLE + 0x0004 + + + + BDB_COMMISSIONING_TL_NO_SCAN_RESPONSE + 0x0005 + + + + BDB_COMMISSIONING_TL_NOT_PERMITTED + 0x0006 + + + + BDB_COMMISSIONING_TCLK_EX_FAILURE + 0x0007 + + + + BDB_COMMISSIONING_FORMATION_FAILURE + 0x0008 + + + + BDB_COMMISSIONING_FB_TARGET_IN_PROGRESS + 0x0009 + + + + BDB_COMMISSIONING_FB_INITIATOR_IN_PROGRESS + 0x000A + + + + BDB_COMMISSIONING_FB_NO_IDENTIFY_QUERY_RESPONSE + 0x000B + + + + BDB_COMMISSIONING_FB_BINDING_TABLE_FULL + 0x000C + + + + BDB_COMMISSIONING_NETWORK_RESTORED + 0x000D + + + + BDB_COMMISSIONING_FAILURE + 0x000E + + + + + + + ZstackBdbCommissioningMode + uint8 + + APP_CNF + + + BDB_COMMISSIONING_INITIALIZATION + 0x0000 + + + + BDB_COMMISSIONING_NWK_STEERING + 0x0001 + + + + BDB_COMMISSIONING_FORMATION + 0x0002 + + + + BDB_COMMISSIONING_FINDING_BINDING + 0x0003 + + + + BDB_COMMISSIONING_TOUCHLINK + 0x0004 + + + + BDB_COMMISSIONING_PARENT_LOST + 0x0005 + + + + + + + ZstackBdbRemainingCommissioningModes + uint8 + + APP_CNF + + + BDB_COMMISSIONING_MODE_INITIATOR_TL + 0x0001 + + + + BDB_COMMISSIONING_MODE_NWK_STEERING + 0x0002 + + + + BDB_COMMISSIONING_MODE_NWK_FORMATION + 0x0004 + + + + BDB_COMMISSIONING_MODE_FINDING_BINDING + 0x0008 + + + + BDB_COMMISSIONING_MODE_INITIALIZATION + 0x0010 + + + + BDB_COMMISSIONING_MODE_PARENT_LOST + 0x0020 + + + + + + + ZstackInstallCodeFormat + uint8 + + APP_CNF + + + INSTALL_CODE + 0x0001 + + + + DERIVED_KEY + 0x0002 + + + + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/.gitignore b/com.zsmartsystems.zigbee.dongle.zstack/.gitignore new file mode 100644 index 0000000000..ae3c172604 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/.project b/com.zsmartsystems.zigbee.dongle.zstack/.project new file mode 100644 index 0000000000..b5a16713fc --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/.project @@ -0,0 +1,23 @@ + + + com.zsmartsystems.zigbee.dongle.zstack + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/build.gradle b/com.zsmartsystems.zigbee.dongle.zstack/build.gradle new file mode 100644 index 0000000000..e612c6c044 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/build.gradle @@ -0,0 +1,7 @@ +group = 'com.zsmartsystems.zigbee' +description = '' +dependencies { + compile project(':com.zsmartsystems.zigbee') + + testCompile project(':com.zsmartsystems.zigbee').sourceSets.test.output +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml new file mode 100644 index 0000000000..28af35cb2c --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee.dongle.zstack + jar + + + com.zsmartsystems + zigbee + 1.1.11-SNAPSHOT + + + + + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee + 1.1.11-SNAPSHOT + + + + com.zsmartsystems.zigbee + com.zsmartsystems.zigbee + 1.1.11-SNAPSHOT + tests + test + + + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java new file mode 100644 index 0000000000..a8b687d5b8 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -0,0 +1,815 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.zsmartsystems.zigbee.ExtendedPanId; +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.ZigBeeApsFrame; +import com.zsmartsystems.zigbee.ZigBeeChannel; +import com.zsmartsystems.zigbee.ZigBeeChannelMask; +import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.ZigBeeProfileType; +import com.zsmartsystems.zigbee.ZigBeeStatus; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackNetworkInitialisation; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackStackConfiguration; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackSingleResponseTransaction; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import com.zsmartsystems.zigbee.transport.DeviceType; +import com.zsmartsystems.zigbee.transport.TransportConfig; +import com.zsmartsystems.zigbee.transport.TransportConfigOption; +import com.zsmartsystems.zigbee.transport.ZigBeePort; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportProgressState; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportReceive; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportState; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportTransmit; + +/** + * Implementation of the Texas instruments Z-Stack dongle implementation. + * + * @author Chris Jackson + * + */ +public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameHandler { + + /** + * The {@link Logger}. + */ + private final Logger logger = LoggerFactory.getLogger(ZigBeeDongleZstack.class); + + /** + * The serial port used to connect to the dongle + */ + private ZigBeePort serialPort; + + /** + * The magic number used to make the dongle exit the bootloader + */ + private int magicNumber = ZstackNetworkInitialisation.MAGIC_NUMBER_DEFAULT; + + /** + * The protocol handler used to send and receive ZStack packets + */ + private ZstackProtocolHandler frameHandler; + + /** + * The stack configuration we need for the NCP + */ + private Map stackConfiguration; + + /** + * The reference to the receive interface + */ + private ZigBeeTransportReceive zigbeeTransportReceive; + + /** + * The current link key as {@link ZigBeeKey} + */ + private ZigBeeKey linkKey = new ZigBeeKey(); + + /** + * The current network key as {@link ZigBeeKey} + */ + private ZigBeeKey networkKey = new ZigBeeKey(); + + /** + * The IeeeAddress of the NCP + */ + private IeeeAddress ieeeAddress; + + /** + * The network address of the NCP + */ + private Integer nwkAddress; + + /** + * The PAN ID + */ + private Integer panId; + + /** + * Requested TX power + */ + private int txPower = 0; + + /** + * The extended PAN ID + */ + private ExtendedPanId extendedPanId; + + /** + * Defines the type of device we want to be - normally this should be COORDINATOR + */ + private DeviceType deviceType = DeviceType.COORDINATOR; + + /** + * The ZStack version used in this system. Set during initialisation and saved in case the client is interested. + */ + private String versionString = "Unknown"; + + /** + * Boolean that is true when the network is UP + */ + private boolean networkStateUp = false; + + /** + * Boolean to hold initialisation state. Set to true after {@link #startup()} completes. + */ + private boolean initialised = false; + + private ScheduledExecutorService executorService; + private ScheduledFuture pollingTimer = null; + + /** + * The rate at which we will do a status poll if we've not sent any other messages within this period + */ + private int pollRate = 1000; + + /** + * The time the last command was sent from the {@link ZigBeeNetworkManager}. This is used by the dongle polling task + * to not poll if commands are otherwise being sent so as to reduce unnecessary communications with the dongle. + */ + private long lastSendCommandTime; + + private final HashMap sender2EndPoint = new HashMap(); + private final HashMap endpoint2Profile = new HashMap(); + + /** + * Create a {@link ZigBeeDongleZstack} + * + * @param serialPort the {@link ZigBeePort} to use for the connection + */ + public ZigBeeDongleZstack(final ZigBeePort serialPort) { + this.serialPort = serialPort; + + // Define the default configuration + stackConfiguration = new LinkedHashMap<>(); + + networkKey = new ZigBeeKey(); + } + + /** + * Update the ZStack configuration that will be sent to the dongle during the initialisation. + *

+ * Note that this must be called prior to {@link #initialize()} for the configuration to be effective. + * + * @param configId the {@link ZstackConfigId} to be updated. + * @param value the value to set (as int[]). Setting this to null will remove the configuration Id from + * the list of configuration to be sent during NCP initialisation. + * @return the previously configured value, or null if no value was set for the {@link ZstackConfigId} + */ + public int[] updateDefaultConfiguration(ZstackConfigId configId, int[] value) { + if (value == null) { + return stackConfiguration.remove(configId); + } + return stackConfiguration.put(configId, value); + } + + /** + * Different hardware may use a different "Magic Number" to skip waiting in the bootloader. Otherwise + * the dongle may wait in the bootloader for 60 seconds after it's powered on or reset. + *

+ * This method allows the user to change the magic number which may be required when using different + * sticks. + * + * @param magicNumber the byte to send to the dongle to exit the bootloader + */ + public void setMagicNumber(int magicNumber) { + this.magicNumber = magicNumber; + } + + @Override + public ZigBeeStatus initialize() { + logger.debug("ZStack dongle initialize: Starting"); + + if (!serialPort.open()) { + logger.error("Unable to open ZStack serial port"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + frameHandler = new ZstackProtocolHandler(this); + frameHandler.start(serialPort); + + ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); + netInitialiser.setMagicNumber(magicNumber); + + netInitialiser.initializeNcp(); + + ZstackNcp ncp = getZstackNcp(); + + Set capabilities = ncp.pingNcp(); + logger.debug("ZStack subsystem capabilities: {}", capabilities); + + ZstackSysVersionSrsp version = ncp.getVersion(); + StringBuilder builder = new StringBuilder(); + builder.append("Software="); + builder.append(version.getMajorRel()); + builder.append("."); + builder.append(version.getMinorRel()); + builder.append("."); + builder.append(version.getMaintRel()); + builder.append(" Product="); + builder.append(version.getProduct()); + builder.append(" Transport="); + builder.append(version.getTransportRev()); + versionString = builder.toString(); + + ieeeAddress = ncp.getIeeeAddress(); + logger.debug("ZStack local IeeeAddress: {}", ieeeAddress); + + // Perform any stack configuration + ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); + + Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); + } + + stackConfigurer.setConfiguration(stackConfiguration); + configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); + } + + ieeeAddress = ncp.getIeeeAddress(); + logger.debug("ZStack local IEEE Address is {}", ieeeAddress); + + // Add the endpoint + ncp.addEndpoint(1, 0, ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), new int[] { 0 }, new int[] { 0 }); + + /* + * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing + * of responses is performed in order + */ + executorService = Executors.newScheduledThreadPool(1); + scheduleNetworkStatePolling(); + + logger.debug("ZStack dongle initialize: Done"); + + return ZigBeeStatus.SUCCESS; + } + + @Override + public ZigBeeStatus startup(boolean reinitialize) { + logger.debug("ZStack dongle startup: Starting"); + + // If frameHandler is null then the serial port didn't initialise + if (frameHandler == null) { + logger.error("Initialising ZStack Dongle but low level handler is not initialised."); + return ZigBeeStatus.INVALID_STATE; + } + + ZstackNcp ncp = getZstackNcp(); + + // If we want to reinitialize the network, then go... + ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); + netInitialiser.setMagicNumber(magicNumber); + if (reinitialize) { + logger.debug("Reinitialising ZStack NCP network."); + if (deviceType == DeviceType.COORDINATOR) { + netInitialiser.formNetwork(); + } else { + netInitialiser.joinNetwork(); + } + + ZstackResponseCode ncpResponse = ncp.setNetworkKey(networkKey); + if (ncpResponse != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack error setting network key: {}", ncpResponse); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + ncpResponse = ncp.setTcLinkKey(linkKey); + if (ncpResponse != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack error setting link key: {}", ncpResponse); + // return ZigBeeStatus.COMMUNICATION_ERROR; + } + + if (panId == null) { + // Allow the NCP to create a random PAN ID + panId = 0xFFFF; + } + ncpResponse = ncp.setPanId(panId); + if (ncpResponse != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack error setting PAN ID: {}", ncpResponse); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + if (extendedPanId == null) { + // Allow the NCP to create a random extended PAN ID + extendedPanId = new ExtendedPanId("FFFFFFFF"); + } + ncpResponse = ncp.setExtendedPanId(extendedPanId); + if (ncpResponse != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack error setting extended PAN ID: {}", ncpResponse); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + } + + if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { + logger.debug("ZStack error setting transmit power"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + netInitialiser.startNetwork(); + + // Check if the network is now up + // networkState = ncp.getNetworkState(); + // logger.debug("ZStack networkStateResponse {}", networkState); + + ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); + if (deviceInfo == null) { + logger.debug("Error getting device info"); + + return ZigBeeStatus.COMMUNICATION_ERROR; + } + nwkAddress = deviceInfo.getShortAddr(); + + ZstackUtilGetNvInfoSrsp nvDeviceInfo = ncp.getNvDeviceInfo(); + if (nvDeviceInfo == null) { + logger.debug("Error getting NV device info"); + + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + logger.debug("ZStack dongle startup: Waiting"); + + if (!netInitialiser.waitForNcpOnline(ncp)) { + logger.debug("ZStack dongle startup: Failed waiting for NCP to come online"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + logger.debug("ZStack dongle startup: Done"); + initialised = true; + return ZigBeeStatus.SUCCESS; + } + + /** + * This method schedules sending a status request frame on the interval specified by pollRate. If the frameHandler + * does not receive a response after a certain amount of retries, the state will be set to OFFLINE. + * The poll will not be sent if other commands have been sent to the dongle within the pollRate period so as to + * eliminate any unnecessary traffic with the dongle. + */ + private void scheduleNetworkStatePolling() { + if (pollingTimer != null) { + pollingTimer.cancel(true); + } + + pollingTimer = executorService.scheduleWithFixedDelay(new Runnable() { + @Override + public void run() { + // Don't poll the state if the network is down + // or we've sent a command to the dongle within the pollRate + if (!networkStateUp || (lastSendCommandTime + pollRate > System.currentTimeMillis())) { + return; + } + // Don't wait for the response. This is running in a single thread scheduler + // frameHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); + } + }, pollRate, pollRate, TimeUnit.MILLISECONDS); + } + + @Override + public void shutdown() { + if (frameHandler == null) { + return; + } + + if (pollingTimer != null) { + pollingTimer.cancel(true); + } + + if (executorService != null) { + executorService.shutdown(); + } + + frameHandler.setClosing(); + serialPort.close(); + frameHandler.close(); + frameHandler = null; + } + + /** + * Returns an instance of the {@link ZstackNcp} + * + * @return an instance of the {@link ZstackNcp} + */ + public ZstackNcp getZstackNcp() { + return new ZstackNcp(frameHandler); + } + + @Override + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + @Override + public Integer getNwkAddress() { + return nwkAddress; + } + + @Override + public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { + if (frameHandler == null) { + return; + } + + // Remember the time to reduce unnecessary polling + lastSendCommandTime = System.currentTimeMillis(); + + final int srcEndpoint; + if (apsFrame.getProfile() == 0) { + srcEndpoint = 0; + } else { + srcEndpoint = (short) getSendingEndpoint(apsFrame.getProfile()); + } + + // TODO: How to differentiate group and device addressing????? + + ZstackAfDataRequestSreq request = new ZstackAfDataRequestSreq(); + request.setClusterID(apsFrame.getCluster()); + request.setDstAddr(apsFrame.getDestinationAddress()); + request.setDestEndpoint(apsFrame.getDestinationEndpoint()); + request.setSrcEndpoint(srcEndpoint); + request.setTransID(apsFrame.getApsCounter()); + request.setRadius(apsFrame.getRadius()); + request.setData(apsFrame.getPayload()); + + request.addOptions(AfDataOptions.AF_ACK_REQUEST); + request.addOptions(AfDataOptions.AF_DISCV_ROUTE); + if (apsFrame.getSecurityEnabled()) { + request.addOptions(AfDataOptions.AF_EN_SECURITY); + } + + ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackAfDataRequestSrsp.class); + + // We need to correlate with the messageTag + executorService.execute(new Runnable() { + @Override + public void run() { + frameHandler.sendTransaction(transaction); + + ZstackAfDataRequestSrsp response = (ZstackAfDataRequestSrsp) transaction.getResponse(); + + ZigBeeTransportProgressState sentHandlerState; + if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { + sentHandlerState = ZigBeeTransportProgressState.RX_NAK; + } else { + sentHandlerState = ZigBeeTransportProgressState.RX_ACK; + } + + zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); + } + }); + } + + @Override + public void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportReceive) { + this.zigbeeTransportReceive = zigbeeTransportReceive; + } + + @Override + public void handlePacket(ZstackCommand response) { + if (response instanceof ZstackAfIncomingMsgAreq) { + ZstackAfIncomingMsgAreq incomingMsg = (ZstackAfIncomingMsgAreq) response; + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setCluster(incomingMsg.getClusterId()); + apsFrame.setDestinationAddress(nwkAddress); + apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); + apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); + apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setApsCounter(incomingMsg.getSeqNumber()); + apsFrame.setProfile(getEndpointProfile(incomingMsg.getDestEndpoint())); + apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); + apsFrame.setPayload(incomingMsg.getData()); + + zigbeeTransportReceive.receiveCommand(apsFrame); + return; + } + + if (response instanceof ZstackZdoMsgCbIncomingAreq) { + ZstackZdoMsgCbIncomingAreq incomingMsg = (ZstackZdoMsgCbIncomingAreq) response; + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setCluster(incomingMsg.getClusterId()); + apsFrame.setDestinationAddress(nwkAddress); + apsFrame.setDestinationEndpoint(0); + apsFrame.setSourceEndpoint(0); + apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setApsCounter(incomingMsg.getSeqNumber()); + apsFrame.setProfile(0); + apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); + + int[] payload = new int[incomingMsg.getData().length + 1]; + System.arraycopy(incomingMsg.getData(), 0, payload, 1, incomingMsg.getData().length); + apsFrame.setPayload(payload); + + zigbeeTransportReceive.receiveCommand(apsFrame); + return; + } + + if (response instanceof ZstackAfDataConfirmAreq) { + // Message has been completed by the NCP + executorService.execute(new Runnable() { + @Override + public void run() { + ZstackAfDataConfirmAreq dataConfirm = (ZstackAfDataConfirmAreq) response; + + ZigBeeTransportProgressState sentHandlerState; + if (dataConfirm.getStatus() == ZstackResponseCode.SUCCESS) { + sentHandlerState = ZigBeeTransportProgressState.RX_ACK; + } else { + sentHandlerState = ZigBeeTransportProgressState.RX_NAK; + } + zigbeeTransportReceive.receiveCommandState(dataConfirm.getTransId(), sentHandlerState); + } + }); + return; + } + + if (response instanceof ZstackZdoStateChangeIndAreq) { + switch (((ZstackZdoStateChangeIndAreq) response).getState()) { + case DEV_NWK_ORPHAN: + case DEV_ROUTER: + case DEV_ZB_COORD: + case DEV_END_DEVICE: + handleLinkStateChange(true); + break; + default: + handleLinkStateChange(false); + break; + } + + return; + } + + /* + * if (response instanceof EzspTrustCenterJoinHandler) { + * EzspTrustCenterJoinHandler joinHandler = (EzspTrustCenterJoinHandler) response; + * + * ZigBeeNodeStatus status; + * switch (joinHandler.getStatus()) { + * case EMBER_HIGH_SECURITY_UNSECURED_JOIN: + * case EMBER_STANDARD_SECURITY_UNSECURED_JOIN: + * status = ZigBeeNodeStatus.UNSECURED_JOIN; + * break; + * case EMBER_HIGH_SECURITY_UNSECURED_REJOIN: + * case EMBER_STANDARD_SECURITY_UNSECURED_REJOIN: + * status = ZigBeeNodeStatus.UNSECURED_REJOIN; + * break; + * case EMBER_HIGH_SECURITY_SECURED_REJOIN: + * case EMBER_STANDARD_SECURITY_SECURED_REJOIN: + * status = ZigBeeNodeStatus.SECURED_REJOIN; + * break; + * case EMBER_DEVICE_LEFT: + * status = ZigBeeNodeStatus.DEVICE_LEFT; + * break; + * default: + * logger.debug("Unknown state in trust centre join handler {}", joinHandler.getStatus()); + * return; + * } + * + * zigbeeTransportReceive.nodeStatusUpdate(status, joinHandler.getNewNodeId(), joinHandler.getNewNodeEui64()); + * return; + * } + */ + } + + @Override + public void handleLinkStateChange(final boolean linkState) { + // Only act on changes to OFFLINE once we have completed initialisation + // changes to ONLINE have to work during init because they mark the end of the initialisation + if (!initialised || linkState == networkStateUp) { + logger.debug("ZStack dongle state change to {} ignored. initialised={}, networkStateUp={}", linkState, + initialised, networkStateUp); + return; + } + logger.debug("ZStack dongle state change to {}", linkState); + + networkStateUp = linkState; + + new Thread() { + @Override + public void run() { + if (linkState) { + // ZstackNcp ncp = getEmberNcp(); + // int addr = ncp.getNwkAddress(); + // if (addr != 0xFFFE) { + // nwkAddress = addr; + // } + } + // Handle link changes and notify framework + zigbeeTransportReceive + .setNetworkState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); + } + }.start(); + } + + @Override + public ZigBeeChannel getZigBeeChannel() { + return ZigBeeChannel.create(0); + } + + @Override + public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { + if ((ZigBeeChannelMask.CHANNEL_MASK_2GHZ & channel.getMask()) == 0) { + logger.debug("Unable to set channel outside of 2.4GHz channels: {}", channel); + return ZigBeeStatus.INVALID_ARGUMENTS; + } + // networkParameters.setRadioChannel(channel.getChannel()); + return ZigBeeStatus.SUCCESS; + } + + @Override + public int getZigBeePanId() { + return 0; + } + + @Override + public ZigBeeStatus setZigBeePanId(int panId) { + // Can't change this when the network is up + if (networkStateUp) { + return ZigBeeStatus.INVALID_STATE; + } + return ZigBeeStatus.SUCCESS; + } + + @Override + public ExtendedPanId getZigBeeExtendedPanId() { + return extendedPanId; + } + + @Override + public ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId) { + // Can't change this when the network is up + if (networkStateUp) { + return ZigBeeStatus.INVALID_STATE; + } + return ZigBeeStatus.SUCCESS; + } + + @Override + public ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key) { + networkKey = key; + if (networkStateUp) { + return ZigBeeStatus.INVALID_STATE; + } + return ZigBeeStatus.SUCCESS; + } + + @Override + public ZigBeeKey getZigBeeNetworkKey() { + return null; + } + + @Override + public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { + linkKey = key; + if (networkStateUp) { + return ZigBeeStatus.INVALID_STATE; + } + return ZigBeeStatus.SUCCESS; + } + + @Override + public ZigBeeKey getTcLinkKey() { + return null; + } + + @Override + public void updateTransportConfig(TransportConfig configuration) { + for (TransportConfigOption option : configuration.getOptions()) { + try { + switch (option) { + case CONCENTRATOR_CONFIG: + break; + + case INSTALL_KEY: + ZstackNcp ncp = getZstackNcp(); + ZigBeeKey nodeKey = (ZigBeeKey) configuration.getValue(option); + if (!nodeKey.hasAddress()) { + logger.debug("Attempt to set INSTALL_KEY without setting address"); + configuration.setResult(option, ZigBeeStatus.FAILURE); + break; + } + ZstackResponseCode result = ncp.addInstallCode(nodeKey.getAddress(), nodeKey); + + configuration.setResult(option, + result == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE); + break; + + case RADIO_TX_POWER: + txPower = (int) configuration.getValue(option); + configuration.setResult(option, setTxPower(txPower)); + break; + + case DEVICE_TYPE: + deviceType = (DeviceType) configuration.getValue(option); + configuration.setResult(option, ZigBeeStatus.SUCCESS); + break; + + case TRUST_CENTRE_LINK_KEY: + setTcLinkKey((ZigBeeKey) configuration.getValue(option)); + configuration.setResult(option, ZigBeeStatus.SUCCESS); + break; + + case TRUST_CENTRE_JOIN_MODE: + // configuration.setResult(option, + // setTcJoinMode((TrustCentreJoinMode) configuration.getValue(option))); + break; + + default: + configuration.setResult(option, ZigBeeStatus.UNSUPPORTED); + logger.debug("Unsupported configuration option \"{}\" in ZStack dongle", option); + break; + } + } catch (ClassCastException e) { + configuration.setResult(option, ZigBeeStatus.INVALID_ARGUMENTS); + } + } + } + + private ZigBeeStatus setTxPower(int txPower) { + ZstackNcp ncp = getZstackNcp(); + Integer powerResponse = ncp.setTxPower(txPower); + if (powerResponse == null) { + logger.debug("ZStack error setting transmit power"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + if (txPower != powerResponse) { + logger.debug("ZStack error setting transmit power. Requested {}dBm, but set to {}dBm", txPower, + powerResponse); + } + + return ZigBeeStatus.SUCCESS; + } + + @Override + public String getVersionString() { + return versionString; + } + + private int getSendingEndpoint(int profileId) { + synchronized (sender2EndPoint) { + if (sender2EndPoint.containsKey(profileId)) { + return sender2EndPoint.get(profileId); + } else { + logger.info("No endpoint registered for profileId={}", profileId); + // final byte ep = createEndPoint( profileId); + return -1; + } + } + } + + /** + * Gets the profile used in an endpoint. + * + * @param endpointId the endpoint + * @return the profile used in the endpoint + */ + private int getEndpointProfile(int endpointId) { + synchronized (endpoint2Profile) { + if (endpoint2Profile.containsKey(endpointId)) { + return endpoint2Profile.get(endpointId); + } else { + logger.info("No endpoint {} registered", endpointId); + // final byte ep = createEndPoint( profileId); + return -1; + } + } + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java new file mode 100644 index 0000000000..e993633258 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -0,0 +1,596 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.zsmartsystems.zigbee.ExtendedPanId; +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.ZigBeeChannelMask; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackInstallCodeFormat; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackDiagnosticAttribute; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetReqAcmd; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackSingleResponseTransaction; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import com.zsmartsystems.zigbee.transport.DeviceType; + +/** + * This class provides utility methods for accessing the ZStack NCP and returning specific data for use in the + * application. It ensures the correct correlation of the requests and responses, and checks for errors. + * + * @author Chris Jackson - Initial contribution + * + */ +public class ZstackNcp { + /** + * The {@link Logger}. + */ + private final Logger logger = LoggerFactory.getLogger(ZstackNcp.class); + + /** + * Flag to use the old (deprecated) config functions + */ + private boolean useOldCfgCalls = true; + + /* + * Startup options bitmap + */ + private final int STARTOPT_CLEAR_CONFIG = 0x0001; + private final int STARTOPT_CLEAR_STATE = 0x0002; + + /** + * The protocol handler used to send and receive ZStack packets + */ + private ZstackProtocolHandler protocolHandler; + + /** + * Create the NCP instance + * + * @param protocolHandler the {@link ZstackFrameHandler} used for communicating with the NCP + */ + public ZstackNcp(ZstackProtocolHandler protocolHandler) { + this.protocolHandler = protocolHandler; + } + + /** + * Resets the NCP + * + * @param resetType the {@link ZstackResetType} to request + * @return the {@link ZstackSysResetIndAreq} from the NCP or null if there was an error + */ + public ZstackSysResetIndAreq resetNcp(ZstackResetType resetType) { + ZstackSysResetReqAcmd request = new ZstackSysResetReqAcmd(); + request.setType(resetType); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysResetIndAreq.class)); + ZstackSysResetIndAreq response = (ZstackSysResetIndAreq) transaction.getResponse(); + if (response == null) { + logger.debug("No response from Reset command"); + return null; + } + logger.debug(response.toString()); + + return response; + } + + /** + * Ping the NCP and return the set of subsystem capabilities compiled into the NCP firmware + * + * @return the list of subsystem {@link ZstackSystemCapabilities} from the NCP, or an empty set if there was an + * error + */ + public Set pingNcp() { + ZstackSysPingSreq request = new ZstackSysPingSreq(); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysPingSrsp.class)); + ZstackSysPingSrsp response = (ZstackSysPingSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from Ping command"); + return Collections.emptySet(); + } + logger.debug(response.toString()); + + Set capabilities = new HashSet<>(); + for (ZstackSystemCapabilities capability : ZstackSystemCapabilities.values()) { + if (capability == ZstackSystemCapabilities.UNKNOWN) { + continue; + } + if ((capability.getKey() & response.getCapabilities()) != 0) { + capabilities.add(capability); + } + } + + return capabilities; + } + + /** + * The command reads the version information from the stack + * + * @return the {@link ZstackSysVersionSrsp} + */ + public ZstackSysVersionSrsp getVersion() { + ZstackSysVersionSreq request = new ZstackSysVersionSreq(); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysVersionSrsp.class)); + ZstackSysVersionSrsp response = (ZstackSysVersionSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from Version command"); + return null; + } + logger.debug(response.toString()); + + return response; + } + + /** + * The command reads the device information from the NCP + * + * @return the {@link ZstackUtilGetDeviceInfoSrsp} + */ + public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { + ZstackUtilGetDeviceInfoSreq request = new ZstackUtilGetDeviceInfoSreq(); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilGetDeviceInfoSrsp.class)); + ZstackUtilGetDeviceInfoSrsp response = (ZstackUtilGetDeviceInfoSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from DeviceInfo command"); + return null; + } + logger.debug(response.toString()); + + return response; + } + + /** + * The command reads the non-volatile device information from the NCP + * + * @return the {@link ZstackUtilGetDeviceInfoSrsp} + */ + public ZstackUtilGetNvInfoSrsp getNvDeviceInfo() { + ZstackUtilGetNvInfoSreq request = new ZstackUtilGetNvInfoSreq(); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilGetNvInfoSrsp.class)); + ZstackUtilGetNvInfoSrsp response = (ZstackUtilGetNvInfoSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from NvInfo command"); + return null; + } + logger.debug(response.toString()); + + return response; + } + + /** + * Gets the {@link IeeeAddress} from the NCP + * + * @return the {@link IeeeAddress} local address of the NCP + */ + public IeeeAddress getIeeeAddress() { + ZstackUtilGetDeviceInfoSrsp info = getDeviceInfo(); + if (info == null) { + return null; + } + return info.getIeeeAddress(); + } + + /** + * Gets the current network address of the NCP + * + * @return the 16 bit local network address of the NCP or -1 if there was an error + */ + public int getNwkAddress() { + ZstackUtilGetDeviceInfoSrsp info = getDeviceInfo(); + if (info == null) { + return -1; + } + return info.getShortAddr(); + } + + /** + * Gets a diagnostics counter from the NCP + * + * @param attributeId {@ link ZstackDiagnosticAttribute} to request + * @return the 32 bit counter, or null on error + */ + public Long getDiagnosticsAttribute(ZstackDiagnosticAttribute attributeId) { + ZstackSysZdiagsGetStatsSreq request = new ZstackSysZdiagsGetStatsSreq(); + request.setAttributeID(attributeId); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysZdiagsGetStatsSrsp.class)); + ZstackSysZdiagsGetStatsSrsp response = (ZstackSysZdiagsGetStatsSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from GetDiagnostics command"); + return null; + } + logger.debug(response.toString()); + + return (long) response.getAttributeValue(); + } + + /** + * Sets the startup options when the NCP starts. + *

+ * The CC2530-ZNP device has two kinds of information stored in non-volatile memory. The configuration parameters + * and network state information. + *

+ * The configuration parameters are configured by the user before start of ZigBee operation. The + * STARTOPT_CLEAR_CONFIG bit is read by the CC2530-ZNP device immediately when it powers up after a reset. + * When the configuration parameters are restored to defaults, the ZCD_NV_STARTUP_OPTION itself is not restored + * except for clearing the STARTOPT_CLEAR_CONFIG bit. + *

+ * The network state information is collected by the device after it joins a network and creates bindings etc. (at + * runtime). This is not set by the application processor. This information is stored so that if the device were to + * reset accidentally, it can restore itself without going through all the network joining and binding process + * again. + *

+ * If the application processor does not wish to continue operating in the previous ZigBee network, it needs to + * instruct the CC2530-ZNP device to clear the network state information and start again based on the configuration + * parameters. This is done by setting the STARTOPT_CLEAR_STATE bit in the startup option. + * + * @param clearConfig STARTOPT_CLEAR_CONFIG – If this option is set, the device will overwrite all the configuration + * parameters (except this one) with the “default” values that it is programmed with. This is used to + * erase the existing configuration and bring the device into a known state. + * @param clearState STARTOPT_CLEAR_STATE – If this option is set, the device will clear its previous network state + * (which would exist if the device had been operating on a network prior to the reset). This is + * typically used during application development. During regular device operation, this flag is typically + * not set, so that an accidental device reset will not cause loss of network state. + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setStartupOptions(boolean clearConfig, boolean clearState) { + int optionVal = (clearConfig ? STARTOPT_CLEAR_CONFIG : 0) + (clearState ? STARTOPT_CLEAR_STATE : 0); + return writeConfiguration(ZstackConfigId.ZCD_NV_STARTUP_OPTION, valueFromUInt8(optionVal)); + } + + /** + * Reads a configuration parameter from the NCP + * + * @param configId the {@link ZstackConfigId} to read + * @return a int[] with the value of the configuration data or null on error + */ + public int[] readConfiguration(ZstackConfigId configId) { + if (useOldCfgCalls) { + ZstackZbReadConfigurationSreq request = new ZstackZbReadConfigurationSreq(); + request.setConfigId(configId); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZbReadConfigurationSrsp.class)); + ZstackZbReadConfigurationSrsp response = (ZstackZbReadConfigurationSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from ReadConfiguration command"); + return null; + } + logger.debug(response.toString()); + if (response.getStatus() != ZstackResponseCode.SUCCESS) { + logger.debug("No response from ReadConfiguration command: {}", response.getStatus()); + return null; + } + return response.getValue(); + } else { + ZstackSysOsalNvReadSreq request = new ZstackSysOsalNvReadSreq(); + request.setId(configId); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysOsalNvReadSrsp.class)); + ZstackSysOsalNvReadSrsp response = (ZstackSysOsalNvReadSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from ReadConfiguration command"); + return null; + } + if (response.getStatus() != ZstackResponseCode.SUCCESS) { + logger.debug("No response from ReadConfiguration command: {}", response.getStatus()); + return null; + } + logger.debug(response.toString()); + return response.getValue(); + } + } + + /** + * Writes a configuration parameter to the NCP + * + * @param configId the {@link ZstackConfigId} to read + * @param value an int array containing the value to be written + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] value) { + if (useOldCfgCalls) { + ZstackZbWriteConfigurationSreq request = new ZstackZbWriteConfigurationSreq(); + request.setConfigId(configId); + request.setValue(value); + ZstackTransaction transaction = protocolHandler.sendTransaction( + new ZstackSingleResponseTransaction(request, ZstackZbWriteConfigurationSrsp.class)); + ZstackZbWriteConfigurationSrsp response = (ZstackZbWriteConfigurationSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from WriteConfiguration command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } else { + ZstackSysOsalNvWriteSreq request = new ZstackSysOsalNvWriteSreq(); + request.setId(configId); + request.setValue(value); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysOsalNvWriteSrsp.class)); + ZstackSysOsalNvWriteSrsp response = (ZstackSysOsalNvWriteSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from WriteConfiguration command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + } + + /** + * Sets the ZStack device type + * + * @param deviceType the {@link DeviceType} to use + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setDeviceType(DeviceType deviceType) { + int value; + switch (deviceType) { + case COORDINATOR: + value = 0; + break; + case ROUTER: + value = 1; + break; + default: + logger.debug("Unknown device type {}", deviceType); + return ZstackResponseCode.FAILURE; + } + return writeConfiguration(ZstackConfigId.ZCD_NV_LOGICAL_TYPE, valueFromUInt8(value)); + } + + /** + * Sets the PAN ID + * + * @param panId the 16 bit PAN ID + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setPanId(int panId) { + return writeConfiguration(ZstackConfigId.ZCD_NV_PANID, valueFromUInt16(panId)); + } + + /** + * Sets the extended PAN ID + * + * @param panId the {@link ExtendedPanId} extended PAN ID + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setExtendedPanId(ExtendedPanId epanId) { + return writeConfiguration(ZstackConfigId.ZCD_NV_EXTPANID, epanId.getValue()); + } + + /** + * Sets the network key, and enables its use. + * + * @param key the {@link ZigBeeKey} to use for the network key + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setNetworkKey(ZigBeeKey key) { + ZstackResponseCode responseCode = writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY, key.getValue()); + if (responseCode != ZstackResponseCode.SUCCESS) { + return responseCode; + } + // Enable the network key + return writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, valueFromUInt8(1)); + } + + public ZstackResponseCode setTcLinkKey(ZigBeeKey key) { + ZstackZdoSetLinkKeySreq request = new ZstackZdoSetLinkKeySreq(); + request.setIeeeAddr(new IeeeAddress("FFFFFFFFFFFFFFFF")); + request.setLinkKeyData(key); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoSetLinkKeySrsp.class)); + ZstackZdoSetLinkKeySrsp response = (ZstackZdoSetLinkKeySrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from SetLinkKey command"); + return null; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + public ZstackResponseCode setNetworkSecurity(boolean enableSecurity) { + return writeConfiguration(ZstackConfigId.ZCD_NV_SECURITY_MODE, valueFromBoolean(enableSecurity)); + } + + /** + * Sets the transmit power to be used in the NCP + * + * @param txPower the TX power in dBm + * @return the power returned from the NCP on success or null on error + */ + public Integer setTxPower(int txPower) { + ZstackSysSetTxPowerSreq request = new ZstackSysSetTxPowerSreq(); + request.setTxPower(txPower); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysSetTxPowerSrsp.class)); + ZstackSysSetTxPowerSrsp response = (ZstackSysSetTxPowerSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from SetTxPower command"); + return null; + } + logger.debug(response.toString()); + return response.getTxPower(); + } + + /** + * Sets the channels that can be used in the NCP + * + * @param channelMask the {@link ZigBeeChannelMask} to set + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setChannelMask(ZigBeeChannelMask channelMask) { + // TODO: ZCD_NV_CHANLIST + ZstackUtilSetChannelsSreq request = new ZstackUtilSetChannelsSreq(); + request.setChannels(channelMask.getChannelMask()); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilSetChannelsSrsp.class)); + ZstackUtilSetChannelsSrsp response = (ZstackUtilSetChannelsSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from SetChannels command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Starts the application on the NCP. This will put the NCP onto the network. + * + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode startupApplication() { + ZstackZdoStartupFromAppSreq request = new ZstackZdoStartupFromAppSreq(); + request.setStartDelay(100); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoStartupFromAppSrsp.class)); + ZstackZdoStartupFromAppSrsp response = (ZstackZdoStartupFromAppSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from StartupApplication command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Registers for a ZDO callback + * + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode zdoRegisterCallback(int clusterId) { + ZstackZdoMsgCbRegisterSreq request = new ZstackZdoMsgCbRegisterSreq(); + request.setClusterId(clusterId); + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoMsgCbRegisterSrsp.class)); + ZstackZdoMsgCbRegisterSrsp response = (ZstackZdoMsgCbRegisterSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from RegisterZdoCallback command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Registers an AF Endpoint in the NCP + * + * @param endpointId the endpoint number to add + * @param deviceId the device id for the endpoint + * @param profileId the profile id + * @param inputClusters an array of input clusters supported by the endpoint + * @param outputClusters an array of output clusters supported by the endpoint + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters, + int[] outputClusters) { + ZstackAfRegisterSreq request = new ZstackAfRegisterSreq(); + request.setEndPoint(endpointId); + request.setAppDeviceId(deviceId); + request.setAppProfId(profileId); + request.setAppInClusterList(inputClusters); + request.setAppOutClusterList(outputClusters); + request.setLatencyReq(0); + request.setAppDevVer(0); + + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackAfRegisterSrsp.class)); + ZstackAfRegisterSrsp response = (ZstackAfRegisterSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from RegisterEndpoint command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Adds an install code to the NCP. The code must be a ZigBee key - ie not the install code itself. + * + * @param ieeeAddress the {@link IeeeAddress} associated with the key + * @param key the {@link ZigBeeKey} to set + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode addInstallCode(IeeeAddress ieeeAddress, ZigBeeKey key) { + ZstackAppCnfBdbAddInstallcodeSreq request = new ZstackAppCnfBdbAddInstallcodeSreq(); + request.setInstallCodeFormat(ZstackInstallCodeFormat.DERIVED_KEY); + request.setIeeeAddress(ieeeAddress); + request.setInstallCode(key); + + ZstackTransaction transaction = protocolHandler + .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbAddInstallcodeSrsp.class)); + ZstackAppCnfBdbAddInstallcodeSrsp response = (ZstackAppCnfBdbAddInstallcodeSrsp) transaction.getResponse(); + if (response == null) { + logger.debug("No response from AddInstallCode command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + private int[] valueFromBoolean(boolean value) { + return new int[] { value ? 1 : 0 }; + } + + private int[] valueFromUInt8(int value) { + return new int[] { value }; + } + + private int[] valueFromUInt16(int value) { + return new int[] { value & 0xFF, (value >> 8) & 0xFF }; + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java new file mode 100644 index 0000000000..fa0dfe6a0d --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +/** + * Base class for all ZStack commands + * + * @author Chris Jackson + * + */ +public abstract class ZstackCommand { + /** + * Definitions of API subsystems + */ + protected static int ZSTACK_RPC = 0x00; + protected static int ZSTACK_SYS = 0x01; + protected static int ZSTACK_MAC = 0x02; + protected static int ZSTACK_AF = 0x04; + protected static int ZSTACK_ZDO = 0x05; + protected static int ZSTACK_SAPI = 0x06; + protected static int ZSTACK_UTIL = 0x07; + protected static int ZSTACK_APP = 0x09; + protected static int ZSTACK_SBL = 0x0D; + protected static int ZSTACK_APP_CNF = 0x0F; + + /** + * Flag denoting if this command/request is done synchronously + */ + protected boolean synchronousCommand = false; + + /** + * Returns true if this request/response is performed synchronously + * + * @return true if the request requires asynchronous response + */ + public boolean isSynchronous() { + return synchronousCommand; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java new file mode 100644 index 0000000000..78b92e9789 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbCommissioningNotificationAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.mac.ZstackMacScanReqSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbHandshakeCmdSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbWriteCmdSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysGetExtAddrSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetExtAddrSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsClearStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsInitStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsRestoreStatsNvSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsSaveStatsToNvSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyDataGetSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyNvIdGetSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPanidSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPrecfgkeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetSeclevelSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoGetLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoLeaveIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoNwkDiscoveryReqSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoRemoveLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Factory class to create Z-Stack commands from incoming data. This will only create {@link ZstackFrameResponse}s. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackFrameFactory { + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(ZstackFrameFactory.class); + + /* + * Subsystem definitions + */ + public static int ZSTACK_RPC = 0x0000; + public static int ZSTACK_SYS = 0x0100; + public static int ZSTACK_MAC = 0x0200; + public static int ZSTACK_AF = 0x0400; + public static int ZSTACK_ZDO = 0x0500; + public static int ZSTACK_SAPI = 0x0600; + public static int ZSTACK_UTIL = 0x0700; + public static int ZSTACK_APP_CNF = 0x0F00; + public static int ZSTACK_SBL = 0x0D00; + + /** + * Subsystem definition mask + */ + private static int ZSTACK_SUBSYSTEM_MASK = 0x1F; + + private static final int AF_DATA_CONFIRM = 0x80; + private static final int AF_DATA_REQUEST = 0x01; + private static final int AF_INCOMING_MSG = 0x81; + private static final int AF_REGISTER = 0x00; + private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x02; + private static final int APP_CNF_BDB_COMMISSIONING_NOTIFICATION = 0x80; + private static final int APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY = 0x07; + private static final int APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY = 0x06; + private static final int APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE = 0x09; + private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x02; + private static final int MAC_SCAN_REQ = 0x0C; + private static final int RPC_SREQ_ERROR = 0x00; + private static final int SB_HANDSHAKE_CMD = 0x04; + private static final int SB_WRITE_CMD = 0x00; + private static final int SYS_GET_EXT_ADDR = 0x04; + private static final int SYS_OSAL_NV_READ = 0x08; + private static final int SYS_OSAL_NV_WRITE = 0x09; + private static final int SYS_PING = 0x01; + private static final int SYS_RESET_IND = 0x80; + private static final int SYS_SET_EXT_ADDR = 0x03; + private static final int SYS_SET_TX_POWER = 0x14; + private static final int SYS_VERSION = 0x02; + private static final int SYS_ZDIAGS_CLEAR_STATS = 0x18; + private static final int SYS_ZDIAGS_GET_STATS = 0x19; + private static final int SYS_ZDIAGS_INIT_STATS = 0x17; + private static final int SYS_ZDIAGS_RESTORE_STATS_NV = 0x1A; + private static final int SYS_ZDIAGS_SAVE_STATS_TO_NV = 0x1B; + private static final int UTIL_APSME_LINK_KEY_DATA_GET = 0x44; + private static final int UTIL_APSME_LINK_KEY_NV_ID_GET = 0x45; + private static final int UTIL_GET_DEVICE_INFO = 0x00; + private static final int UTIL_GET_NV_INFO = 0x01; + private static final int UTIL_LED_CONTROL = 0x09; + private static final int UTIL_SET_CHANNELS = 0x03; + private static final int UTIL_SET_PANID = 0x02; + private static final int UTIL_SET_PRECFGKEY = 0x05; + private static final int UTIL_SET_SECLEVEL = 0x04; + private static final int ZB_GET_DEVICE_INFO = 0x06; + private static final int ZB_READ_CONFIGURATION = 0x04; + private static final int ZB_WRITE_CONFIGURATION = 0x05; + private static final int ZDO_GET_LINK_KEY = 0x25; + private static final int ZDO_LEAVE_IND = 0xC9; + private static final int ZDO_MSG_CB_INCOMING = 0xFF; + private static final int ZDO_MSG_CB_REGISTER = 0x3E; + private static final int ZDO_NWK_DISCOVERY_REQ = 0x26; + private static final int ZDO_REMOVE_LINK_KEY = 0x24; + private static final int ZDO_SET_LINK_KEY = 0x23; + private static final int ZDO_STARTUP_FROM_APP = 0x40; + private static final int ZDO_STATE_CHANGE_IND = 0xC0; + private static final int ZDO_TC_DEV_IND = 0xCA; + + private static Map> zstackFrameMap = new HashMap>(); + + static { + zstackFrameMap.put(ZSTACK_AF + AF_DATA_CONFIRM, ZstackAfDataConfirmAreq.class); + zstackFrameMap.put(ZSTACK_AF + AF_DATA_REQUEST, ZstackAfDataRequestSrsp.class); + zstackFrameMap.put(ZSTACK_AF + AF_INCOMING_MSG, ZstackAfIncomingMsgAreq.class); + zstackFrameMap.put(ZSTACK_AF + AF_REGISTER, ZstackAfRegisterSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_ADD_INSTALLCODE, ZstackAppCnfBdbAddInstallcodeSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_COMMISSIONING_NOTIFICATION, ZstackAppCnfBdbCommissioningNotificationAreq.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY, ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_SET_ALLOWREJOIN_TC_POLICY, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); + zstackFrameMap.put(ZSTACK_MAC + MAC_SCAN_REQ, ZstackMacScanReqSrsp.class); + zstackFrameMap.put(ZSTACK_RPC + RPC_SREQ_ERROR, ZstackRpcSreqErrorSrsp.class); + zstackFrameMap.put(ZSTACK_SBL + SB_HANDSHAKE_CMD, ZstackSbHandshakeCmdSrsp.class); + zstackFrameMap.put(ZSTACK_SBL + SB_WRITE_CMD, ZstackSbWriteCmdSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_GET_EXT_ADDR, ZstackSysGetExtAddrSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_READ, ZstackSysOsalNvReadSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_WRITE, ZstackSysOsalNvWriteSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_PING, ZstackSysPingSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_RESET_IND, ZstackSysResetIndAreq.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_SET_EXT_ADDR, ZstackSysSetExtAddrSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_SET_TX_POWER, ZstackSysSetTxPowerSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_VERSION, ZstackSysVersionSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_CLEAR_STATS, ZstackSysZdiagsClearStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_GET_STATS, ZstackSysZdiagsGetStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_INIT_STATS, ZstackSysZdiagsInitStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_RESTORE_STATS_NV, ZstackSysZdiagsRestoreStatsNvSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_SAVE_STATS_TO_NV, ZstackSysZdiagsSaveStatsToNvSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_DATA_GET, ZstackUtilApsmeLinkKeyDataGetSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_NV_ID_GET, ZstackUtilApsmeLinkKeyNvIdGetSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_DEVICE_INFO, ZstackUtilGetDeviceInfoSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_NV_INFO, ZstackUtilGetNvInfoSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_LED_CONTROL, ZstackUtilLedControlSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_CHANNELS, ZstackUtilSetChannelsSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PANID, ZstackUtilSetPanidSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PRECFGKEY, ZstackUtilSetPrecfgkeySrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_SECLEVEL, ZstackUtilSetSeclevelSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_GET_DEVICE_INFO, ZstackZbGetDeviceInfoSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_READ_CONFIGURATION, ZstackZbReadConfigurationSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_WRITE_CONFIGURATION, ZstackZbWriteConfigurationSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_GET_LINK_KEY, ZstackZdoGetLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_LEAVE_IND, ZstackZdoLeaveIndAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_INCOMING, ZstackZdoMsgCbIncomingAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_REGISTER, ZstackZdoMsgCbRegisterSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_NWK_DISCOVERY_REQ, ZstackZdoNwkDiscoveryReqSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_REMOVE_LINK_KEY, ZstackZdoRemoveLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_SET_LINK_KEY, ZstackZdoSetLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_STARTUP_FROM_APP, ZstackZdoStartupFromAppSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_STATE_CHANGE_IND, ZstackZdoStateChangeIndAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_TC_DEV_IND, ZstackZdoTcDevIndAreq.class); + } + + /** + * Creates and {@link ZstackFrameResponse} from the incoming data. + * + * @param data the int[] containing the ZStack data from which to generate the frame + * @return the {@link ZstackFrameResponse} or null if the response can't be created. + */ + public static ZstackFrameResponse createFrame(int[] data) { + if (data.length < 2) { + return null; + } + + int cmdId = ((data[0] & ZSTACK_SUBSYSTEM_MASK) << 8) + data[1]; + Class zstackClass = zstackFrameMap.get(cmdId); + + if (zstackClass == null) { + return null; + } + + Constructor ctor; + try { + ctor = zstackClass.getConstructor(int[].class); + return (ZstackFrameResponse) ctor.newInstance(data); + } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | InstantiationException + | IllegalAccessException | InvocationTargetException e) { + logger.debug("Error creating instance of ZstackCommand", e); + } + + return null; + } + + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java new file mode 100644 index 0000000000..18a92672a5 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import java.util.Arrays; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * + * @author Chris Jackson + * + */ +public abstract class ZstackFrameRequest extends ZstackCommand { + private int[] buffer = new int[250]; + private int length = 4; + + private static final int ZSTACK_SOF = 0xFE; + + protected int ZSTACK_SREQ = 0x20; + protected int ZSTACK_AREQ = 0x40; + protected int ZSTACK_ACMD = 0x40; + + public abstract int[] serialize(); + + protected void serializeHeader(int type, int subsystem, int id) { + buffer[2] = type + subsystem; + buffer[3] = id; + } + + protected void serializeUInt8(int uint8) { + buffer[length++] = uint8 & 0xFF; + } + + protected void serializeUInt16(int uint16) { + buffer[length++] = uint16 & 0xFF; + buffer[length++] = (uint16 >> 8) & 0xFF; + } + + protected void serializeUInt32(int uint32) { + buffer[length++] = uint32 & 0xFF; + buffer[length++] = (uint32 >> 8) & 0xFF; + buffer[length++] = (uint32 >> 16) & 0xFF; + buffer[length++] = (uint32 >> 24) & 0xFF; + } + + protected void serializeBoolean(boolean bool) { + buffer[length++] = bool ? 1 : 0; + } + + protected void serializeUInt8Array(int[] uint8Array) { + for (int val : uint8Array) { + serializeUInt8(val); + } + } + + protected void serializeUInt16Array(int[] uint16Array) { + for (int val : uint16Array) { + serializeUInt16(val); + } + } + + protected void serializeIeeeAddress(IeeeAddress address) { + buffer[length++] = address.getValue()[0]; + buffer[length++] = address.getValue()[1]; + buffer[length++] = address.getValue()[2]; + buffer[length++] = address.getValue()[3]; + buffer[length++] = address.getValue()[4]; + buffer[length++] = address.getValue()[5]; + buffer[length++] = address.getValue()[6]; + buffer[length++] = address.getValue()[7]; + } + + protected void serializeZigBeeKey(ZigBeeKey keyData) { + serializeUInt8Array(keyData.getValue()); + } + + protected void serializeAfDataOptions(AfDataOptions options2) { + // TODO Auto-generated method stub + + } + + protected int[] getPayload() { + buffer[0] = ZSTACK_SOF; + buffer[1] = length - 4; + + int checksum = 0; + for (int cnt = 1; cnt < length; cnt++) { + checksum ^= buffer[cnt]; + } + buffer[length++] = checksum & 0xFF; + + return Arrays.copyOfRange(buffer, 0, length); + } + + /** + * Processes the {@link ZstackRpcSreqErrorSrsp} response which is an error return from the NCP and checks if it is + * related to this request. + * + * @param response the received {@link ZstackRpcSreqErrorSrsp} + * @return true if this request matches the command codes in the {@link ZstackRpcSreqErrorSrsp} + */ + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return false; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java new file mode 100644 index 0000000000..84f0f04814 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * + * @author Chris Jackson + * + */ +public abstract class ZstackFrameResponse extends ZstackCommand { + private int[] buffer; + private int position; + + public ZstackFrameResponse(int[] inputBuffer) { + buffer = inputBuffer; + position = 2; // Skip the command ID + } + + protected int deserializeUInt8() { + return buffer[position++]; + } + + protected int deserializeUInt16() { + return buffer[position++] + (buffer[position++] << 8); + } + + protected int deserializeUInt32() { + return buffer[position++] + (buffer[position++] << 8) + (buffer[position++] << 16) + (buffer[position++] << 24); + } + + protected boolean deserializeBoolean() { + return buffer[position++] != 0; + } + + protected IeeeAddress deserializeIeeeAddress() { + int address[] = new int[8]; + for (int cnt = 0; cnt < 8; cnt++) { + address[cnt] = buffer[position++]; + } + return new IeeeAddress(address); + } + + protected int[] deserializeUInt8Array() { + return deserializeUInt8Array(buffer.length - position); + } + + protected int[] deserializeUInt8Array(int len) { + int[] array = new int[len]; + + for (int cnt = 0; cnt < len; cnt++) { + array[cnt] = deserializeUInt8(); + } + + return array; + } + + protected int[] deserializeUInt16Array(int len) { + int[] array = new int[len]; + + for (int cnt = 0; cnt < len; cnt++) { + array[cnt] = deserializeUInt16(); + } + + return array; + } + + protected ZigBeeKey deserializeZigBeeKey() { + return new ZigBeeKey(deserializeUInt8Array(16)); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java new file mode 100644 index 0000000000..370a17daf5 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResponseCode. + *

+ * Global response codes + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResponseCode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + SUCCESS(0x0000), + + /** + * + */ + FAILURE(0x0001), + + /** + * + */ + AF_INVALID_PARAMETER(0x0002), + + /** + * Security manager key table full + */ + AF_MEM_FAIL(0x0010), + + /** + * Security manager key table full + */ + KEY_TABLE_FULL(0x0011), + + /** + * The operation could not be completed because no memory resources were available + */ + MAC_NO_RESOURCES(0x001A), + + /** + * Invalid Request + */ + INVALID_REQUEST(0x00C2), + + /** + * Not Permitted + */ + NOT_PERMITTED(0x00C3), + + /** + * Unknown Device + */ + UNKNOWN_DEVICE(0x00C8), + + /** + * + */ + AF_NO_ROUTE(0x00CD), + + /** + * The scan request failed because a scan is already in progress + */ + MAC_SCAN_IN_PROGRESS(0x00FC); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResponseCode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResponseCode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResponseCode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java new file mode 100644 index 0000000000..1608a9f294 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration AfDataOptions. + *

+ * Options applied when sending frames + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum AfDataOptions { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * Set this bit to request APS acknowledgement for this packet + */ + AF_ACK_REQUEST(0x0010), + + /** + * Set this bit to force route discovery if a routing table entry doesn’t exist + */ + AF_DISCV_ROUTE(0x0020), + + /** + * Set this bit to enable APS security for this packet. + */ + AF_EN_SECURITY(0x0040); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (AfDataOptions s : values()) { + codeMapping.put(s.key, s); + } + } + + private AfDataOptions(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static AfDataOptions valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java new file mode 100644 index 0000000000..401eae51d2 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command AF_DATA_CONFIRM. + *

+ * This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a + * AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status + * of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm + * carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This + * also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of + * the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS + * acknowledgement is received. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfDataConfirmAreq extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Endpoint of the device. + */ + private int endpoint; + + /** + * Specifies the transaction sequence number of the message. + */ + private int transId; + + /** + * Response and Handler constructor + */ + public ZstackAfDataConfirmAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + endpoint = deserializeUInt8(); + transId = deserializeUInt8(); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Endpoint of the device. + * + * @return the current endpoint as {@link int} + */ + public int getEndpoint() { + return endpoint; + } + + /** + * Endpoint of the device. + * + * @param endpoint the Endpoint to set as {@link int} + */ + public void setEndpoint(int endpoint) { + this.endpoint = endpoint; + } + + /** + * Specifies the transaction sequence number of the message. + * + * @return the current transId as {@link int} + */ + public int getTransId() { + return transId; + } + + /** + * Specifies the transaction sequence number of the message. + * + * @param transId the TransId to set as {@link int} + */ + public void setTransId(int transId) { + this.transId = transId; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackAfDataConfirmAreq [status="); + builder.append(status); + builder.append(", endpoint="); + builder.append(String.format("%02X", endpoint)); + builder.append(", transId="); + builder.append(String.format("%02X", transId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java new file mode 100644 index 0000000000..77a8670fd7 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java @@ -0,0 +1,290 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import java.util.HashSet; +import java.util.Set; + +/** + * Class to implement the Z-Stack command AF_DATA_REQUEST. + *

+ * This command is used by the App processor to build and send a message through AF layer. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfDataRequestSreq extends ZstackFrameRequest { + + /** + * Short address of the destination device. + */ + private int dstAddr; + + /** + * Endpoint of the destination device. + */ + private int destEndpoint; + + /** + * Endpoint of the source device. + */ + private int srcEndpoint; + + /** + * Specifies the cluster ID. + */ + private int clusterId; + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + */ + private int transId; + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + *

+ * Parameter allows multiple options so implemented as a {@link Set}. + */ + private Set options = new HashSet<>(); + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + */ + private int radius; + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + */ + private int[] data; + + /** + * Request constructor + */ + public ZstackAfDataRequestSreq() { + synchronousCommand = true; + } + + /** + * Short address of the destination device. + * + * @return the current dstAddr as {@link int} + */ + public int getDstAddr() { + return dstAddr; + } + + /** + * Short address of the destination device. + * + * @param dstAddr the DstAddr to set as {@link int} + */ + public void setDstAddr(int dstAddr) { + this.dstAddr = dstAddr; + } + + /** + * Endpoint of the destination device. + * + * @return the current destEndpoint as {@link int} + */ + public int getDestEndpoint() { + return destEndpoint; + } + + /** + * Endpoint of the destination device. + * + * @param destEndpoint the DestEndpoint to set as {@link int} + */ + public void setDestEndpoint(int destEndpoint) { + this.destEndpoint = destEndpoint; + } + + /** + * Endpoint of the source device. + * + * @return the current srcEndpoint as {@link int} + */ + public int getSrcEndpoint() { + return srcEndpoint; + } + + /** + * Endpoint of the source device. + * + * @param srcEndpoint the SrcEndpoint to set as {@link int} + */ + public void setSrcEndpoint(int srcEndpoint) { + this.srcEndpoint = srcEndpoint; + } + + /** + * Specifies the cluster ID. + * + * @return the current clusterId as {@link int} + */ + public int getClusterID() { + return clusterId; + } + + /** + * Specifies the cluster ID. + * + * @param clusterId the ClusterID to set as {@link int} + */ + public void setClusterID(int clusterId) { + this.clusterId = clusterId; + } + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + * + * @return the current transId as {@link int} + */ + public int getTransID() { + return transId; + } + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + * + * @param transId the TransID to set as {@link int} + */ + public void setTransID(int transId) { + this.transId = transId; + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @return the current options as {@link Set} of {@link AfDataOptions} + */ + public Set getOptions() { + return options; + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @param options the Options to add to the {@link Set} as {@link AfDataOptions} + */ + public void addOptions(AfDataOptions options) { + this.options.add(options); + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @param options the Options to remove to the {@link Set} as {@link AfDataOptions} + */ + public void removeOptions(AfDataOptions options) { + this.options.remove(options); + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @return the current radius as {@link int} + */ + public int getRadius() { + return radius; + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @param radius the Radius to set as {@link int} + */ + public void setRadius(int radius) { + this.radius = radius; + } + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x01); + + // Serialize the fields + serializeUInt16(dstAddr); + serializeUInt8(destEndpoint); + serializeUInt8(srcEndpoint); + serializeUInt16(clusterId); + serializeUInt8(transId); + int tmpOptions = 0; + for (AfDataOptions value : options) { + tmpOptions += value.getKey(); + } + serializeUInt8(tmpOptions); + serializeUInt8(radius); + serializeUInt8(data.length); + serializeUInt8Array(data); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(251); + builder.append("ZstackAfDataRequestSreq [dstAddr="); + builder.append(String.format("%04X", dstAddr)); + builder.append(", destEndpoint="); + builder.append(String.format("%02X", destEndpoint)); + builder.append(", srcEndpoint="); + builder.append(String.format("%02X", srcEndpoint)); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", transId="); + builder.append(String.format("%02X", transId)); + builder.append(", options="); + builder.append(options); + builder.append(", radius="); + builder.append(radius); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java new file mode 100644 index 0000000000..3f9f6c747f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command AF_DATA_REQUEST. + *

+ * This command is used by the App processor to build and send a message through AF layer. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfDataRequestSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAfDataRequestSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackAfDataRequestSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java new file mode 100644 index 0000000000..3ea537a930 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java @@ -0,0 +1,334 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command AF_INCOMING_MSG. + *

+ * This callback message is in response to incoming data to any of the registered endpoints on this device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfIncomingMsgAreq extends ZstackFrameResponse { + + /** + * Specifies the group ID of the device. + */ + private int groupId; + + /** + * Specifies the cluster ID. + */ + private int clusterId; + + /** + * Specifies the ZigBee network address of the source device sending the message. + */ + private int srcAddr; + + /** + * Specifies the source endpoint of the message. + */ + private int srcEndpoint; + + /** + * Specifies the destination endpoint of the message. + */ + private int destEndpoint; + + /** + * Specifies if the message was a broadcast or not. + */ + private boolean wasBroadcast; + + /** + * Indicates the link quality measured during reception. + */ + private int linkQuality; + + /** + * Specifies if the security is used or not. + */ + private boolean securityUse; + + /** + * Specifies the timestamp of the message. + */ + private int timeStamp; + + /** + * Specifies transaction sequence number of the message. + */ + private int seqNumber; + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + */ + private int[] data; + + /** + * Response and Handler constructor + */ + public ZstackAfIncomingMsgAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + groupId = deserializeUInt16(); + clusterId = deserializeUInt16(); + srcAddr = deserializeUInt16(); + srcEndpoint = deserializeUInt8(); + destEndpoint = deserializeUInt8(); + wasBroadcast = deserializeBoolean(); + linkQuality = deserializeUInt8(); + securityUse = deserializeBoolean(); + timeStamp = deserializeUInt32(); + seqNumber = deserializeUInt8(); + int len = deserializeUInt8(); + data = deserializeUInt8Array(len); + } + + /** + * Specifies the group ID of the device. + * + * @return the current groupId as {@link int} + */ + public int getGroupId() { + return groupId; + } + + /** + * Specifies the group ID of the device. + * + * @param groupId the GroupId to set as {@link int} + */ + public void setGroupId(int groupId) { + this.groupId = groupId; + } + + /** + * Specifies the cluster ID. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * Specifies the cluster ID. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + /** + * Specifies the ZigBee network address of the source device sending the message. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Specifies the ZigBee network address of the source device sending the message. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * Specifies the source endpoint of the message. + * + * @return the current srcEndpoint as {@link int} + */ + public int getSrcEndpoint() { + return srcEndpoint; + } + + /** + * Specifies the source endpoint of the message. + * + * @param srcEndpoint the SrcEndpoint to set as {@link int} + */ + public void setSrcEndpoint(int srcEndpoint) { + this.srcEndpoint = srcEndpoint; + } + + /** + * Specifies the destination endpoint of the message. + * + * @return the current destEndpoint as {@link int} + */ + public int getDestEndpoint() { + return destEndpoint; + } + + /** + * Specifies the destination endpoint of the message. + * + * @param destEndpoint the DestEndpoint to set as {@link int} + */ + public void setDestEndpoint(int destEndpoint) { + this.destEndpoint = destEndpoint; + } + + /** + * Specifies if the message was a broadcast or not. + * + * @return the current wasBroadcast as {@link boolean} + */ + public boolean getWasBroadcast() { + return wasBroadcast; + } + + /** + * Specifies if the message was a broadcast or not. + * + * @param wasBroadcast the WasBroadcast to set as {@link boolean} + */ + public void setWasBroadcast(boolean wasBroadcast) { + this.wasBroadcast = wasBroadcast; + } + + /** + * Indicates the link quality measured during reception. + * + * @return the current linkQuality as {@link int} + */ + public int getLinkQuality() { + return linkQuality; + } + + /** + * Indicates the link quality measured during reception. + * + * @param linkQuality the LinkQuality to set as {@link int} + */ + public void setLinkQuality(int linkQuality) { + this.linkQuality = linkQuality; + } + + /** + * Specifies if the security is used or not. + * + * @return the current securityUse as {@link boolean} + */ + public boolean getSecurityUse() { + return securityUse; + } + + /** + * Specifies if the security is used or not. + * + * @param securityUse the SecurityUse to set as {@link boolean} + */ + public void setSecurityUse(boolean securityUse) { + this.securityUse = securityUse; + } + + /** + * Specifies the timestamp of the message. + * + * @return the current timeStamp as {@link int} + */ + public int getTimeStamp() { + return timeStamp; + } + + /** + * Specifies the timestamp of the message. + * + * @param timeStamp the TimeStamp to set as {@link int} + */ + public void setTimeStamp(int timeStamp) { + this.timeStamp = timeStamp; + } + + /** + * Specifies transaction sequence number of the message. + * + * @return the current seqNumber as {@link int} + */ + public int getSeqNumber() { + return seqNumber; + } + + /** + * Specifies transaction sequence number of the message. + * + * @param seqNumber the SeqNumber to set as {@link int} + */ + public void setSeqNumber(int seqNumber) { + this.seqNumber = seqNumber; + } + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(326); + builder.append("ZstackAfIncomingMsgAreq [groupId="); + builder.append(String.format("%04X", groupId)); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", srcEndpoint="); + builder.append(String.format("%02X", srcEndpoint)); + builder.append(", destEndpoint="); + builder.append(String.format("%02X", destEndpoint)); + builder.append(", wasBroadcast="); + builder.append(wasBroadcast); + builder.append(", linkQuality="); + builder.append(linkQuality); + builder.append(", securityUse="); + builder.append(securityUse); + builder.append(", timeStamp="); + builder.append(String.format("%08X", timeStamp)); + builder.append(", seqNumber="); + builder.append(String.format("%02X", seqNumber)); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java new file mode 100644 index 0000000000..0a2b4cc365 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -0,0 +1,248 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command AF_REGISTER. + *

+ * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where + * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint + * description per application profile. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfRegisterSreq extends ZstackFrameRequest { + + /** + * Specifies the endpoint of this simple descriptor. + */ + private int endPoint; + + /** + * Specifies the profile id of the application. + */ + private int appProfId; + + /** + * Specifies the device description id for this endpoint. + */ + private int appDeviceId; + + /** + * Specifies the device version number. + */ + private int appDevVer; + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + */ + private int latencyReq; + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + */ + private int[] appInClusterList; + + /** + * Specifies the list of Output Cluster Ids ( 2bytes each ) + */ + private int[] appOutClusterList; + + /** + * Request constructor + */ + public ZstackAfRegisterSreq() { + synchronousCommand = true; + } + + /** + * Specifies the endpoint of this simple descriptor. + * + * @return the current endPoint as {@link int} + */ + public int getEndPoint() { + return endPoint; + } + + /** + * Specifies the endpoint of this simple descriptor. + * + * @param endPoint the EndPoint to set as {@link int} + */ + public void setEndPoint(int endPoint) { + this.endPoint = endPoint; + } + + /** + * Specifies the profile id of the application. + * + * @return the current appProfId as {@link int} + */ + public int getAppProfId() { + return appProfId; + } + + /** + * Specifies the profile id of the application. + * + * @param appProfId the AppProfId to set as {@link int} + */ + public void setAppProfId(int appProfId) { + this.appProfId = appProfId; + } + + /** + * Specifies the device description id for this endpoint. + * + * @return the current appDeviceId as {@link int} + */ + public int getAppDeviceId() { + return appDeviceId; + } + + /** + * Specifies the device description id for this endpoint. + * + * @param appDeviceId the AppDeviceId to set as {@link int} + */ + public void setAppDeviceId(int appDeviceId) { + this.appDeviceId = appDeviceId; + } + + /** + * Specifies the device version number. + * + * @return the current appDevVer as {@link int} + */ + public int getAppDevVer() { + return appDevVer; + } + + /** + * Specifies the device version number. + * + * @param appDevVer the AppDevVer to set as {@link int} + */ + public void setAppDevVer(int appDevVer) { + this.appDevVer = appDevVer; + } + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + * + * @return the current latencyReq as {@link int} + */ + public int getLatencyReq() { + return latencyReq; + } + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + * + * @param latencyReq the LatencyReq to set as {@link int} + */ + public void setLatencyReq(int latencyReq) { + this.latencyReq = latencyReq; + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @return the current appInClusterList as {@link int[]} + */ + public int[] getAppInClusterList() { + return appInClusterList; + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @param appInClusterList the AppInClusterList to set as {@link int[]} + */ + public void setAppInClusterList(int[] appInClusterList) { + this.appInClusterList = appInClusterList; + } + + /** + * Specifies the list of Output Cluster Ids ( 2bytes each ) + * + * @return the current appOutClusterList as {@link int[]} + */ + public int[] getAppOutClusterList() { + return appOutClusterList; + } + + /** + * Specifies the list of Output Cluster Ids ( 2bytes each ) + * + * @param appOutClusterList the AppOutClusterList to set as {@link int[]} + */ + public void setAppOutClusterList(int[] appOutClusterList) { + this.appOutClusterList = appOutClusterList; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x00); + + // Serialize the fields + serializeUInt8(endPoint); + serializeUInt16(appProfId); + serializeUInt16(appDeviceId); + serializeUInt8(appDevVer); + serializeUInt8(latencyReq); + serializeUInt8(appInClusterList.length); + serializeUInt16Array(appInClusterList); + serializeUInt8(appOutClusterList.length); + serializeUInt16Array(appOutClusterList); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(248); + builder.append("ZstackAfRegisterSreq [endPoint="); + builder.append(String.format("%02X", endPoint)); + builder.append(", appProfId="); + builder.append(appProfId); + builder.append(", appDeviceId="); + builder.append(appDeviceId); + builder.append(", appDevVer="); + builder.append(appDevVer); + builder.append(", latencyReq="); + builder.append(latencyReq); + builder.append(", appInClusterList="); + for (int c = 0; c < appInClusterList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", appInClusterList[c])); + } + builder.append(", appOutClusterList="); + for (int c = 0; c < appOutClusterList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", appOutClusterList[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java new file mode 100644 index 0000000000..43266c7593 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command AF_REGISTER. + *

+ * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where + * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint + * description per application profile. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAfRegisterSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAfRegisterSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(48); + builder.append("ZstackAfRegisterSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java new file mode 100644 index 0000000000..2bf6b1aa36 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. + *

+ * Add a preconfigured key (plain key or IC) to Trust Center device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbAddInstallcodeSreq extends ZstackFrameRequest { + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + */ + private ZstackInstallCodeFormat installCodeFormat; + + /** + * Full IEEE address for the device joining the network + */ + private IeeeAddress ieeeAddress; + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + */ + private ZigBeeKey installCode; + + /** + * Request constructor + */ + public ZstackAppCnfBdbAddInstallcodeSreq() { + synchronousCommand = true; + } + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + * + * @return the current installCodeFormat as {@link ZstackInstallCodeFormat} + */ + public ZstackInstallCodeFormat getInstallCodeFormat() { + return installCodeFormat; + } + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + * + * @param installCodeFormat the InstallCodeFormat to set as {@link ZstackInstallCodeFormat} + */ + public void setInstallCodeFormat(ZstackInstallCodeFormat installCodeFormat) { + this.installCodeFormat = installCodeFormat; + } + + /** + * Full IEEE address for the device joining the network + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * Full IEEE address for the device joining the network + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + * + * @return the current installCode as {@link ZigBeeKey} + */ + public ZigBeeKey getInstallCode() { + return installCode; + } + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + * + * @param installCode the InstallCode to set as {@link ZigBeeKey} + */ + public void setInstallCode(ZigBeeKey installCode) { + this.installCode = installCode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); + + // Serialize the fields + serializeUInt8(installCodeFormat.getKey()); + serializeIeeeAddress(ieeeAddress); + serializeZigBeeKey(installCode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(111); + builder.append("ZstackAppCnfBdbAddInstallcodeSreq [installCodeFormat="); + builder.append(installCodeFormat); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", installCode="); + builder.append(installCode); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java new file mode 100644 index 0000000000..9c14b9f67c --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. + *

+ * Add a preconfigured key (plain key or IC) to Trust Center device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbAddInstallcodeSrsp extends ZstackFrameResponse { + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbAddInstallcodeSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackAppCnfBdbAddInstallcodeSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java new file mode 100644 index 0000000000..901474929e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackBdbRemainingCommissioningModes; +import java.util.HashSet; +import java.util.Set; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_COMMISSIONING_NOTIFICATION. + *

+ * Callback to receive notifications from BDB process. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbCommissioningNotificationAreq extends ZstackFrameResponse { + + /** + * Status of the commissioning mode being notified + */ + private ZstackBdbStatus status; + + /** + * Commissioning mode for which the notification is done and to which the status is related + */ + private ZstackBdbCommissioningMode commissioningMode; + + /** + * Bitmask of the remaining commissioning modes after this notification. + *

+ * Parameter allows multiple options so implemented as a {@link Set}. + */ + private Set remainingCommissioningModes = new HashSet<>(); + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbCommissioningNotificationAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + status = ZstackBdbStatus.valueOf(deserializeUInt8()); + commissioningMode = ZstackBdbCommissioningMode.valueOf(deserializeUInt8()); + int tmpRemainingCommissioningModes = deserializeUInt8(); + for (ZstackBdbRemainingCommissioningModes value : ZstackBdbRemainingCommissioningModes.values()) { + if ((tmpRemainingCommissioningModes & value.getKey()) != 0) { + remainingCommissioningModes.add(value); + } + } + } + + /** + * Status of the commissioning mode being notified + * + * @return the current status as {@link ZstackBdbStatus} + */ + public ZstackBdbStatus getStatus() { + return status; + } + + /** + * Status of the commissioning mode being notified + * + * @param status the Status to set as {@link ZstackBdbStatus} + */ + public void setStatus(ZstackBdbStatus status) { + this.status = status; + } + + /** + * Commissioning mode for which the notification is done and to which the status is related + * + * @return the current commissioningMode as {@link ZstackBdbCommissioningMode} + */ + public ZstackBdbCommissioningMode getCommissioningMode() { + return commissioningMode; + } + + /** + * Commissioning mode for which the notification is done and to which the status is related + * + * @param commissioningMode the CommissioningMode to set as {@link ZstackBdbCommissioningMode} + */ + public void setCommissioningMode(ZstackBdbCommissioningMode commissioningMode) { + this.commissioningMode = commissioningMode; + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @return the current remainingCommissioningModes as {@link Set} of {@link ZstackBdbRemainingCommissioningModes} + */ + public Set getRemainingCommissioningModes() { + return remainingCommissioningModes; + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @param remainingCommissioningModes the RemainingCommissioningModes to add to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} + */ + public void addRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { + this.remainingCommissioningModes.add(remainingCommissioningModes); + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @param remainingCommissioningModes the RemainingCommissioningModes to remove to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} + */ + public void removeRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { + this.remainingCommissioningModes.remove(remainingCommissioningModes); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(122); + builder.append("ZstackAppCnfBdbCommissioningNotificationAreq [status="); + builder.append(status); + builder.append(", commissioningMode="); + builder.append(commissioningMode); + builder.append(", remainingCommissioningModes="); + builder.append(remainingCommissioningModes); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java new file mode 100644 index 0000000000..c0f5a45958 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. + *

+ * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq extends ZstackFrameRequest { + + /** + * This parameter controls which key will be used when performing association to a centralized network. + */ + private ZstackCentralizedLinkKeyMode centralizedLinkKeyMode; + + /** + * Buffer with the key in any of its formats. + */ + private int installCode; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq() { + synchronousCommand = true; + } + + /** + * This parameter controls which key will be used when performing association to a centralized network. + * + * @return the current centralizedLinkKeyMode as {@link ZstackCentralizedLinkKeyMode} + */ + public ZstackCentralizedLinkKeyMode getCentralizedLinkKeyMode() { + return centralizedLinkKeyMode; + } + + /** + * This parameter controls which key will be used when performing association to a centralized network. + * + * @param centralizedLinkKeyMode the CentralizedLinkKeyMode to set as {@link ZstackCentralizedLinkKeyMode} + */ + public void setCentralizedLinkKeyMode(ZstackCentralizedLinkKeyMode centralizedLinkKeyMode) { + this.centralizedLinkKeyMode = centralizedLinkKeyMode; + } + + /** + * Buffer with the key in any of its formats. + * + * @return the current installCode as {@link int} + */ + public int getInstallCode() { + return installCode; + } + + /** + * Buffer with the key in any of its formats. + * + * @param installCode the InstallCode to set as {@link int} + */ + public void setInstallCode(int installCode) { + this.installCode = installCode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x07)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x07); + + // Serialize the fields + serializeUInt8(centralizedLinkKeyMode.getKey()); + serializeUInt8(installCode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(102); + builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq [centralizedLinkKeyMode="); + builder.append(centralizedLinkKeyMode); + builder.append(", installCode="); + builder.append(installCode); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java new file mode 100644 index 0000000000..3edc3c6815 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. + *

+ * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(77); + builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java new file mode 100644 index 0000000000..a8253791d5 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. + *

+ * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetJoinusesinstallcodekeySreq extends ZstackFrameRequest { + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + */ + private boolean joinUsesInstallCodeKey; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetJoinusesinstallcodekeySreq() { + synchronousCommand = true; + } + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + * + * @return the current joinUsesInstallCodeKey as {@link boolean} + */ + public boolean getJoinUsesInstallCodeKey() { + return joinUsesInstallCodeKey; + } + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + * + * @param joinUsesInstallCodeKey the JoinUsesInstallCodeKey to set as {@link boolean} + */ + public void setJoinUsesInstallCodeKey(boolean joinUsesInstallCodeKey) { + this.joinUsesInstallCodeKey = joinUsesInstallCodeKey; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x06)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x06); + + // Serialize the fields + serializeBoolean(joinUsesInstallCodeKey); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(72); + builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySreq [joinUsesInstallCodeKey="); + builder.append(joinUsesInstallCodeKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java new file mode 100644 index 0000000000..70e05fa3bb --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. + *

+ * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(72); + builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java new file mode 100644 index 0000000000..a20657cd79 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. + *

+ * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetTcRequireKeyExchangeSreq extends ZstackFrameRequest { + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + */ + private boolean trustCenterRequireKeyExchange; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetTcRequireKeyExchangeSreq() { + synchronousCommand = true; + } + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + * + * @return the current trustCenterRequireKeyExchange as {@link boolean} + */ + public boolean getTrustCenterRequireKeyExchange() { + return trustCenterRequireKeyExchange; + } + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + * + * @param trustCenterRequireKeyExchange the TrustCenterRequireKeyExchange to set as {@link boolean} + */ + public void setTrustCenterRequireKeyExchange(boolean trustCenterRequireKeyExchange) { + this.trustCenterRequireKeyExchange = trustCenterRequireKeyExchange; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x09); + + // Serialize the fields + serializeBoolean(trustCenterRequireKeyExchange); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(70); + builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSreq [trustCenterRequireKeyExchange="); + builder.append(trustCenterRequireKeyExchange); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java new file mode 100644 index 0000000000..7618e92946 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. + *

+ * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(70); + builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java new file mode 100644 index 0000000000..db90c7c5be --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. + *

+ * Sets the AllowRejoin TC policy. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfSetAllowrejoinTcPolicySreq extends ZstackFrameRequest { + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + */ + private boolean allowRejoin; + + /** + * Request constructor + */ + public ZstackAppCnfSetAllowrejoinTcPolicySreq() { + synchronousCommand = true; + } + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + * + * @return the current allowRejoin as {@link boolean} + */ + public boolean getAllowRejoin() { + return allowRejoin; + } + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + * + * @param allowRejoin the AllowRejoin to set as {@link boolean} + */ + public void setAllowRejoin(boolean allowRejoin) { + this.allowRejoin = allowRejoin; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); + + // Serialize the fields + serializeBoolean(allowRejoin); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(66); + builder.append("ZstackAppCnfSetAllowrejoinTcPolicySreq [allowRejoin="); + builder.append(allowRejoin); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java new file mode 100644 index 0000000000..b30e53dfce --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. + *

+ * Sets the AllowRejoin TC policy. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfSetAllowrejoinTcPolicySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfSetAllowrejoinTcPolicySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(66); + builder.append("ZstackAppCnfSetAllowrejoinTcPolicySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java new file mode 100644 index 0000000000..691e506422 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbCommissioningMode. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbCommissioningMode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + BDB_COMMISSIONING_INITIALIZATION(0x0000), + + /** + * + */ + BDB_COMMISSIONING_NWK_STEERING(0x0001), + + /** + * + */ + BDB_COMMISSIONING_FORMATION(0x0002), + + /** + * + */ + BDB_COMMISSIONING_FINDING_BINDING(0x0003), + + /** + * + */ + BDB_COMMISSIONING_TOUCHLINK(0x0004), + + /** + * + */ + BDB_COMMISSIONING_PARENT_LOST(0x0005); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbCommissioningMode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbCommissioningMode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbCommissioningMode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java new file mode 100644 index 0000000000..6e490b83b3 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbRemainingCommissioningModes. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbRemainingCommissioningModes { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + BDB_COMMISSIONING_MODE_INITIATOR_TL(0x0001), + + /** + * + */ + BDB_COMMISSIONING_MODE_NWK_STEERING(0x0002), + + /** + * + */ + BDB_COMMISSIONING_MODE_NWK_FORMATION(0x0004), + + /** + * + */ + BDB_COMMISSIONING_MODE_FINDING_BINDING(0x0008), + + /** + * + */ + BDB_COMMISSIONING_MODE_INITIALIZATION(0x0010), + + /** + * + */ + BDB_COMMISSIONING_MODE_PARENT_LOST(0x0020); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbRemainingCommissioningModes s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbRemainingCommissioningModes(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbRemainingCommissioningModes valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java new file mode 100644 index 0000000000..bb15853bec --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbStatus. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbStatus { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + BDB_COMMISSIONING_SUCCESS(0x0000), + + /** + * + */ + BDB_COMMISSIONING_IN_PROGRESS(0x0001), + + /** + * + */ + BDB_COMMISSIONING_NO_NETWORK(0x0002), + + /** + * + */ + BDB_COMMISSIONING_TL_TARGET_FAILURE(0x0003), + + /** + * + */ + BDB_COMMISSIONING_TL_NOT_AA_CAPABLE(0x0004), + + /** + * + */ + BDB_COMMISSIONING_TL_NO_SCAN_RESPONSE(0x0005), + + /** + * + */ + BDB_COMMISSIONING_TL_NOT_PERMITTED(0x0006), + + /** + * + */ + BDB_COMMISSIONING_TCLK_EX_FAILURE(0x0007), + + /** + * + */ + BDB_COMMISSIONING_FORMATION_FAILURE(0x0008), + + /** + * + */ + BDB_COMMISSIONING_FB_TARGET_IN_PROGRESS(0x0009), + + /** + * + */ + BDB_COMMISSIONING_FB_INITIATOR_IN_PROGRESS(0x000A), + + /** + * + */ + BDB_COMMISSIONING_FB_NO_IDENTIFY_QUERY_RESPONSE(0x000B), + + /** + * + */ + BDB_COMMISSIONING_FB_BINDING_TABLE_FULL(0x000C), + + /** + * + */ + BDB_COMMISSIONING_NETWORK_RESTORED(0x000D), + + /** + * + */ + BDB_COMMISSIONING_FAILURE(0x000E); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbStatus s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbStatus(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbStatus valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java new file mode 100644 index 0000000000..bff6527453 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackCentralizedLinkKeyMode. + *

+ * Central link key policies + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackCentralizedLinkKeyMode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * Instruct joining node to use Default Global Trust Center link key. No key buffer required + */ + DEFAULT_GLOBAL_KEY(0x0000), + + /** + * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining + */ + PROVIDED_INSTALL_CODE(0x0001), + + /** + * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining. + * If it fails to decrypt Transport Key, it will automatically try Default Global Trust Center Link Key + */ + PROVIDED_INSTALL_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0002), + + /** + * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes) + */ + PROVIDED_APS_KEY(0x0003), + + /** + * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes). If it fails to decrypt + * Transport Key, it will automatically try Default Global Trust Center Link Key + */ + PROVIDED_APS_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0004); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackCentralizedLinkKeyMode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackCentralizedLinkKeyMode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackCentralizedLinkKeyMode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java new file mode 100644 index 0000000000..6538ddd1c9 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackInstallCodeFormat. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackInstallCodeFormat { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + INSTALL_CODE(0x0001), + + /** + * + */ + DERIVED_KEY(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackInstallCodeFormat s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackInstallCodeFormat(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackInstallCodeFormat valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java new file mode 100644 index 0000000000..19be64b6cb --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java @@ -0,0 +1,271 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.mac; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command MAC_SCAN_REQ. + *

+ * This command is used to send a request to the device to perform a network scan. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackMacScanReqSreq extends ZstackFrameRequest { + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + */ + private int scanChannels; + + /** + * Specifies the scan type: + */ + private int scanType; + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + */ + private int scanDuration; + + /** + * The channel page on which to perform the scan. + */ + private int channelPage; + + /** + * Key Source of this data frame. + */ + private int keySource; + + /** + * Security Level of this data frame: + */ + private int securityLevel; + + /** + * Key Id Mode of this data frame: + */ + private int keyIdMode; + + /** + * Key Index of this data frame. + */ + private int keyIndex; + + /** + * Request constructor + */ + public ZstackMacScanReqSreq() { + synchronousCommand = true; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * Specifies the scan type: + * + * @return the current scanType as {@link int} + */ + public int getScanType() { + return scanType; + } + + /** + * Specifies the scan type: + * + * @param scanType the ScanType to set as {@link int} + */ + public void setScanType(int scanType) { + this.scanType = scanType; + } + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + * + * @return the current scanDuration as {@link int} + */ + public int getScanDuration() { + return scanDuration; + } + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + * + * @param scanDuration the ScanDuration to set as {@link int} + */ + public void setScanDuration(int scanDuration) { + this.scanDuration = scanDuration; + } + + /** + * The channel page on which to perform the scan. + * + * @return the current channelPage as {@link int} + */ + public int getChannelPage() { + return channelPage; + } + + /** + * The channel page on which to perform the scan. + * + * @param channelPage the ChannelPage to set as {@link int} + */ + public void setChannelPage(int channelPage) { + this.channelPage = channelPage; + } + + /** + * Key Source of this data frame. + * + * @return the current keySource as {@link int} + */ + public int getKeySource() { + return keySource; + } + + /** + * Key Source of this data frame. + * + * @param keySource the KeySource to set as {@link int} + */ + public void setKeySource(int keySource) { + this.keySource = keySource; + } + + /** + * Security Level of this data frame: + * + * @return the current securityLevel as {@link int} + */ + public int getSecurityLevel() { + return securityLevel; + } + + /** + * Security Level of this data frame: + * + * @param securityLevel the SecurityLevel to set as {@link int} + */ + public void setSecurityLevel(int securityLevel) { + this.securityLevel = securityLevel; + } + + /** + * Key Id Mode of this data frame: + * + * @return the current keyIdMode as {@link int} + */ + public int getKeyIdMode() { + return keyIdMode; + } + + /** + * Key Id Mode of this data frame: + * + * @param keyIdMode the KeyIdMode to set as {@link int} + */ + public void setKeyIdMode(int keyIdMode) { + this.keyIdMode = keyIdMode; + } + + /** + * Key Index of this data frame. + * + * @return the current keyIndex as {@link int} + */ + public int getKeyIndex() { + return keyIndex; + } + + /** + * Key Index of this data frame. + * + * @param keyIndex the KeyIndex to set as {@link int} + */ + public void setKeyIndex(int keyIndex) { + this.keyIndex = keyIndex; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_MAC) && (response.getReqCmd1() == 0x0C)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_MAC, 0x0C); + + // Serialize the fields + serializeUInt32(scanChannels); + serializeUInt8(scanType); + serializeUInt8(scanDuration); + serializeUInt8(channelPage); + serializeUInt8(keySource); + serializeUInt8(securityLevel); + serializeUInt8(keyIdMode); + serializeUInt8(keyIndex); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(223); + builder.append("ZstackMacScanReqSreq [scanChannels="); + builder.append(scanChannels); + builder.append(", scanType="); + builder.append(scanType); + builder.append(", scanDuration="); + builder.append(scanDuration); + builder.append(", channelPage="); + builder.append(channelPage); + builder.append(", keySource="); + builder.append(keySource); + builder.append(", securityLevel="); + builder.append(securityLevel); + builder.append(", keyIdMode="); + builder.append(keyIdMode); + builder.append(", keyIndex="); + builder.append(keyIndex); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java new file mode 100644 index 0000000000..ed1b6a51b9 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.mac; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command MAC_SCAN_REQ. + *

+ * This command is used to send a request to the device to perform a network scan. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackMacScanReqSrsp extends ZstackFrameResponse { + + /** + * Response and Handler constructor + */ + public ZstackMacScanReqSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + } + + @Override + public String toString() { + return "ZstackMacScanReqSrsp []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java new file mode 100644 index 0000000000..ac6552e32d --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command RPC_SREQ_ERROR. + *

+ * When the ZNP cannot recognize an SREQ command from the host processor, the following SRSP is returned. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackRpcSreqErrorSrsp extends ZstackFrameResponse { + + /** + * The error code maps to one of the enumerated values. + */ + private ZstackSreqErrorCode errorCode; + + /** + * The Cmd0 value of the processed SREQ + */ + private int reqCmd0; + + /** + * The Cmd1 value of the processed SREQ + */ + private int reqCmd1; + + /** + * Response and Handler constructor + */ + public ZstackRpcSreqErrorSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + errorCode = ZstackSreqErrorCode.valueOf(deserializeUInt8()); + reqCmd0 = deserializeUInt8(); + reqCmd1 = deserializeUInt8(); + } + + /** + * The error code maps to one of the enumerated values. + * + * @return the current errorCode as {@link ZstackSreqErrorCode} + */ + public ZstackSreqErrorCode getErrorCode() { + return errorCode; + } + + /** + * The error code maps to one of the enumerated values. + * + * @param errorCode the ErrorCode to set as {@link ZstackSreqErrorCode} + */ + public void setErrorCode(ZstackSreqErrorCode errorCode) { + this.errorCode = errorCode; + } + + /** + * The Cmd0 value of the processed SREQ + * + * @return the current reqCmd0 as {@link int} + */ + public int getReqCmd0() { + return reqCmd0; + } + + /** + * The Cmd0 value of the processed SREQ + * + * @param reqCmd0 the ReqCmd0 to set as {@link int} + */ + public void setReqCmd0(int reqCmd0) { + this.reqCmd0 = reqCmd0; + } + + /** + * The Cmd1 value of the processed SREQ + * + * @return the current reqCmd1 as {@link int} + */ + public int getReqCmd1() { + return reqCmd1; + } + + /** + * The Cmd1 value of the processed SREQ + * + * @param reqCmd1 the ReqCmd1 to set as {@link int} + */ + public void setReqCmd1(int reqCmd1) { + this.reqCmd1 = reqCmd1; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(100); + builder.append("ZstackRpcSreqErrorSrsp [errorCode="); + builder.append(errorCode); + builder.append(", reqCmd0="); + builder.append(String.format("%02X", reqCmd0)); + builder.append(", reqCmd1="); + builder.append(String.format("%02X", reqCmd1)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java new file mode 100644 index 0000000000..1913654f82 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackSreqErrorCode. + *

+ * SREQ RPC Error code + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackSreqErrorCode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + INVALID_SUBSYSTEM(0x0001), + + /** + * + */ + INVALID_COMMAND_ID(0x0002), + + /** + * + */ + INVALID_PARAMETER(0x0003), + + /** + * + */ + INVALID_LENGTH(0x0003); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackSreqErrorCode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackSreqErrorCode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackSreqErrorCode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java new file mode 100644 index 0000000000..1548e284f7 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackDeviceInformation. + *

+ * Device Info Constants + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackDeviceInformation { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + ZB_INFO_DEV_STATE(0x0000), + + /** + * + */ + ZB_INFO_IEEE_ADDR(0x0001), + + /** + * + */ + ZB_INFO_SHORT_ADDR(0x0002), + + /** + * + */ + ZB_INFO_PARENT_SHORT_ADDR(0x0003), + + /** + * + */ + ZB_INFO_PARENT_IEEE_ADDR(0x0004), + + /** + * + */ + ZB_INFO_CHANNEL(0x0005), + + /** + * + */ + ZB_INFO_PAN_ID(0x0006), + + /** + * + */ + ZB_INFO_EXT_PAN_ID(0x0007); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackDeviceInformation s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackDeviceInformation(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackDeviceInformation valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java new file mode 100644 index 0000000000..7371636588 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. + *

+ * This command retrieves a Device Information Property. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbGetDeviceInfoSreq extends ZstackFrameRequest { + + /** + * The Identifier for the device information. + */ + private int param; + + /** + * Request constructor + */ + public ZstackZbGetDeviceInfoSreq() { + synchronousCommand = true; + } + + /** + * The Identifier for the device information. + * + * @return the current param as {@link int} + */ + public int getParam() { + return param; + } + + /** + * The Identifier for the device information. + * + * @param param the Param to set as {@link int} + */ + public void setParam(int param) { + this.param = param; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x06)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x06); + + // Serialize the fields + serializeUInt8(param); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackZbGetDeviceInfoSreq [param="); + builder.append(param); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java new file mode 100644 index 0000000000..b76aec286c --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. + *

+ * This command retrieves a Device Information Property. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbGetDeviceInfoSrsp extends ZstackFrameResponse { + + /** + * The Identifier for the device information. + */ + private int param; + + /** + * A buffer to hold the device information + */ + private int value; + + /** + * Response and Handler constructor + */ + public ZstackZbGetDeviceInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + param = deserializeUInt8(); + value = deserializeUInt16(); + } + + /** + * The Identifier for the device information. + * + * @return the current param as {@link int} + */ + public int getParam() { + return param; + } + + /** + * The Identifier for the device information. + * + * @param param the Param to set as {@link int} + */ + public void setParam(int param) { + this.param = param; + } + + /** + * A buffer to hold the device information + * + * @return the current value as {@link int} + */ + public int getValue() { + return value; + } + + /** + * A buffer to hold the device information + * + * @param value the Value to set as {@link int} + */ + public void setValue(int value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(78); + builder.append("ZstackZbGetDeviceInfoSrsp [param="); + builder.append(param); + builder.append(", value="); + builder.append(value); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java new file mode 100644 index 0000000000..d81384ce5e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; + +/** + * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. + *

+ * This command is used to get a configuration property from non-volatile memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbReadConfigurationSreq extends ZstackFrameRequest { + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Request constructor + */ + public ZstackZbReadConfigurationSreq() { + synchronousCommand = true; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x04); + + // Serialize the fields + serializeUInt8(configId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackZbReadConfigurationSreq [configId="); + builder.append(configId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java new file mode 100644 index 0000000000..1cb2a10e9f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; + +/** + * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. + *

+ * This command is used to get a configuration property from non-volatile memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbReadConfigurationSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Buffer to hold the configuration property. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackZbReadConfigurationSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + configId = ZstackConfigId.valueOf(deserializeUInt8()); + int len = deserializeUInt8(); + value = deserializeUInt8Array(len); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + /** + * Buffer to hold the configuration property. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Buffer to hold the configuration property. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(132); + builder.append("ZstackZbReadConfigurationSrsp [status="); + builder.append(status); + builder.append(", configId="); + builder.append(configId); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java new file mode 100644 index 0000000000..84220da68f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; + +/** + * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. + *

+ * This command is used to write a configuration property to nonvolatile memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbWriteConfigurationSreq extends ZstackFrameRequest { + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Buffer to hold the configuration property. + */ + private int[] value; + + /** + * Request constructor + */ + public ZstackZbWriteConfigurationSreq() { + synchronousCommand = true; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + /** + * Buffer to hold the configuration property. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Buffer to hold the configuration property. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x05)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x05); + + // Serialize the fields + serializeUInt8(configId.getKey()); + serializeUInt8(value.length); + serializeUInt8Array(value); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(108); + builder.append("ZstackZbWriteConfigurationSreq [configId="); + builder.append(configId); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java new file mode 100644 index 0000000000..e3ba4423e2 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. + *

+ * This command is used to write a configuration property to nonvolatile memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZbWriteConfigurationSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZbWriteConfigurationSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(58); + builder.append("ZstackZbWriteConfigurationSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java new file mode 100644 index 0000000000..a4dff033a6 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSbHandshakeCmdSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSbHandshakeCmdSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x04); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSbHandshakeCmdSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java new file mode 100644 index 0000000000..b39ae5818a --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSbHandshakeCmdSrsp extends ZstackFrameResponse { + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + */ + private ZstackResponseCode status; + + /** + */ + private int bootloaderRevision; + + /** + */ + private int deviceType; + + /** + * The maximum data size to use with Read / Write command + */ + private int bufferLength; + + /** + * 0x800 – CC2538 flash page size + */ + private int pageSize; + + /** + * Response and Handler constructor + */ + public ZstackSbHandshakeCmdSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + bootloaderRevision = deserializeUInt32(); + deviceType = deserializeUInt8(); + bufferLength = deserializeUInt32(); + pageSize = deserializeUInt32(); + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * + * + * @return the current bootloaderRevision as {@link int} + */ + public int getBootloaderRevision() { + return bootloaderRevision; + } + + /** + * + * + * @param bootloaderRevision the BootloaderRevision to set as {@link int} + */ + public void setBootloaderRevision(int bootloaderRevision) { + this.bootloaderRevision = bootloaderRevision; + } + + /** + * + * + * @return the current deviceType as {@link int} + */ + public int getDeviceType() { + return deviceType; + } + + /** + * + * + * @param deviceType the DeviceType to set as {@link int} + */ + public void setDeviceType(int deviceType) { + this.deviceType = deviceType; + } + + /** + * The maximum data size to use with Read / Write command + * + * @return the current bufferLength as {@link int} + */ + public int getBufferLength() { + return bufferLength; + } + + /** + * The maximum data size to use with Read / Write command + * + * @param bufferLength the BufferLength to set as {@link int} + */ + public void setBufferLength(int bufferLength) { + this.bufferLength = bufferLength; + } + + /** + * 0x800 – CC2538 flash page size + * + * @return the current pageSize as {@link int} + */ + public int getPageSize() { + return pageSize; + } + + /** + * 0x800 – CC2538 flash page size + * + * @param pageSize the PageSize to set as {@link int} + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(152); + builder.append("ZstackSbHandshakeCmdSrsp [status="); + builder.append(status); + builder.append(", bootloaderRevision="); + builder.append(bootloaderRevision); + builder.append(", deviceType="); + builder.append(deviceType); + builder.append(", bufferLength="); + builder.append(bufferLength); + builder.append(", pageSize="); + builder.append(pageSize); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java new file mode 100644 index 0000000000..552b14b61d --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SB_WRITE_CMD. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSbWriteCmdSreq extends ZstackFrameRequest { + + /** + * Payload data. + */ + private int[] payload; + + /** + * Request constructor + */ + public ZstackSbWriteCmdSreq() { + synchronousCommand = true; + } + + /** + * Payload data. + * + * @return the current payload as {@link int[]} + */ + public int[] getPayload() { + return payload; + } + + /** + * Payload data. + * + * @param payload the Payload to set as {@link int[]} + */ + public void setPayload(int[] payload) { + this.payload = payload; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x00); + + // Serialize the fields + serializeUInt32(payload.length); + serializeUInt8Array(payload); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(73); + builder.append("ZstackSbWriteCmdSreq [payload="); + for (int c = 0; c < payload.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", payload[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java new file mode 100644 index 0000000000..c67e37a891 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SB_WRITE_CMD. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSbWriteCmdSrsp extends ZstackFrameResponse { + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSbWriteCmdSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(48); + builder.append("ZstackSbWriteCmdSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java new file mode 100644 index 0000000000..9ddc3571cc --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -0,0 +1,638 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackConfigId. + *

+ * Device specific configuration parameters. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackConfigId { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + ZCD_NV_EXTADDR(0x0000), + + /** + * + */ + ZCD_NV_BOOTCOUNTER(0x0001), + + /** + * This parameter controls the device startup options. Size: 1 byte; Default value: 0 + */ + ZCD_NV_STARTUP_OPTION(0x0003), + + /** + * + */ + ZCD_NV_START_DELAY(0x0004), + + /** + * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically + * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. + * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an + * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 + */ + ZCD_NV_POLL_RATE_OLD16(0x0035), + + /** + * When an end-device polls for data with its parent and finds that it does have data, it can poll again with a shorter duration in case + * there is more data queued for it at its parent device. This value is specified in milliseconds. This feature can be turned off by + * setting this value to zero. Size: 2 bytes; Default value: 100 + */ + ZCD_NV_QUEUED_POLL_RATE(0x0025), + + /** + * When an end-device sends a data packet, it can poll again with a shorter duration, specified by this parameter, if the + * application is expecting to receive an application level packet in response. This value is specified in milliseconds. This + * feature can be turned off by setting the value to zero. + *

+ * Note: The setting of the queued and response poll rates has to be done with caution if the device is sending and receiving + * at the same time or if the device is sending data too fast. If the device is sending data too fast, setting a queued poll rate with a + * higher duration than the sending rate will cause the poll event to be continuously rescheduled to the future. Then the device + * will never poll for data with its parent and consequently it may miss any packets destined for it. Size: 2 bytes; Default value: + * 100 + */ + ZCD_NV_RESPONSE_POLL_RATE(0x0026), + + /** + * + */ + ZCD_NV_REJOIN_POLL_RATE(0x0027), + + /** + * + */ + ZCD_NV_DATA_RETRIES(0x0028), + + /** + * The number of times an end-device will fail when communicating with its parent before invoking the rejoin mechanism to find and + * join a new parent. Size: 1 byte; Default value: 2. + */ + ZCD_NV_POLL_FAILURE_RETRIES(0x0029), + + /** + * + */ + ZCD_NV_STACK_PROFILE(0x002A), + + /** + * The amount of time (in seconds) that a router or coordinator device will buffer messages destined to their end-device child + * nodes. It is recommended that this is at least greater than the poll rate (ZCD_NV_POLL_RATE) to ensure that end-device will have + * a chance to wakeup and poll for the data. Size: 1 byte; Default value: 7 + */ + ZCD_NV_INDIRECT_MSG_TIMEOUT(0x002B), + + /** + * The amount of time (in seconds) for which a route must be idle (i.e. no packets are transmitted on that route) before that routing + * entry is marked as expired. An expired entry may be deleted if the table is full and the space is needed for another new routing + * entry. This can be set to a special value of 0 to turn off route expiry. In this case, route entries are not expired. Size: 1 byte; + * Default value: 60. + */ + ZCD_NV_ROUTE_EXPIRY_TIME(0x002C), + + /** + * This parameter configures the EXTENDED PAN ID in Z-Stack. The extended pan id is used to further segregate the sub network(s) + * among a bigger PAN network. + */ + ZCD_NV_EXTPANID(0x002D), + + /** + * The maximum number of retransmissions that a device will attempt when trying to transmit a broadcast packet. The typical range + * is from 1 through 3. Size: 1 byte; Default value: 2. + */ + ZCD_NV_BCAST_RETRIES(0x002E), + + /** + * The amount of time (in units of 100milliseconds) a device will wait before retransmitting a broadcast packet. The + * retransmission will not happen if the node hears that each of its neighbor nodes have all transmitted that packet. Size: 1 byte; + * Default value: 5 + */ + ZCD_NV_PASSIVE_ACK_TIMEOUT(0x002F), + + /** + * The maximum amount of time (in units of 100ms) that it can take for a broadcast packet to propagate through the entire network. + * This includes time for all retransmissions. + *

+ * Note: This parameter must be set with caution. It must be set to a value of at least (ZCD_NV_BCAST_RETRIES + 1) * + * ZCD_NV_PASSIVE_ACK_TIMEOUT To be safe, the actual value should be higher than the above minimum by about 500ms or more. Size: 1 + * byte; Default value: 30. + */ + ZCD_NV_BCAST_DELIVERY_TIME(0x0030), + + /** + * Holds the value of the network operational mode. The default value is NWK_MODE_MESH and must not be modified. + */ + ZCD_NV_NWK_MODE(0x0031), + + /** + * + */ + ZCD_NV_CONCENTRATOR_ENABLE(0x0032), + + /** + * + */ + ZCD_NV_CONCENTRATOR_DISCOVERY(0x0033), + + /** + * + */ + ZCD_NV_CONCENTRATOR_RADIUS(0x0034), + + /** + * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically + * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. + * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an + * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 + */ + ZCD_NV_POLL_RATE(0x0035), + + /** + * Holds the value of route cache flag. This enables or disables the route cache for coordinator and is FALSE by default. + */ + ZCD_NV_CONCENTRATOR_RC(0x0036), + + /** + * + */ + ZCD_NV_NWK_MGR_MODE(0x0037), + + /** + * + */ + ZCD_NV_SRC_RTG_EXPIRY_TIME(0x0038), + + /** + * + */ + ZCD_NV_ROUTE_DISCOVERY_TIME(0x0039), + + /** + * + */ + ZCD_NV_NWK_ACTIVE_KEY_INFO(0x003A), + + /** + * + */ + ZCD_NV_NWK_ALTERN_KEY_INFO(0x003B), + + /** + * + */ + ZCD_NV_ROUTER_OFF_ASSOC_CLEANUP(0x003C), + + /** + * + */ + ZCD_NV_NWK_LEAVE_REQ_ALLOWED(0x003D), + + /** + * Holds the value of Child Aging capability flag. This enables or disables child aging and must be set to TRUE for Zigbee 3.0 + * compliance. + */ + ZCD_NV_NWK_CHILD_AGE_ENABLE(0x003E), + + /** + * + */ + ZCD_NV_DEVICE_LIST_KA_TIMEOUT(0x003F), + + /** + * + */ + ZCD_NV_BINDING_TABLE(0x0041), + + /** + * + */ + ZCD_NV_GROUP_TABLE(0x0042), + + /** + * The number of retransmissions performed on a data packet at the application layer if the packet was transmitted with the + * end-to-end acknowledgement option enabled. Size: 1 byte; Default value: 3 + */ + ZCD_NV_APS_FRAME_RETRIES(0x0043), + + /** + * The amount of time (in milliseconds) a device will wait before re-transmitting a packet that used the APS acknowledgement + * option. If the APS acknowledgement is not received by this time, the sending device will assume a failure and attempt a + * re-transmission. + *

+ * Note: This is recommended to be set to approximately the expected round trip time for the packet. Note that if the + * destination (or source) device is an end-device, the round trip time for the packet will include an additional delay up to the + * poll duration. This is in addition to the delay normally caused by the network. Size: 2 bytes; Default value: 3000 + */ + ZCD_NV_APS_ACK_WAIT_DURATION(0x0044), + + /** + * + */ + ZCD_NV_APS_ACK_WAIT_MULTIPLIER(0x0045), + + /** + * The amount of time (in milliseconds) a device will wait for a response to a binding request. Size: 2 bytes; Default value: 8000 + */ + ZCD_NV_BINDING_TIME(0x0046), + + /** + * + */ + ZCD_NV_APS_USE_EXT_PANID(0x0047), + + /** + * + */ + ZCD_NV_COMMISSIONED_NWK_ADDR(0x0049), + + /** + * + */ + ZCD_NV_APS_NONMEMBER_RADIUS(0x004B), + + /** + * Holds the security manager entries of type ZDSecMgrEntry_t to store the TCKL used to talk with devices in the network that + * require APS security. The number of entries is controled by ZDSECMGR_DEVICE_MAX=3 by default. + */ + ZCD_NV_APS_LINK_KEY_TABLE(0x004C), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TIMEOUT_INC(0x004D), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TIMEOUT_COUNT(0x004E), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TABLE_SIZE(0x004F), + + /** + * + */ + ZCD_NV_DIAGNOSTIC_STATS(0x0050), + + /** + * + */ + ZCD_NV_NWK_PARENT_INFO(0x0051), + + /** + * + */ + ZCD_NV_NWK_ENDDEV_TIMEOUT_DEF(0x0052), + + /** + * Holds the value of Child Aging Timeout. This is the time in seconds used by END DEVICE when sending End Device Timeout Request that + * tells a COORDINATOR the timeout to remove this END DEVICE after no data poll is received. + */ + ZCD_NV_END_DEV_TIMEOUT_VALUE(0x0053), + + /** + * Holds the value of End Device Configuration field when END DEVICE when sending End Device Timeout Request. Is set to 0x00 by + * default which is the only valid value accourding to Zigbee Core spec R21. + */ + ZCD_NV_END_DEV_CONFIGURATION(0x0054), + + /** + * + */ + ZCD_NV_BDBNODEISONANETWORK(0x0055), + + /** + * + */ + ZCD_NV_BDBREPORTINGCONFIG(0x0056), + + /** + * holds the value of network key that is generated by default. The key can be set to a fixed value by setting DEFAULT_KEY macro. This + * is used for securing and un-securing packets in the network, if security is enabled for the network. + *

+ * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 16 bytes; + * Default value: [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F] + */ + ZCD_NV_PRECFGKEY(0x0062), + + /** + * If security functionality is enabled, there are two options to distribute the security key to all devices in the network. If this + * parameter is true, the same security key is assumed to be pre-configured in all devices in the network.If it is set to false, then + * the key only needs to be configured on the coordinator device. In this case, the key is distributed to each device upon joining by + * the coordinator. This key distribution will happen in the “clear” on the last hop of the packet transmission and this + * constitutes a brief “period of vulnerability” during which a malicious device can capture the key. Hence it is not recommended + * unless it can be ensured that there are no malicious devices in the vicinity at the time of network formation. + *

+ * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 1 byte; + * Default value: TRUE + */ + ZCD_NV_PRECFGKEYS_ENABLE(0x0063), + + /** + * This parameter determines if security is used or not in this network. It can be set to 0 (to turn off NWK security) or 1 (to turn on NWK + * security). Size: 1 byte; Default value: 0. + */ + ZCD_NV_SECURITY_MODE(0x0064), + + /** + * This value tells if only secure joins are allowed. Set to TRUE by default which is the only valid value according to Zigbee Core + * spec R21. + */ + ZCD_NV_SECURE_PERMIT_JOIN(0x0065), + + /** + * Is equal to ZG_GLOBAL_LINK_KEY=1 and must not be modified according to Zigbee Core spec R21. + */ + ZCD_NV_APS_LINK_KEY_TYPE(0x0066), + + /** + * + */ + ZCD_NV_APS_ALLOW_R19_SECURITY(0x0067), + + /** + * Default distributed nwk key Id. Nv ID not in use + */ + ZCD_NV_DISTRIBUTED_KEY(0x0068), + + /** + * + */ + ZCD_NV_IMPLICIT_CERTIFICATE(0x0069), + + /** + * + */ + ZCD_NV_DEVICE_PRIVATE_KEY(0x006A), + + /** + * + */ + ZCD_NV_CA_PUBLIC_KEY(0x006B), + + /** + * + */ + ZCD_NV_KE_MAX_DEVICES(0x006C), + + /** + * Controls whether a single pre-configured trust center link key is used or whether multiple pre- configured trust center link + * keys are used, hereby referred to as Single Key Mode and Multiple Key Mode, respectively. In multiple key mode, unique + * pre-configured trust center link keys are used between the trust center and each individual device joining the network. + * Multiple key mode is required by the recommended secure procedure in ZigBeeSE profile Specification. In single key mode, all + * devices are using the same pre-configured trust center link key to join the network. The single key mode provides a simplified + * alternative procedure to set up the network. It can be used for testing and debugging purpose. Size: 1 byte; Default value: TRUE + */ + ZCD_NV_USE_DEFAULT_TCLK(0x006D), + + /** + * + */ + ZCD_NV_RNG_COUNTER(0x006F), + + /** + * + */ + ZCD_NV_RANDOM_SEED(0x0070), + + /** + * + */ + ZCD_NV_TRUSTCENTER_ADDR(0x0071), + + /** + * + */ + ZCD_NV_CERT_283(0x0072), + + /** + * + */ + ZCD_NV_PRIVATE_KEY_283(0x0073), + + /** + * + */ + ZCD_NV_PUBLIC_KEY_283(0x0074), + + /** + * + */ + ZCD_NV_NWK_SEC_MATERIAL_TABLE_START(0x0075), + + /** + * + */ + ZCD_NV_NWK_SEC_MATERIAL_TABLE_END(0x0080), + + /** + * An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it can easily identified or + * described later. The first byte is the length of the user descriptor data and must not be greater than 16. Size: 17 bytes; Default + * value: “CC2530-ZNP x......” (dots represent the device IEEE address) + */ + ZCD_NV_USERDESC(0x0081), + + /** + * This holds the value of nwkActiveKeyItems struct and restores the NWK key counter after power cycles. + */ + ZCD_NV_NWKKEY(0x0082), + + /** + * This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. Networks that exist in the same + * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate “don’t care”. Size: + * 2 bytes; Default value: 0xFFFF + */ + ZCD_NV_PANID(0x0083), + + /** + * This parameter is a bit mask of the channels on which this network can operate (note that multiple channels can be selected). See + * section 4.5.16 for a table of the bitmap representation that maps to each channel. Multiple networks that exist in the same + * vicinity are encouraged to have different values. If multiple channels are selected, the coordinator will pick one of the + * channels for network operation. First, an energy scan is performed on each channel and those channels with a high energy level + * are discarded. Then, the coordinator determines the number of existing ZigBee networks on each of the remaining channels and + * picks the one with the fewest networks. For routers and end-devices, the device will simply scan all the selected channels until + * it finds the ZigBee network. Size: 4 bytes; Default value: 0x00000800 + */ + ZCD_NV_CHANLIST(0x0084), + + /** + * + */ + ZCD_NV_SCAN_DURATION(0x0086), + + /** + * This is the logical type of the device in the ZigBee network. This can be set to a COORDINATOR (0x00), ROUTER (0x01) or ENDDEVICE + * (0x02). + *

+ * Note: This parameter is read by the CC2530-ZNP device immediately when it powers up after a reset. Size: 1 byte; Default + * value: 0x00 + */ + ZCD_NV_LOGICAL_TYPE(0x0087), + + /** + * + */ + ZCD_NV_NWKMGR_MIN_TX(0x0088), + + /** + * + */ + ZCD_NV_NWKMGR_ADDR(0x0089), + + /** + * This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the host processor. By + * default, this item is set to FALSE, which means that the host processor must use the ZDO_MSG_CB_REGISTER command to subscribe to + * a specific ZDO callback in order to receive it. The ZDO callback is then conveyed as part of the ZDO_MSG_CB_INCOMING command. If + * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the “verbose” response. For example, the host + * processor would receive the ZDO_IEEE_ADDR_RSP command in response to ZDO_IEEE_ADDR_REQ. Size: 1 byte; Default value: FALSE + */ + ZCD_NV_ZDO_DIRECT_CB(0x008F), + + /** + * + */ + ZCD_NV_SAS_SHORT_ADDR(0x00B1), + + /** + * + */ + ZCD_NV_SAS_EXT_PANID(0x00B2), + + /** + * + */ + ZCD_NV_SAS_PANID(0x00B3), + + /** + * + */ + ZCD_NV_SAS_CHANNEL_MASK(0x00B4), + + /** + * + */ + ZCD_NV_SAS_PROTOCOL_VER(0x00B5), + + /** + * + */ + ZCD_NV_SAS_STACK_PROFILE(0x00B6), + + /** + * + */ + ZCD_NV_SAS_STARTUP_CTRL(0x00B7), + + /** + * + */ + ZCD_NV_SAS_TC_ADDR(0x00C1), + + /** + * + */ + ZCD_NV_SAS_TC_MASTER_KEY(0x00C2), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY(0x00C3), + + /** + * + */ + ZCD_NV_SAS_USE_INSEC_JOIN(0x00C4), + + /** + * + */ + ZCD_NV_SAS_PRECFG_LINK_KEY(0x00C5), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY_SEQ_NUM(0x00C6), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY_TYPE(0x00C7), + + /** + * + */ + ZCD_NV_SAS_NWK_MGR_ADDR(0x00C8), + + /** + * + */ + ZCD_NV_SAS_CURR_TC_MASTER_KEY(0x00D1), + + /** + * + */ + ZCD_NV_SAS_CURR_NWK_KEY(0x00D2); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackConfigId s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackConfigId(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackConfigId valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java new file mode 100644 index 0000000000..f18c1e7e38 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackDiagnosticAttribute. + *

+ * Diagnostics attribute IDs. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackDiagnosticAttribute { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * System Clock when stats were saved/cleared + */ + ZDIAGS_SYSTEM_CLOCK(0x0000), + + /** + * Increments every time the system resets + */ + ZDIAGS_NUMBER_OF_RESETS(0x0001), + + /** + * MAC diagnostic CRC success counter + */ + ZDIAGS_MAC_RX_CRC_PASS(0x0064), + + /** + * MAC diagnostic CRC failure counter + */ + ZDIAGS_MAC_RX_CRC_FAIL(0x0065), + + /** + * MAC layer retries a unicast + */ + ZDIAGS_MAC_TX_UCAST_RETRY(0x006A), + + /** + * Mac layer fails to send a unicast + */ + ZDIAGS_MAC_TX_UCAST_FAIL(0x006B), + + /** + * NWK packet decryption failed + */ + ZDIAGS_NWK_DECRYPT_FAILURES(0x00CF), + + /** + * NWK packet drop because of validation error + */ + ZDIAGS_PACKET_VALIDATE_DROP_COUNT(0x00D3), + + /** + * APS layer transmits broadcast + */ + ZDIAGS_APS_TX_BCAST(0x012D), + + /** + * APS layer successfully transmits a unicast + */ + ZDIAGS_APS_TX_UCAST_SUCCESS(0x012F), + + /** + * APS layer retries the sending of a unicast + */ + ZDIAGS_APS_TX_UCAST_RETRY(0x0130), + + /** + * APS layer fails to send a unicast + */ + ZDIAGS_APS_TX_UCAST_FAIL(0x0131), + + /** + * APS packet decryption failed + */ + ZDIAGS_APS_DECRYPT_FAILURES(0x0134), + + /** + * APS invalid packet dropped + */ + ZDIAGS_APS_INVALID_PACKETS(0x0135), + + /** + * Number of MAC retries per APS message + */ + ZDIAGS_MAC_RETRIES_PER_APS_TX_SUCCESS(0x0136); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackDiagnosticAttribute s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackDiagnosticAttribute(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackDiagnosticAttribute valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java new file mode 100644 index 0000000000..6487a20ced --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResetReason. + *

+ * Reasons for reset + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResetReason { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + POWER_UP(0x0000), + + /** + * + */ + EXTERNAL(0x0001), + + /** + * + */ + WATCH_DOG(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResetReason s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResetReason(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResetReason valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java new file mode 100644 index 0000000000..754fb01b8e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResetType. + *

+ * Reset Command Type + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResetType { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + TARGET_DEVICE(0x0000), + + /** + * + */ + SERIAL_BOOTLOADER(0x0001); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResetType s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResetType(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResetType valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java new file mode 100644 index 0000000000..27c76cd145 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. + *

+ * This command is used to set the extended address of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysGetExtAddrSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysGetExtAddrSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x04); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysGetExtAddrSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java new file mode 100644 index 0000000000..ca1482765c --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. + *

+ * This command is used to set the extended address of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysGetExtAddrSrsp extends ZstackFrameResponse { + + /** + * The device’s extended address. + */ + private IeeeAddress extAddress; + + /** + * Response and Handler constructor + */ + public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + extAddress = deserializeIeeeAddress(); + } + + /** + * The device’s extended address. + * + * @return the current extAddress as {@link IeeeAddress} + */ + public IeeeAddress getExtAddress() { + return extAddress; + } + + /** + * The device’s extended address. + * + * @param extAddress the ExtAddress to set as {@link IeeeAddress} + */ + public void setExtAddress(IeeeAddress extAddress) { + this.extAddress = extAddress; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysGetExtAddrSrsp [extAddress="); + builder.append(extAddress); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java new file mode 100644 index 0000000000..1a9fdc51f7 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

+ * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysOsalNvReadSreq extends ZstackFrameRequest { + + /** + * The Id of the NV item. + */ + private ZstackConfigId id; + + /** + * Number of bytes offset from the beginning or the NV value. + */ + private int offset; + + /** + * Request constructor + */ + public ZstackSysOsalNvReadSreq() { + synchronousCommand = true; + } + + /** + * The Id of the NV item. + * + * @return the current id as {@link ZstackConfigId} + */ + public ZstackConfigId getId() { + return id; + } + + /** + * The Id of the NV item. + * + * @param id the id to set as {@link ZstackConfigId} + */ + public void setId(ZstackConfigId id) { + this.id = id; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the Offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x08)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x08); + + // Serialize the fields + serializeUInt8(id.getKey()); + serializeUInt8(offset); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(76); + builder.append("ZstackSysOsalNvReadSreq [id="); + builder.append(id); + builder.append(", offset="); + builder.append(offset); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java new file mode 100644 index 0000000000..bd9a6ad708 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

+ * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysOsalNvReadSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Value of the NV item. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackSysOsalNvReadSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + int len = deserializeUInt8(); + value = deserializeUInt8Array(len); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Value of the NV item. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackSysOsalNvReadSrsp [status="); + builder.append(status); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java new file mode 100644 index 0000000000..f825079c44 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. + *

+ * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data + * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysOsalNvWriteSreq extends ZstackFrameRequest { + + /** + * The Id of the NV item. + */ + private ZstackConfigId id; + + /** + * Number of bytes offset from the beginning or the NV value. + */ + private int offset; + + /** + * Value of the NV item. + */ + private int[] value; + + /** + * Request constructor + */ + public ZstackSysOsalNvWriteSreq() { + synchronousCommand = true; + } + + /** + * The Id of the NV item. + * + * @return the current id as {@link ZstackConfigId} + */ + public ZstackConfigId getId() { + return id; + } + + /** + * The Id of the NV item. + * + * @param id the Id to set as {@link ZstackConfigId} + */ + public void setId(ZstackConfigId id) { + this.id = id; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the Offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + /** + * Value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Value of the NV item. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x09); + + // Serialize the fields + serializeUInt8(id.getKey()); + serializeUInt8(offset); + serializeUInt8(value.length); + serializeUInt8Array(value); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(127); + builder.append("ZstackSysOsalNvWriteSreq [id="); + builder.append(id); + builder.append(", offset="); + builder.append(offset); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java new file mode 100644 index 0000000000..15f481f777 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. + *

+ * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data + * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysOsalNvWriteSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysOsalNvWriteSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(52); + builder.append("ZstackSysOsalNvWriteSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java new file mode 100644 index 0000000000..8f953acd39 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_PING. + *

+ * This command issues PING requests to verify if a device is active and check the capability of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysPingSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysPingSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x01); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysPingSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java new file mode 100644 index 0000000000..81349e4d8e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_PING. + *

+ * This command issues PING requests to verify if a device is active and check the capability of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysPingSrsp extends ZstackFrameResponse { + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + */ + private int capabilities; + + /** + * Response and Handler constructor + */ + public ZstackSysPingSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + capabilities = deserializeUInt16(); + } + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + * + * @return the current capabilities as {@link int} + */ + public int getCapabilities() { + return capabilities; + } + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + * + * @param capabilities the Capabilities to set as {@link int} + */ + public void setCapabilities(int capabilities) { + this.capabilities = capabilities; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(45); + builder.append("ZstackSysPingSrsp [capabilities="); + builder.append(String.format("%04X", capabilities)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java new file mode 100644 index 0000000000..dd5e456a3b --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_RESET_IND. + *

+ * This command is generated by the CC2530 device automatically immediately after a reset. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysResetIndAreq extends ZstackFrameResponse { + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + */ + private ZstackResetReason reason; + + /** + * Transport protocol revision + */ + private int transportRev; + + /** + * Product Id + */ + private int product; + + /** + * Software major release number + */ + private int majorRel; + + /** + * Software minor release number + */ + private int minorRel; + + /** + * Hardware revision number. + */ + private int hwRev; + + /** + * Response and Handler constructor + */ + public ZstackSysResetIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + reason = ZstackResetReason.valueOf(deserializeUInt8()); + transportRev = deserializeUInt8(); + product = deserializeUInt8(); + majorRel = deserializeUInt8(); + minorRel = deserializeUInt8(); + hwRev = deserializeUInt8(); + } + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + * + * @return the current reason as {@link ZstackResetReason} + */ + public ZstackResetReason getReason() { + return reason; + } + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + * + * @param reason the Reason to set as {@link ZstackResetReason} + */ + public void setReason(ZstackResetReason reason) { + this.reason = reason; + } + + /** + * Transport protocol revision + * + * @return the current transportRev as {@link int} + */ + public int getTransportRev() { + return transportRev; + } + + /** + * Transport protocol revision + * + * @param transportRev the TransportRev to set as {@link int} + */ + public void setTransportRev(int transportRev) { + this.transportRev = transportRev; + } + + /** + * Product Id + * + * @return the current product as {@link int} + */ + public int getProduct() { + return product; + } + + /** + * Product Id + * + * @param product the Product to set as {@link int} + */ + public void setProduct(int product) { + this.product = product; + } + + /** + * Software major release number + * + * @return the current majorRel as {@link int} + */ + public int getMajorRel() { + return majorRel; + } + + /** + * Software major release number + * + * @param majorRel the MajorRel to set as {@link int} + */ + public void setMajorRel(int majorRel) { + this.majorRel = majorRel; + } + + /** + * Software minor release number + * + * @return the current minorRel as {@link int} + */ + public int getMinorRel() { + return minorRel; + } + + /** + * Software minor release number + * + * @param minorRel the MinorRel to set as {@link int} + */ + public void setMinorRel(int minorRel) { + this.minorRel = minorRel; + } + + /** + * Hardware revision number. + * + * @return the current hwRev as {@link int} + */ + public int getHwRev() { + return hwRev; + } + + /** + * Hardware revision number. + * + * @param hwRev the HwRev to set as {@link int} + */ + public void setHwRev(int hwRev) { + this.hwRev = hwRev; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(174); + builder.append("ZstackSysResetIndAreq [reason="); + builder.append(reason); + builder.append(", transportRev="); + builder.append(transportRev); + builder.append(", product="); + builder.append(product); + builder.append(", majorRel="); + builder.append(majorRel); + builder.append(", minorRel="); + builder.append(minorRel); + builder.append(", hwRev="); + builder.append(hwRev); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java new file mode 100644 index 0000000000..49a4916f72 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; + +/** + * Class to implement the Z-Stack command SYS_RESET_REQ. + *

+ * This command is issued by the application processor to reset the CC2530 device. The reset is achieved through an internal + * watchdog reset on the CC2530. Note that the hardware reset interface is recommended over using this interface. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysResetReqAcmd extends ZstackFrameRequest { + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + */ + private ZstackResetType type; + + /** + * Request constructor + */ + public ZstackSysResetReqAcmd() { + } + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + * + * @return the current type as {@link ZstackResetType} + */ + public ZstackResetType getType() { + return type; + } + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + * + * @param type the Type to set as {@link ZstackResetType} + */ + public void setType(ZstackResetType type) { + this.type = type; + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_ACMD, ZSTACK_SYS, 0x00); + + // Serialize the fields + serializeUInt8(type.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(49); + builder.append("ZstackSysResetReqAcmd [type="); + builder.append(type); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java new file mode 100644 index 0000000000..466a9a7b73 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. + *

+ * This command is used to set the extended address of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysSetExtAddrSreq extends ZstackFrameRequest { + + /** + * The device’s extended address. + */ + private IeeeAddress extAddress; + + /** + * Request constructor + */ + public ZstackSysSetExtAddrSreq() { + synchronousCommand = true; + } + + /** + * The device’s extended address. + * + * @return the current extAddress as {@link IeeeAddress} + */ + public IeeeAddress getExtAddress() { + return extAddress; + } + + /** + * The device’s extended address. + * + * @param extAddress the ExtAddress to set as {@link IeeeAddress} + */ + public void setExtAddress(IeeeAddress extAddress) { + this.extAddress = extAddress; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x03)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x03); + + // Serialize the fields + serializeIeeeAddress(extAddress); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetExtAddrSreq [extAddress="); + builder.append(extAddress); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java new file mode 100644 index 0000000000..ed1234a277 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. + *

+ * This command is used to set the extended address of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysSetExtAddrSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (1) or Failure (0) + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysSetExtAddrSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (1) or Failure (0) + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (1) or Failure (0) + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetExtAddrSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java new file mode 100644 index 0000000000..0fe0b7f88e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_SET_TX_POWER. + *

+ * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting + * applied to the radio – nearest characterized value for the specific radio. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysSetTxPowerSreq extends ZstackFrameRequest { + + /** + * Requested TX power setting, in dBm. + */ + private int txPower; + + /** + * Request constructor + */ + public ZstackSysSetTxPowerSreq() { + synchronousCommand = true; + } + + /** + * Requested TX power setting, in dBm. + * + * @return the current txPower as {@link int} + */ + public int getTxPower() { + return txPower; + } + + /** + * Requested TX power setting, in dBm. + * + * @param txPower the TxPower to set as {@link int} + */ + public void setTxPower(int txPower) { + this.txPower = txPower; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x14)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x14); + + // Serialize the fields + serializeUInt8(txPower); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetTxPowerSreq [txPower="); + builder.append(txPower); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java new file mode 100644 index 0000000000..e8110bdf77 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_SET_TX_POWER. + *

+ * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting + * applied to the radio – nearest characterized value for the specific radio. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysSetTxPowerSrsp extends ZstackFrameResponse { + + /** + * Requested TX power setting, in dBm. + */ + private int txPower; + + /** + * Response and Handler constructor + */ + public ZstackSysSetTxPowerSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + txPower = deserializeUInt8(); + } + + /** + * Requested TX power setting, in dBm. + * + * @return the current txPower as {@link int} + */ + public int getTxPower() { + return txPower; + } + + /** + * Requested TX power setting, in dBm. + * + * @param txPower the TxPower to set as {@link int} + */ + public void setTxPower(int txPower) { + this.txPower = txPower; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetTxPowerSrsp [txPower="); + builder.append(txPower); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java new file mode 100644 index 0000000000..3b0810af13 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_VERSION. + *

+ * This command issues PING requests to verify if a device is active and check the capability of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysVersionSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysVersionSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x02); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysVersionSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java new file mode 100644 index 0000000000..10c5cc9754 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_VERSION. + *

+ * This command issues PING requests to verify if a device is active and check the capability of the device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysVersionSrsp extends ZstackFrameResponse { + + /** + * Transport protocol revision + */ + private int transportRev; + + /** + * Product Id + */ + private int product; + + /** + * Software major release number + */ + private int majorRel; + + /** + * Software minor release number + */ + private int minorRel; + + /** + * Software maintenance release number + */ + private int maintRel; + + /** + * Response and Handler constructor + */ + public ZstackSysVersionSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + transportRev = deserializeUInt8(); + product = deserializeUInt8(); + majorRel = deserializeUInt8(); + minorRel = deserializeUInt8(); + maintRel = deserializeUInt8(); + } + + /** + * Transport protocol revision + * + * @return the current transportRev as {@link int} + */ + public int getTransportRev() { + return transportRev; + } + + /** + * Transport protocol revision + * + * @param transportRev the TransportRev to set as {@link int} + */ + public void setTransportRev(int transportRev) { + this.transportRev = transportRev; + } + + /** + * Product Id + * + * @return the current product as {@link int} + */ + public int getProduct() { + return product; + } + + /** + * Product Id + * + * @param product the Product to set as {@link int} + */ + public void setProduct(int product) { + this.product = product; + } + + /** + * Software major release number + * + * @return the current majorRel as {@link int} + */ + public int getMajorRel() { + return majorRel; + } + + /** + * Software major release number + * + * @param majorRel the MajorRel to set as {@link int} + */ + public void setMajorRel(int majorRel) { + this.majorRel = majorRel; + } + + /** + * Software minor release number + * + * @return the current minorRel as {@link int} + */ + public int getMinorRel() { + return minorRel; + } + + /** + * Software minor release number + * + * @param minorRel the MinorRel to set as {@link int} + */ + public void setMinorRel(int minorRel) { + this.minorRel = minorRel; + } + + /** + * Software maintenance release number + * + * @return the current maintRel as {@link int} + */ + public int getMaintRel() { + return maintRel; + } + + /** + * Software maintenance release number + * + * @param maintRel the MaintRel to set as {@link int} + */ + public void setMaintRel(int maintRel) { + this.maintRel = maintRel; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(148); + builder.append("ZstackSysVersionSrsp [transportRev="); + builder.append(transportRev); + builder.append(", product="); + builder.append(product); + builder.append(", majorRel="); + builder.append(majorRel); + builder.append(", minorRel="); + builder.append(minorRel); + builder.append(", maintRel="); + builder.append(maintRel); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java new file mode 100644 index 0000000000..be65c74ca1 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. + *

+ * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set + * to TRUE. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsClearStatsSreq extends ZstackFrameRequest { + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + */ + private boolean clearNv; + + /** + * Request constructor + */ + public ZstackSysZdiagsClearStatsSreq() { + synchronousCommand = true; + } + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * + * @return the current clearNv as {@link boolean} + */ + public boolean getClearNV() { + return clearNv; + } + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * + * @param clearNv the clearNV to set as {@link boolean} + */ + public void setClearNV(boolean clearNv) { + this.clearNv = clearNv; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x18)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x18); + + // Serialize the fields + serializeBoolean(clearNv); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackSysZdiagsClearStatsSreq [clearNv="); + builder.append(clearNv); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java new file mode 100644 index 0000000000..b22b95aab4 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. + *

+ * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set + * to TRUE. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsClearStatsSrsp extends ZstackFrameResponse { + + /** + * Milliseconds since last reset. + */ + private int sysClock; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsClearStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + sysClock = deserializeUInt32(); + } + + /** + * Milliseconds since last reset. + * + * @return the current sysClock as {@link int} + */ + public int getSysClock() { + return sysClock; + } + + /** + * Milliseconds since last reset. + * + * @param sysClock the SysClock to set as {@link int} + */ + public void setSysClock(int sysClock) { + this.sysClock = sysClock; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackSysZdiagsClearStatsSrsp [sysClock="); + builder.append(sysClock); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java new file mode 100644 index 0000000000..88b2395641 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. + *

+ * This command is used to read a specific system (attribute) ID statistics and/or metrics value. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsGetStatsSreq extends ZstackFrameRequest { + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + */ + private ZstackDiagnosticAttribute attributeId; + + /** + * Request constructor + */ + public ZstackSysZdiagsGetStatsSreq() { + synchronousCommand = true; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @return the current attributeId as {@link ZstackDiagnosticAttribute} + */ + public ZstackDiagnosticAttribute getAttributeID() { + return attributeId; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} + */ + public void setAttributeID(ZstackDiagnosticAttribute attributeId) { + this.attributeId = attributeId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x19)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x19); + + // Serialize the fields + serializeUInt16(attributeId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackSysZdiagsGetStatsSreq [attributeId="); + builder.append(attributeId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java new file mode 100644 index 0000000000..4fbfc57946 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. + *

+ * This command is used to read a specific system (attribute) ID statistics and/or metrics value. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsGetStatsSrsp extends ZstackFrameResponse { + + /** + * Value of the requested attribute. + */ + private int attributeValue; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsGetStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + attributeValue = deserializeUInt32(); + } + + /** + * Value of the requested attribute. + * + * @return the current attributeValue as {@link int} + */ + public int getAttributeValue() { + return attributeValue; + } + + /** + * Value of the requested attribute. + * + * @param attributeValue the AttributeValue to set as {@link int} + */ + public void setAttributeValue(int attributeValue) { + this.attributeValue = attributeValue; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackSysZdiagsGetStatsSrsp [attributeValue="); + builder.append(attributeValue); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java new file mode 100644 index 0000000000..e75ddd3bce --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. + *

+ * This command is used to initialize the statistics table in NV memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsInitStatsSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysZdiagsInitStatsSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x17)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x17); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysZdiagsInitStatsSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java new file mode 100644 index 0000000000..191d5ec12f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. + *

+ * This command is used to initialize the statistics table in NV memory. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsInitStatsSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsInitStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(56); + builder.append("ZstackSysZdiagsInitStatsSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java new file mode 100644 index 0000000000..03863d237b --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. + *

+ * This command is used to restore the statistics table from NV into the RAM table. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsRestoreStatsNvSreq extends ZstackFrameRequest { + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + */ + private ZstackDiagnosticAttribute attributeId; + + /** + * Request constructor + */ + public ZstackSysZdiagsRestoreStatsNvSreq() { + synchronousCommand = true; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @return the current attributeId as {@link ZstackDiagnosticAttribute} + */ + public ZstackDiagnosticAttribute getAttributeID() { + return attributeId; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} + */ + public void setAttributeID(ZstackDiagnosticAttribute attributeId) { + this.attributeId = attributeId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1A)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1A); + + // Serialize the fields + serializeUInt16(attributeId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackSysZdiagsRestoreStatsNvSreq [attributeId="); + builder.append(attributeId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java new file mode 100644 index 0000000000..413710577f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. + *

+ * This command is used to restore the statistics table from NV into the RAM table. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsRestoreStatsNvSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsRestoreStatsNvSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackSysZdiagsRestoreStatsNvSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java new file mode 100644 index 0000000000..ca8a96c788 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. + *

+ * This command is used to save the statistics table from RAM to NV. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsSaveStatsToNvSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysZdiagsSaveStatsToNvSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1B)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1B); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysZdiagsSaveStatsToNvSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java new file mode 100644 index 0000000000..7279fcede2 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. + *

+ * This command is used to save the statistics table from RAM to NV. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysZdiagsSaveStatsToNvSrsp extends ZstackFrameResponse { + + /** + * Milliseconds since last reset. + */ + private int sysClock; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsSaveStatsToNvSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + sysClock = deserializeUInt32(); + } + + /** + * Milliseconds since last reset. + * + * @return the current sysClock as {@link int} + */ + public int getSysClock() { + return sysClock; + } + + /** + * Milliseconds since last reset. + * + * @param sysClock the SysClock to set as {@link int} + */ + public void setSysClock(int sysClock) { + this.sysClock = sysClock; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(60); + builder.append("ZstackSysZdiagsSaveStatsToNvSrsp [sysClock="); + builder.append(sysClock); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java new file mode 100644 index 0000000000..fdb0c686b1 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackSystemCapabilities. + *

+ * Subsystem capabilities bitmap + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackSystemCapabilities { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + MT_CAP_SYS(0x0001), + + /** + * + */ + MT_CAP_MAC(0x0002), + + /** + * + */ + MT_CAP_NWK(0x0004), + + /** + * + */ + MT_CAP_AF(0x0008), + + /** + * + */ + MT_CAP_ZDO(0x0010), + + /** + * + */ + MT_CAP_SAPI(0x0020), + + /** + * + */ + MT_CAP_UTIL(0x0040), + + /** + * + */ + MT_CAP_DEBUG(0x0080), + + /** + * + */ + MT_CAP_APP(0x0100), + + /** + * + */ + MT_CAP_ZOAD(0x1000); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackSystemCapabilities s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackSystemCapabilities(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackSystemCapabilities valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java new file mode 100644 index 0000000000..0197882bbd --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackZdoState. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackZdoState { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * Initialized - not started automatically + */ + DEV_HOLD(0x0000), + + /** + * Initialized - not connected to anything + */ + DEV_INIT(0x0001), + + /** + * Discovering PAN's to join + */ + DEV_NWK_DISC(0x0002), + + /** + * Joining a PAN + */ + DEV_NWK_JOINING(0x0003), + + /** + * ReJoining a PAN, only for end devices + */ + DEV_NWK_REJOIN(0x0004), + + /** + * Joined but not yet authenticated by trust center + */ + DEV_END_DEVICE_UNAUTH(0x0005), + + /** + * Started as device after authentication + */ + DEV_END_DEVICE(0x0006), + + /** + * Device joined, authenticated and is a router + */ + DEV_ROUTER(0x0007), + + /** + * Starting as Zigbee Coordinator + */ + DEV_COORD_STARTING(0x0008), + + /** + * Started as Zigbee Coordinator + */ + DEV_ZB_COORD(0x0009), + + /** + * Device has lost information about its parent + */ + DEV_NWK_ORPHAN(0x000A); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackZdoState s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackZdoState(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackZdoState valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java new file mode 100644 index 0000000000..94d4221f8d --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. + *

+ * This command retrieves APS link key data, Tx and Rx frame counters. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilApsmeLinkKeyDataGetSreq extends ZstackFrameRequest { + + /** + * The extended address for which to get the link key data. + */ + private IeeeAddress extAddr; + + /** + * Request constructor + */ + public ZstackUtilApsmeLinkKeyDataGetSreq() { + synchronousCommand = true; + } + + /** + * The extended address for which to get the link key data. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * The extended address for which to get the link key data. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x44)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x44); + + // Serialize the fields + serializeIeeeAddress(extAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackUtilApsmeLinkKeyDataGetSreq [extAddr="); + builder.append(extAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java new file mode 100644 index 0000000000..ed226a22e8 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. + *

+ * This command retrieves APS link key data, Tx and Rx frame counters. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilApsmeLinkKeyDataGetSrsp extends ZstackFrameResponse { + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + */ + private ZstackResponseCode status; + + /** + * On success, the security key looked up; otherwise N/A. + */ + private ZigBeeKey secKey; + + /** + * On success, the TX frame counter; otherwise N/A. + */ + private int txFrmCntr; + + /** + * On success, the RX frame counter; otherwise N/A. + */ + private int rxFrmCntr; + + /** + * Response and Handler constructor + */ + public ZstackUtilApsmeLinkKeyDataGetSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + secKey = deserializeZigBeeKey(); + txFrmCntr = deserializeUInt32(); + rxFrmCntr = deserializeUInt32(); + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * On success, the security key looked up; otherwise N/A. + * + * @return the current secKey as {@link ZigBeeKey} + */ + public ZigBeeKey getSecKey() { + return secKey; + } + + /** + * On success, the security key looked up; otherwise N/A. + * + * @param secKey the SecKey to set as {@link ZigBeeKey} + */ + public void setSecKey(ZigBeeKey secKey) { + this.secKey = secKey; + } + + /** + * On success, the TX frame counter; otherwise N/A. + * + * @return the current txFrmCntr as {@link int} + */ + public int getTxFrmCntr() { + return txFrmCntr; + } + + /** + * On success, the TX frame counter; otherwise N/A. + * + * @param txFrmCntr the TxFrmCntr to set as {@link int} + */ + public void setTxFrmCntr(int txFrmCntr) { + this.txFrmCntr = txFrmCntr; + } + + /** + * On success, the RX frame counter; otherwise N/A. + * + * @return the current rxFrmCntr as {@link int} + */ + public int getRxFrmCntr() { + return rxFrmCntr; + } + + /** + * On success, the RX frame counter; otherwise N/A. + * + * @param rxFrmCntr the RxFrmCntr to set as {@link int} + */ + public void setRxFrmCntr(int rxFrmCntr) { + this.rxFrmCntr = rxFrmCntr; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(136); + builder.append("ZstackUtilApsmeLinkKeyDataGetSrsp [status="); + builder.append(status); + builder.append(", secKey="); + builder.append(secKey); + builder.append(", txFrmCntr="); + builder.append(String.format("%08X", txFrmCntr)); + builder.append(", rxFrmCntr="); + builder.append(String.format("%08X", rxFrmCntr)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java new file mode 100644 index 0000000000..b658b16c33 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. + *

+ * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilApsmeLinkKeyNvIdGetSreq extends ZstackFrameRequest { + + /** + * The extended address for which to get the link key NV Id. + */ + private IeeeAddress extAddr; + + /** + * Request constructor + */ + public ZstackUtilApsmeLinkKeyNvIdGetSreq() { + synchronousCommand = true; + } + + /** + * The extended address for which to get the link key NV Id. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * The extended address for which to get the link key NV Id. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x45)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x45); + + // Serialize the fields + serializeIeeeAddress(extAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackUtilApsmeLinkKeyNvIdGetSreq [extAddr="); + builder.append(extAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java new file mode 100644 index 0000000000..bec07011e3 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. + *

+ * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilApsmeLinkKeyNvIdGetSrsp extends ZstackFrameResponse { + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + */ + private ZstackResponseCode status; + + /** + * On success, link key NV ID. Otherwise 0xFFFF + */ + private int linkKeyNvId; + + /** + * Response and Handler constructor + */ + public ZstackUtilApsmeLinkKeyNvIdGetSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + linkKeyNvId = deserializeUInt16(); + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * On success, link key NV ID. Otherwise 0xFFFF + * + * @return the current linkKeyNvId as {@link int} + */ + public int getLinkKeyNvId() { + return linkKeyNvId; + } + + /** + * On success, link key NV ID. Otherwise 0xFFFF + * + * @param linkKeyNvId the LinkKeyNvId to set as {@link int} + */ + public void setLinkKeyNvId(int linkKeyNvId) { + this.linkKeyNvId = linkKeyNvId; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(86); + builder.append("ZstackUtilApsmeLinkKeyNvIdGetSrsp [status="); + builder.append(status); + builder.append(", linkKeyNvId="); + builder.append(linkKeyNvId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java new file mode 100644 index 0000000000..90e2eac0b9 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. + *

+ * This command is used to retrieve the device info. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilGetDeviceInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackUtilGetDeviceInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x00); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackUtilGetDeviceInfoSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java new file mode 100644 index 0000000000..2918e74420 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; + +/** + * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. + *

+ * This command is used to retrieve the device info. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilGetDeviceInfoSrsp extends ZstackFrameResponse { + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + */ + private ZstackResponseCode status; + + /** + * IEEE address of the device. + */ + private IeeeAddress ieeeAddress; + + /** + * Short address of the device. + */ + private int shortAddr; + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + */ + private int deviceType; + + /** + * Indicates the state of the device. + */ + private ZstackZdoState deviceState; + + /** + * Array of 16-bits specifies the network address associated with the device. + */ + private int[] assocDevicesList; + + /** + * Response and Handler constructor + */ + public ZstackUtilGetDeviceInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + ieeeAddress = deserializeIeeeAddress(); + shortAddr = deserializeUInt16(); + deviceType = deserializeUInt8(); + deviceState = ZstackZdoState.valueOf(deserializeUInt8()); + int numAssocDevices = deserializeUInt8(); + assocDevicesList = deserializeUInt16Array(numAssocDevices); + } + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * IEEE address of the device. + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * IEEE address of the device. + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * Short address of the device. + * + * @return the current shortAddr as {@link int} + */ + public int getShortAddr() { + return shortAddr; + } + + /** + * Short address of the device. + * + * @param shortAddr the ShortAddr to set as {@link int} + */ + public void setShortAddr(int shortAddr) { + this.shortAddr = shortAddr; + } + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + * + * @return the current deviceType as {@link int} + */ + public int getDeviceType() { + return deviceType; + } + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + * + * @param deviceType the DeviceType to set as {@link int} + */ + public void setDeviceType(int deviceType) { + this.deviceType = deviceType; + } + + /** + * Indicates the state of the device. + * + * @return the current deviceState as {@link ZstackZdoState} + */ + public ZstackZdoState getDeviceState() { + return deviceState; + } + + /** + * Indicates the state of the device. + * + * @param deviceState the DeviceState to set as {@link ZstackZdoState} + */ + public void setDeviceState(ZstackZdoState deviceState) { + this.deviceState = deviceState; + } + + /** + * Array of 16-bits specifies the network address associated with the device. + * + * @return the current assocDevicesList as {@link int[]} + */ + public int[] getAssocDevicesList() { + return assocDevicesList; + } + + /** + * Array of 16-bits specifies the network address associated with the device. + * + * @param assocDevicesList the AssocDevicesList to set as {@link int[]} + */ + public void setAssocDevicesList(int[] assocDevicesList) { + this.assocDevicesList = assocDevicesList; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(205); + builder.append("ZstackUtilGetDeviceInfoSrsp [status="); + builder.append(status); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", shortAddr="); + builder.append(String.format("%04X", shortAddr)); + builder.append(", deviceType="); + builder.append(deviceType); + builder.append(", deviceState="); + builder.append(deviceState); + builder.append(", assocDevicesList="); + for (int c = 0; c < assocDevicesList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", assocDevicesList[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java new file mode 100644 index 0000000000..492250e6f9 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_GET_NV_INFO. + *

+ * This command is used to read a block of parameters from non-volatile storage of the target device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilGetNvInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackUtilGetNvInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x01); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackUtilGetNvInfoSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java new file mode 100644 index 0000000000..254d467486 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java @@ -0,0 +1,205 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command UTIL_GET_NV_INFO. + *

+ * This command is used to read a block of parameters from non-volatile storage of the target device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilGetNvInfoSrsp extends ZstackFrameResponse { + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + */ + private int status; + + /** + * IEEE address of the device. + */ + private IeeeAddress ieeeAddress; + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + */ + private int scanChannels; + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + */ + private int panId; + + /** + * This specifies the network messaging security level, zero disables security. + */ + private int securityLevel; + + /** + * This specifies the pre-configured security key. + */ + private ZigBeeKey preConfigKey; + + /** + * Response and Handler constructor + */ + public ZstackUtilGetNvInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = deserializeUInt8(); + ieeeAddress = deserializeIeeeAddress(); + scanChannels = deserializeUInt32(); + panId = deserializeUInt16(); + securityLevel = deserializeUInt8(); + preConfigKey = deserializeZigBeeKey(); + } + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + * + * @return the current status as {@link int} + */ + public int getStatus() { + return status; + } + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + * + * @param status the Status to set as {@link int} + */ + public void setStatus(int status) { + this.status = status; + } + + /** + * IEEE address of the device. + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * IEEE address of the device. + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + * + * @return the current panId as {@link int} + */ + public int getPanId() { + return panId; + } + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + * + * @param panId the PanId to set as {@link int} + */ + public void setPanId(int panId) { + this.panId = panId; + } + + /** + * This specifies the network messaging security level, zero disables security. + * + * @return the current securityLevel as {@link int} + */ + public int getSecurityLevel() { + return securityLevel; + } + + /** + * This specifies the network messaging security level, zero disables security. + * + * @param securityLevel the SecurityLevel to set as {@link int} + */ + public void setSecurityLevel(int securityLevel) { + this.securityLevel = securityLevel; + } + + /** + * This specifies the pre-configured security key. + * + * @return the current preConfigKey as {@link ZigBeeKey} + */ + public ZigBeeKey getPreConfigKey() { + return preConfigKey; + } + + /** + * This specifies the pre-configured security key. + * + * @param preConfigKey the PreConfigKey to set as {@link ZigBeeKey} + */ + public void setPreConfigKey(ZigBeeKey preConfigKey) { + this.preConfigKey = preConfigKey; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(176); + builder.append("ZstackUtilGetNvInfoSrsp [status="); + builder.append(status); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", scanChannels="); + builder.append(scanChannels); + builder.append(", panId="); + builder.append(String.format("%04X", panId)); + builder.append(", securityLevel="); + builder.append(securityLevel); + builder.append(", preConfigKey="); + builder.append(preConfigKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java new file mode 100644 index 0000000000..63e5098e4e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_LED_CONTROL. + *

+ * This command is used by the tester to control the LEDs on the board. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilLedControlSreq extends ZstackFrameRequest { + + /** + * The LED number. + */ + private int ledId; + + /** + * 0: OFF, 1: ON. + */ + private boolean mode; + + /** + * Request constructor + */ + public ZstackUtilLedControlSreq() { + synchronousCommand = true; + } + + /** + * The LED number. + * + * @return the current ledId as {@link int} + */ + public int getLedId() { + return ledId; + } + + /** + * The LED number. + * + * @param ledId the LedId to set as {@link int} + */ + public void setLedId(int ledId) { + this.ledId = ledId; + } + + /** + * 0: OFF, 1: ON. + * + * @return the current mode as {@link boolean} + */ + public boolean getMode() { + return mode; + } + + /** + * 0: OFF, 1: ON. + * + * @param mode the Mode to set as {@link boolean} + */ + public void setMode(boolean mode) { + this.mode = mode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x09); + + // Serialize the fields + serializeUInt8(ledId); + serializeBoolean(mode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(77); + builder.append("ZstackUtilLedControlSreq [ledId="); + builder.append(ledId); + builder.append(", mode="); + builder.append(mode); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java new file mode 100644 index 0000000000..8145e54c29 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_LED_CONTROL. + *

+ * This command is used by the tester to control the LEDs on the board. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilLedControlSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilLedControlSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(52); + builder.append("ZstackUtilLedControlSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java new file mode 100644 index 0000000000..e328816599 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_SET_CHANNELS. + *

+ * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetChannelsSreq extends ZstackFrameRequest { + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + */ + private int channels; + + /** + * Request constructor + */ + public ZstackUtilSetChannelsSreq() { + synchronousCommand = true; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @return the current channels as {@link int} + */ + public int getChannels() { + return channels; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @param channels the Channels to set as {@link int} + */ + public void setChannels(int channels) { + this.channels = channels; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x03)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x03); + + // Serialize the fields + serializeUInt32(channels); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetChannelsSreq [channels="); + builder.append(channels); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java new file mode 100644 index 0000000000..33d70b93e6 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_SET_CHANNELS. + *

+ * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetChannelsSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetChannelsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetChannelsSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java new file mode 100644 index 0000000000..8859b64be4 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_SET_PANID. + *

+ * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetPanidSreq extends ZstackFrameRequest { + + /** + * PanId that will be set. + */ + private int panId; + + /** + * Request constructor + */ + public ZstackUtilSetPanidSreq() { + synchronousCommand = true; + } + + /** + * PanId that will be set. + * + * @return the current panId as {@link int} + */ + public int getPanId() { + return panId; + } + + /** + * PanId that will be set. + * + * @param panId the PanId to set as {@link int} + */ + public void setPanId(int panId) { + this.panId = panId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x02); + + // Serialize the fields + serializeUInt16(panId); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(50); + builder.append("ZstackUtilSetPanidSreq [panId="); + builder.append(String.format("%04X", panId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java new file mode 100644 index 0000000000..3d96344bcf --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_SET_PANID. + *

+ * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetPanidSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetPanidSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(50); + builder.append("ZstackUtilSetPanidSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java new file mode 100644 index 0000000000..aa7e1b9446 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. + *

+ * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetPrecfgkeySreq extends ZstackFrameRequest { + + /** + * An array representing the pre-configured key to use the next time the target device resets. + */ + private ZigBeeKey preCfgKey; + + /** + * Request constructor + */ + public ZstackUtilSetPrecfgkeySreq() { + synchronousCommand = true; + } + + /** + * An array representing the pre-configured key to use the next time the target device resets. + * + * @return the current preCfgKey as {@link ZigBeeKey} + */ + public ZigBeeKey getPreCfgKey() { + return preCfgKey; + } + + /** + * An array representing the pre-configured key to use the next time the target device resets. + * + * @param preCfgKey the PreCfgKey to set as {@link ZigBeeKey} + */ + public void setPreCfgKey(ZigBeeKey preCfgKey) { + this.preCfgKey = preCfgKey; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x05)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x05); + + // Serialize the fields + serializeZigBeeKey(preCfgKey); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackUtilSetPrecfgkeySreq [preCfgKey="); + builder.append(preCfgKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java new file mode 100644 index 0000000000..1ae29d2201 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. + *

+ * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetPrecfgkeySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetPrecfgkeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackUtilSetPrecfgkeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java new file mode 100644 index 0000000000..d4826d6fa5 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. + *

+ * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetSeclevelSreq extends ZstackFrameRequest { + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + */ + private int secLevel; + + /** + * Request constructor + */ + public ZstackUtilSetSeclevelSreq() { + synchronousCommand = true; + } + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + * + * @return the current secLevel as {@link int} + */ + public int getSecLevel() { + return secLevel; + } + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + * + * @param secLevel the SecLevel to set as {@link int} + */ + public void setSecLevel(int secLevel) { + this.secLevel = secLevel; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x04); + + // Serialize the fields + serializeUInt8(secLevel); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetSeclevelSreq [secLevel="); + builder.append(secLevel); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java new file mode 100644 index 0000000000..aa8e827678 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. + *

+ * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackUtilSetSeclevelSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetSeclevelSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetSeclevelSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java new file mode 100644 index 0000000000..8058a1fadf --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

+ * This command retrieves the application link key of a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoGetLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Request constructor + */ + public ZstackZdoGetLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x25)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x25); + + // Serialize the fields + serializeIeeeAddress(ieeeAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackZdoGetLinkKeySreq [ieeeAddr="); + builder.append(ieeeAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java new file mode 100644 index 0000000000..9336f9720c --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

+ * This command retrieves the application link key of a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoGetLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0xC8 – Unknown device. + */ + private ZstackResponseCode status; + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Link key data of the device + */ + private ZigBeeKey linkKeyData; + + /** + * Response and Handler constructor + */ + public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + ieeeAddr = deserializeIeeeAddress(); + linkKeyData = deserializeZigBeeKey(); + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + /** + * Link key data of the device + * + * @return the current linkKeyData as {@link ZigBeeKey} + */ + public ZigBeeKey getLinkKeyData() { + return linkKeyData; + } + + /** + * Link key data of the device + * + * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} + */ + public void setLinkKeyData(ZigBeeKey linkKeyData) { + this.linkKeyData = linkKeyData; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackZdoGetLinkKeySrsp [status="); + builder.append(status); + builder.append(", ieeeAddr="); + builder.append(ieeeAddr); + builder.append(", linkKeyData="); + builder.append(linkKeyData); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java new file mode 100644 index 0000000000..c2ff3c50b1 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command ZDO_LEAVE_IND. + *

+ * This message is an indication to inform the host of a device leaving the network. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoLeaveIndAreq extends ZstackFrameResponse { + + /** + * Short address (LSB-MSB) of the source of the leave indication. + */ + private int srcAddr; + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + */ + private IeeeAddress extAddr; + + /** + * Boolean, TRUE = request, FALSE = indication. + */ + private boolean request; + + /** + * Boolean, TRUE = remove children. + */ + private boolean remove; + + /** + * Boolean, TRUE = rejoin. + */ + private boolean rejoin; + + /** + * Response and Handler constructor + */ + public ZstackZdoLeaveIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializeUInt16(); + extAddr = deserializeIeeeAddress(); + request = deserializeBoolean(); + remove = deserializeBoolean(); + rejoin = deserializeBoolean(); + } + + /** + * Short address (LSB-MSB) of the source of the leave indication. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Short address (LSB-MSB) of the source of the leave indication. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + /** + * Boolean, TRUE = request, FALSE = indication. + * + * @return the current request as {@link boolean} + */ + public boolean getRequest() { + return request; + } + + /** + * Boolean, TRUE = request, FALSE = indication. + * + * @param request the Request to set as {@link boolean} + */ + public void setRequest(boolean request) { + this.request = request; + } + + /** + * Boolean, TRUE = remove children. + * + * @return the current remove as {@link boolean} + */ + public boolean getRemove() { + return remove; + } + + /** + * Boolean, TRUE = remove children. + * + * @param remove the Remove to set as {@link boolean} + */ + public void setRemove(boolean remove) { + this.remove = remove; + } + + /** + * Boolean, TRUE = rejoin. + * + * @return the current rejoin as {@link boolean} + */ + public boolean getRejoin() { + return rejoin; + } + + /** + * Boolean, TRUE = rejoin. + * + * @param rejoin the Rejoin to set as {@link boolean} + */ + public void setRejoin(boolean rejoin) { + this.rejoin = rejoin; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(149); + builder.append("ZstackZdoLeaveIndAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", extAddr="); + builder.append(extAddr); + builder.append(", request="); + builder.append(request); + builder.append(", remove="); + builder.append(remove); + builder.append(", rejoin="); + builder.append(rejoin); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java new file mode 100644 index 0000000000..aadbab059e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_INCOMING. + *

+ * This message is a ZDO callback for a Cluster Id that the host requested to receive with a ZDO_ MSG_CB_REGISTER request. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoMsgCbIncomingAreq extends ZstackFrameResponse { + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + */ + private int srcAddr; + + /** + * This field indicates whether or not this ZDO message was broadcast. + */ + private boolean wasBroadcast; + + /** + * The ZDO Cluster Id of this message. + */ + private int clusterId; + + /** + * N/A – not used. + */ + private boolean securityUse; + + /** + * The sequence number of this ZDO message. + */ + private int seqNumber; + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + */ + private int dstAddr; + + /** + * The data that corresponds to the Cluster Id of the message + */ + private int[] data; + + /** + * Response and Handler constructor + */ + public ZstackZdoMsgCbIncomingAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializeUInt16(); + wasBroadcast = deserializeBoolean(); + clusterId = deserializeUInt16(); + securityUse = deserializeBoolean(); + seqNumber = deserializeUInt8(); + dstAddr = deserializeUInt16(); + data = deserializeUInt8Array(); + } + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * This field indicates whether or not this ZDO message was broadcast. + * + * @return the current wasBroadcast as {@link boolean} + */ + public boolean getWasBroadcast() { + return wasBroadcast; + } + + /** + * This field indicates whether or not this ZDO message was broadcast. + * + * @param wasBroadcast the WasBroadcast to set as {@link boolean} + */ + public void setWasBroadcast(boolean wasBroadcast) { + this.wasBroadcast = wasBroadcast; + } + + /** + * The ZDO Cluster Id of this message. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * The ZDO Cluster Id of this message. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + /** + * N/A – not used. + * + * @return the current securityUse as {@link boolean} + */ + public boolean getSecurityUse() { + return securityUse; + } + + /** + * N/A – not used. + * + * @param securityUse the SecurityUse to set as {@link boolean} + */ + public void setSecurityUse(boolean securityUse) { + this.securityUse = securityUse; + } + + /** + * The sequence number of this ZDO message. + * + * @return the current seqNumber as {@link int} + */ + public int getSeqNumber() { + return seqNumber; + } + + /** + * The sequence number of this ZDO message. + * + * @param seqNumber the SeqNumber to set as {@link int} + */ + public void setSeqNumber(int seqNumber) { + this.seqNumber = seqNumber; + } + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + * + * @return the current dstAddr as {@link int} + */ + public int getDstAddr() { + return dstAddr; + } + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + * + * @param dstAddr the DstAddr to set as {@link int} + */ + public void setDstAddr(int dstAddr) { + this.dstAddr = dstAddr; + } + + /** + * The data that corresponds to the Cluster Id of the message + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * The data that corresponds to the Cluster Id of the message + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(204); + builder.append("ZstackZdoMsgCbIncomingAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", wasBroadcast="); + builder.append(wasBroadcast); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", securityUse="); + builder.append(securityUse); + builder.append(", seqNumber="); + builder.append(String.format("%02X", seqNumber)); + builder.append(", dstAddr="); + builder.append(String.format("%04X", dstAddr)); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java new file mode 100644 index 0000000000..28b2608cd6 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. + *

+ * This command registers for a ZDO callback. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoMsgCbRegisterSreq extends ZstackFrameRequest { + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + */ + private int clusterId; + + /** + * Request constructor + */ + public ZstackZdoMsgCbRegisterSreq() { + synchronousCommand = true; + } + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x3E)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x3E); + + // Serialize the fields + serializeUInt16(clusterId); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoMsgCbRegisterSreq [clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java new file mode 100644 index 0000000000..e61d04b17a --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. + *

+ * This command registers for a ZDO callback. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoMsgCbRegisterSrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * 0x00 – Success. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoMsgCbRegisterSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java new file mode 100644 index 0000000000..cd7d432007 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. + *

+ * This command is used to initiate a network discovery (active scan). + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoNwkDiscoveryReqSreq extends ZstackFrameRequest { + + /** + * Bit mask for channels to scan. + */ + private int scanChannels; + + /** + * A value used to calculate the length of time to spend scanning each channel + */ + private int scanDuration; + + /** + * Request constructor + */ + public ZstackZdoNwkDiscoveryReqSreq() { + synchronousCommand = true; + } + + /** + * Bit mask for channels to scan. + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * Bit mask for channels to scan. + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * A value used to calculate the length of time to spend scanning each channel + * + * @return the current scanDuration as {@link int} + */ + public int getScanDuration() { + return scanDuration; + } + + /** + * A value used to calculate the length of time to spend scanning each channel + * + * @param scanDuration the ScanDuration to set as {@link int} + */ + public void setScanDuration(int scanDuration) { + this.scanDuration = scanDuration; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x26)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x26); + + // Serialize the fields + serializeUInt32(scanChannels); + serializeUInt8(scanDuration); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(81); + builder.append("ZstackZdoNwkDiscoveryReqSreq [scanChannels="); + builder.append(scanChannels); + builder.append(", scanDuration="); + builder.append(scanDuration); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java new file mode 100644 index 0000000000..65bc22b997 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. + *

+ * This command is used to initiate a network discovery (active scan). + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoNwkDiscoveryReqSrsp extends ZstackFrameResponse { + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoNwkDiscoveryReqSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(56); + builder.append("ZstackZdoNwkDiscoveryReqSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java new file mode 100644 index 0000000000..449e4482db --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. + *

+ * This command removes the application link key of a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoRemoveLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Request constructor + */ + public ZstackZdoRemoveLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x24)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x24); + + // Serialize the fields + serializeIeeeAddress(ieeeAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoRemoveLinkKeySreq [ieeeAddr="); + builder.append(ieeeAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java new file mode 100644 index 0000000000..2fd7176b79 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. + *

+ * This command removes the application link key of a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoRemoveLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0xC8 – Unknown device. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoRemoveLinkKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java new file mode 100644 index 0000000000..ddf377dac0 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. + *

+ * This command sets the application link key for a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoSetLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the short address of the pair device of the link key. + */ + private int shortAddr; + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * 128 bit link key data of the device. + */ + private ZigBeeKey linkKeyData; + + /** + * Request constructor + */ + public ZstackZdoSetLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the short address of the pair device of the link key. + * + * @return the current shortAddr as {@link int} + */ + public int getShortAddr() { + return shortAddr; + } + + /** + * Specifies the short address of the pair device of the link key. + * + * @param shortAddr the ShortAddr to set as {@link int} + */ + public void setShortAddr(int shortAddr) { + this.shortAddr = shortAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + /** + * 128 bit link key data of the device. + * + * @return the current linkKeyData as {@link ZigBeeKey} + */ + public ZigBeeKey getLinkKeyData() { + return linkKeyData; + } + + /** + * 128 bit link key data of the device. + * + * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} + */ + public void setLinkKeyData(ZigBeeKey linkKeyData) { + this.linkKeyData = linkKeyData; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x23)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x23); + + // Serialize the fields + serializeUInt16(shortAddr); + serializeIeeeAddress(ieeeAddr); + serializeZigBeeKey(linkKeyData); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackZdoSetLinkKeySreq [shortAddr="); + builder.append(String.format("%04X", shortAddr)); + builder.append(", ieeeAddr="); + builder.append(ieeeAddr); + builder.append(", linkKeyData="); + builder.append(linkKeyData); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java new file mode 100644 index 0000000000..1a0b36bb2b --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. + *

+ * This command sets the application link key for a given device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoSetLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackZdoSetLinkKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java new file mode 100644 index 0000000000..2e4d089337 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. + *

+ * This command starts the device in the network. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoStartupFromAppSreq extends ZstackFrameRequest { + + /** + * Specifies the time delay before the device starts in milliseconds. + */ + private int startDelay; + + /** + * Request constructor + */ + public ZstackZdoStartupFromAppSreq() { + synchronousCommand = true; + } + + /** + * Specifies the time delay before the device starts in milliseconds. + * + * @return the current startDelay as {@link int} + */ + public int getStartDelay() { + return startDelay; + } + + /** + * Specifies the time delay before the device starts in milliseconds. + * + * @param startDelay the StartDelay to set as {@link int} + */ + public void setStartDelay(int startDelay) { + this.startDelay = startDelay; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x40)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x40); + + // Serialize the fields + serializeUInt16(startDelay); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStartupFromAppSreq [startDelay="); + builder.append(startDelay); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java new file mode 100644 index 0000000000..d04c6c219e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. + *

+ * This command starts the device in the network. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoStartupFromAppSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoStartupFromAppSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializeUInt8()); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStartupFromAppSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java new file mode 100644 index 0000000000..10aef95203 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; + +/** + * Class to implement the Z-Stack command ZDO_STATE_CHANGE_IND. + *

+ * This callback message indicates the ZDO state change. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoStateChangeIndAreq extends ZstackFrameResponse { + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + */ + private ZstackZdoState state; + + /** + * Response and Handler constructor + */ + public ZstackZdoStateChangeIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + state = ZstackZdoState.valueOf(deserializeUInt8()); + } + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + * + * @return the current state as {@link ZstackZdoState} + */ + public ZstackZdoState getState() { + return state; + } + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + * + * @param state the State to set as {@link ZstackZdoState} + */ + public void setState(ZstackZdoState state) { + this.state = state; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStateChangeIndAreq [state="); + builder.append(state); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java new file mode 100644 index 0000000000..d50c592760 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command ZDO_TC_DEV_IND. + *

+ * This message is a ZDO callback for TC Device Indication. This is an indication that the TC has delivered the key to a recently + * joined device. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoTcDevIndAreq extends ZstackFrameResponse { + + /** + * Source network Address + */ + private int srcAddr; + + /** + * IEEE Address of the source + */ + private IeeeAddress extAddr; + + /** + * Network address of the parent + */ + private int parentAddr; + + /** + * Response and Handler constructor + */ + public ZstackZdoTcDevIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializeUInt16(); + extAddr = deserializeIeeeAddress(); + parentAddr = deserializeUInt16(); + } + + /** + * Source network Address + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Source network Address + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * IEEE Address of the source + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * IEEE Address of the source + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + /** + * Network address of the parent + * + * @return the current parentAddr as {@link int} + */ + public int getParentAddr() { + return parentAddr; + } + + /** + * Network address of the parent + * + * @param parentAddr the ParentAddr to set as {@link int} + */ + public void setParentAddr(int parentAddr) { + this.parentAddr = parentAddr; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(99); + builder.append("ZstackZdoTcDevIndAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", extAddr="); + builder.append(extAddr); + builder.append(", parentAddr="); + builder.append(String.format("%04X", parentAddr)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java new file mode 100644 index 0000000000..413953b129 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; + +/** + * Interface to exchange asynchronous packets and link state changes from the low level protocol handlers + * to the dongle layer. + * + * @author Chris Jackson + * + */ +public interface ZstackFrameHandler { + /** + * Passes received asynchronous frames from the ZStack protocol handler to the dongle layer + * + * @param response incoming {@link ZstackCommand} response frame + */ + public void handlePacket(ZstackCommand response); + + /** + * Called when the ZStack handler link state changes + * + * @param state true if the link is UP, false if the link is DOWN + */ + public void handleLinkStateChange(boolean state); +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java new file mode 100644 index 0000000000..2c7ee7927e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -0,0 +1,272 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.zsmartsystems.zigbee.ZigBeeStatus; +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; +import com.zsmartsystems.zigbee.transport.DeviceType; + +/** + * This class provides utility functions to establish a ZStack ZigBee network + * + * @author Chris Jackson + * + */ +public class ZstackNetworkInitialisation { + /** + * The {@link Logger}. + */ + private final Logger logger = LoggerFactory.getLogger(ZstackNetworkInitialisation.class); + + /** + * Number of milliseconds to wait for the bootloader to exit + */ + public static final int BOOTLOAD_TIMEOUT = 3000; + + /** + * Number of milliseconds to wait for the NCP to come online + */ + public static final int ONLINE_TIMEOUT = 5000; + + /** + * The default magic number used to make the dongle exit the bootloader + */ + public static final int MAGIC_NUMBER_DEFAULT = 0xEF; + + /** + * The frame handler used to send the ZStack frames to the NCP + */ + private ZstackProtocolHandler protocolHandler; + + /** + * The magic number used to make the dongle exit the bootloader + */ + private int magicNumber = MAGIC_NUMBER_DEFAULT; + + /** + * @param protocolHandler the {@link ZstackProtocolHandler} used to communicate with the NCP + */ + public ZstackNetworkInitialisation(ZstackProtocolHandler protocolHandler) { + this.protocolHandler = protocolHandler; + } + + /** + * Different hardware may use a different "Magic Number" to skip waiting in the bootloader. Otherwise + * the dongle may wait in the bootloader for 60 seconds after it's powered on or reset. + *

+ * This method allows the user to change the magic number which may be required when using different + * sticks. + * + * @param magicNumber + */ + public void setMagicNumber(int magicNumber) { + this.magicNumber = magicNumber; + } + + /** + * This method performs the initial initialisation of the dongle application firmware. This simply starts the + * dongle, ensuring that it enters the application (ie exiting the bootloader) and sets the configuration to use the + * defaults. From here we have a known configuration on which to start our session. + *

+ * The dongle is not reset completely, thus allowing it to be placed back into the previous network. + */ + public ZigBeeStatus initializeNcp() { + logger.debug("ZStack Initialisation: Initialise"); + ZstackNcp ncp = new ZstackNcp(protocolHandler); + + ZstackSysResetIndAreq resetResponse = ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + logger.debug("ZStack Initialisation: Reset response {}", resetResponse); + + if (resetResponse == null) { + // The reset failed - assume we're in the bootloader and try and exit + if (exitBootloader() == false) { + logger.debug("ZStack Initialisation: Failed to exit bootloader"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + } + + return resetNcp(ncp, false); + } + + /** + * Form a new network as the coordinator. + *

+ * This assumes that the network configuration parameters have been set prior to calling + * + * @return {@link ZigBeeStatus} defining the result + */ + public ZigBeeStatus formNetwork() { + logger.debug("ZStack forming new network"); + ZstackNcp ncp = new ZstackNcp(protocolHandler); + + if (ncp.setDeviceType(DeviceType.COORDINATOR) != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack forming network: Error setting NCP to coordinator"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + // Reset the NCP so that this take effect, and also scrub the network information + resetNcp(ncp, true); + + return ZigBeeStatus.SUCCESS; + } + + /** + * Join an existing network as a Router + *

+ * This assumes that the network configuration parameters have been set prior to calling + * + * @return {@link ZigBeeStatus} defining the result + */ + public ZigBeeStatus joinNetwork() { + logger.debug("ZStack joining new network"); + ZstackNcp ncp = new ZstackNcp(protocolHandler); + + if (ncp.setDeviceType(DeviceType.ROUTER) != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack forming network: Error setting NCP to router"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + // Reset the NCP so that this take effect, and also scrub the network information + resetNcp(ncp, true); + + return ZigBeeStatus.SUCCESS; + } + + /** + * Starts the NCP application, placing it on the network as previously configured. + * + * @return {@link ZigBeeStatus} defining the result + */ + public ZigBeeStatus startNetwork() { + logger.debug("ZStack starting network"); + ZstackNcp ncp = new ZstackNcp(protocolHandler); + + ncp.setNetworkSecurity(true); + + // ZCD_NV_SECURITY_LEVEL + + ncp.zdoRegisterCallback(0x8001);// IeeeAddressResponse() { + ncp.zdoRegisterCallback(0x8002);// NodeDescriptorResponse.); + ncp.zdoRegisterCallback(0x8003);// PowerDescriptorResponse + + // Now start the NCP + if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + return ZigBeeStatus.SUCCESS; + } + + /** + * Attempts to exit the bootloader by sending the "magic number" and waiting for the {@link ZstackSysResetIndAreq} + * to be received to confirm that the NCP application firmware has started. + * + * @return true if the {@link ZstackSysResetIndAreq} was received, otherwise false + */ + private boolean exitBootloader() { + Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); + protocolHandler.sendRaw(magicNumber); + + try { + ZstackFrameResponse response = waiter.get(BOOTLOAD_TIMEOUT, TimeUnit.MILLISECONDS); + logger.debug("ZStack Initialisation: Bootloader reset response {}", response); + + return true; + } catch (InterruptedException | ExecutionException | TimeoutException e) { + logger.debug("ZStack Initialisation: Bootloader reset failed"); + + return false; + } + } + + /** + * Resets the NCP and optionally clears the existing network information. + * + * @param ncp the {@link ZstackNcp} + * @param initialise true to remove all current network information + * @return a {@link ZigBeeStatus} defining the success of reason for failure + */ + private ZigBeeStatus resetNcp(ZstackNcp ncp, boolean initialise) { + // Ensure the start options are set to reset the configuration to defaults so we start in a known config + if (ncp.setStartupOptions(true, initialise) != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack Initialisation: Failed to set startup options"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + // Perform another reset so that the startup options take effect + ZstackSysResetIndAreq resetResponse = ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + logger.debug("ZStack Initialisation: Reset response {}", resetResponse); + + // Clear the clearState option so the next restart doesn't clear the network information + if (initialise) { + if (ncp.setStartupOptions(true, initialise) != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack Initialisation: Failed to set startup options"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + } + + return ZigBeeStatus.SUCCESS; + } + + /** + * Waits for the NCP to come online. + * + * @param ncp the {@link ZstackNcp} + * @return true if the NCP is online, false if the method times out while waiting + */ + public boolean waitForNcpOnline(ZstackNcp ncp) { + long waitTime = System.currentTimeMillis() + ONLINE_TIMEOUT; + while (waitTime > System.currentTimeMillis()) { + logger.debug("ZStack dongle waiting for NCP to come online"); + Future stateChangeFuture = protocolHandler + .waitForEvent(ZstackZdoStateChangeIndAreq.class); + try { + ZstackZdoStateChangeIndAreq stateChange = (ZstackZdoStateChangeIndAreq) stateChangeFuture.get(500, + TimeUnit.MILLISECONDS); + if (isStackOnline(stateChange.getState())) { + return true; + } + } catch (InterruptedException | ExecutionException | TimeoutException e) { + // Eat this exception + } + } + + // It's possible to get here with the NCP being online if we miss the event while we weren't listening + // Do one last check + ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); + return isStackOnline(deviceInfo.getDeviceState()); + } + + private boolean isStackOnline(ZstackZdoState state) { + switch (state) { + case DEV_NWK_ORPHAN: + case DEV_ROUTER: + case DEV_ZB_COORD: + case DEV_END_DEVICE: + // NCP is now on the network + return true; + default: + return false; + } + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java new file mode 100644 index 0000000000..12ba58ace0 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -0,0 +1,539 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameFactory; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; +import com.zsmartsystems.zigbee.transport.ZigBeePort; + +/** + * Class for the ZStack protocol handler. The protocol handler manages the low level data transfer of ZStack frames. + * + * @author Chris Jackson + * + */ +public class ZstackProtocolHandler { + private static int ZSTACK_MIN_LENGTH = 3; + private static int ZSTACK_MAX_LENGTH = 100; + + /** + * Time to wait for a SRSP response to an SREQ before moving on + */ + private static int TIMEOUT = 3500; + + private static int ZSTACK_SOF = 0xFE; + + private enum ZstackState { + SOF, + LENGTH, + DATA, + FCS + } + + /** + * Flag to note if we are waiting for a SRSP to ensure that only one synchronous request is outstanding at any time + */ + private AtomicBoolean waitingSrsp = new AtomicBoolean(); + + /** + * The logger. + */ + private final Logger logger = LoggerFactory.getLogger(ZstackProtocolHandler.class); + + /** + * The packet handler. + */ + private final ZstackFrameHandler frameHandler; + + /** + * The port. + */ + private ZigBeePort port; + + /** + * The parser parserThread. + */ + private Thread parserThread = null; + + /** + * Flag reflecting that parser has been closed and parser parserThread should exit. + */ + private boolean closeHandler = false; + + /** + * The queue of {@link ZstackFrameRequest} frames waiting to be sent + */ + private final Queue sendQueue = new ConcurrentLinkedQueue<>(); + + private ExecutorService executor = Executors.newCachedThreadPool(); + private final List transactionListeners = new ArrayList<>(); + + /** + * Construct the handler and provides the {@link ZstackFrameHandler} + * + * @param frameHandler the {@link ZstackFrameHandler} to receive incoming frames + */ + public ZstackProtocolHandler(final ZstackFrameHandler frameHandler) { + this.frameHandler = frameHandler; + } + + /** + * Starts the handler. Sets input stream where the packet is read from the and + * handler which further processes the received packet. + * + * @param port the {@link ZigBeePort} + */ + public void start(final ZigBeePort port) { + this.port = port; + + parserThread = new Thread("ZstackFrameHandler") { + @Override + public void run() { + logger.debug("ZstackFrameHandler thread started"); + + int exceptionCnt = 0; + + while (!closeHandler) { + try { + final int[] frameData = getPacket(); + logger.debug("ZSTACK RX: FrameData [ data={}]", frameToString(frameData)); + + if (waitingSrsp.compareAndSet(isSynchronous(frameData[0]), false)) { + logger.debug("ZSTACK synchronous frame received. waitingSrsp={}, isSynchronous={}", + waitingSrsp, isSynchronous(frameData[0])); + } + + ZstackFrameResponse response = ZstackFrameFactory.createFrame(frameData); + if (response == null) { + logger.debug("ZSTACK RX: ZstackUnknownFrame [ data={}]", frameToString(frameData)); + continue; + } else { + logger.debug("ZSTACK RX: {}", response); + } + + // Send this into the stack + frameHandler.handlePacket(response); + + // Also handle any ZStack level transactions (SREQ transactions or waiting events) + notifyResponseReceived(response); + + sendNextFrame(); + } catch (final IOException e) { + logger.error("ZstackFrameHandler IOException: ", e); + + if (exceptionCnt++ > 10) { + logger.error("ZstackFrameHandler exception count exceeded"); + closeHandler = true; + } + } catch (final Exception e) { + logger.error("ZstackFrameHandler Exception: ", e); + } + } + logger.debug("ZstackFrameHandler exited."); + } + }; + + parserThread.setDaemon(true); + parserThread.start(); + } + + public int[] getPacket() throws IOException { + int length = 0; + int bytesRead = 0; + int[] frameData = null; + + ZstackState state = ZstackState.SOF; + + while (!closeHandler) { + int val = port.read(); + logger.trace("ZSTACK RX Byte: {} [{}/{}]", String.format("%02X", val), bytesRead, length); + if (val == -1) { + continue; + } + + switch (state) { + case SOF: + if (val == ZSTACK_SOF) { + state = ZstackState.LENGTH; + } + break; + case LENGTH: + if (val > ZSTACK_MAX_LENGTH) { + logger.debug("ZSTACK Length greater than allowed: {}", val); + state = ZstackState.SOF; + continue; + } + length = val + 2; + frameData = new int[length]; + state = ZstackState.DATA; + bytesRead = 0; + break; + case DATA: + frameData[bytesRead++] = val; + if (bytesRead >= length) { + state = ZstackState.FCS; + } + break; + case FCS: + int checksum = getChecksum(frameData); + if (val != checksum) { + logger.debug("ZSTACK Checksum error: {} <> {}", val, checksum); + state = ZstackState.SOF; + continue; + } + return frameData; + default: + logger.debug("ZSTACK Unknown decoder state: {}", state); + break; + } + } + + return null; + } + + private int getChecksum(int[] data) { + int checksum = (data.length - 2); + for (int value : data) { + checksum ^= value; + } + return checksum & 0xFF; + } + + /** + * Checks the frame type to see if it is a synchronous request or response. + * + * @param cmd0 the first command byte of the request or response frame + * @return true if this is a synchronous frame + */ + private boolean isSynchronous(int cmd0) { + int frameType = cmd0 & 0xE0; + return (frameType == 0x20 || frameType == 0x60); + } + + public void setClosing() { + executor.shutdown(); + closeHandler = true; + } + + public void close() { + logger.debug("ZstackFrameHandler close."); + setClosing(); + + clearTransactionQueue(); + + sendQueue.clear(); + + frameHandler.handleLinkStateChange(false); + + executor.shutdownNow(); + + try { + parserThread.interrupt(); + parserThread.join(); + logger.debug("ZstackFrameHandler close complete."); + } catch (InterruptedException e) { + logger.debug("ZstackFrameHandler interrupted in packet parser thread shutdown join."); + } + } + + public boolean isAlive() { + return parserThread != null && parserThread.isAlive(); + } + + /** + * Add a ZStack frame to the send queue. The sendQueue is a FIFO queue. + * This method queues a {@link ZstackFrameRequest} frame without waiting for a response and + * no transaction management is performed. + * + * @param request {@link ZstackFrameRequest} + */ + public void queueFrame(ZstackFrameRequest request) { + if (closeHandler) { + logger.debug("ZSTACK: Handler is closed"); + return; + } + sendQueue.add(request); + + logger.debug("ZSTACK TX Queue length={}, waitingSync={}", sendQueue.size(), waitingSrsp); + + sendNextFrame(); + } + + /** + * Notify any transaction listeners when we receive a response. + * + * @param response the response {@link ZstackFrameResponse} received + * @return true if the response was processed + */ + private boolean notifyResponseReceived(final ZstackFrameResponse response) { + boolean processed = false; + + synchronized (transactionListeners) { + for (ZstackListener listener : transactionListeners) { + if (listener.transactionEvent(response)) { + processed = true; + } + } + } + + return processed; + } + + private void addTransactionListener(ZstackListener listener) { + synchronized (transactionListeners) { + if (transactionListeners.contains(listener)) { + return; + } + + transactionListeners.add(listener); + } + } + + private void removeTransactionListener(ZstackListener listener) { + synchronized (transactionListeners) { + transactionListeners.remove(listener); + } + } + + /** + * Aborts all waiting transactions + */ + private void clearTransactionQueue() { + synchronized (transactionListeners) { + for (ZstackListener listener : transactionListeners) { + listener.transactionComplete(); + } + } + } + + private synchronized boolean sendNextFrame() { + if (sendQueue.isEmpty()) { + return false; + } + + if (waitingSrsp.get() && sendQueue.peek().isSynchronous()) { + // We are waiting for an SRSP and the next frame is an SREQ, so we need to wait + return false; + } + + ZstackFrameRequest nextFrame = sendQueue.poll(); + if (waitingSrsp.compareAndSet(false, nextFrame.isSynchronous())) { + logger.debug("ZSTACK synchronous frame sent. waitingSrsp={}", waitingSrsp); + } + + sendFrame(nextFrame); + return true; + } + + private synchronized void sendFrame(ZstackFrameRequest request) { + logger.debug("ZSTACK TX: {}", request); + + for (int outByte : request.serialize()) { + logger.trace("ZSTACK TX Byte: {}", String.format("%02X", outByte)); + port.write(outByte); + } + } + + public void sendRaw(int rawByte) { + logger.trace("ZSTACK TX Byte: {}", String.format("%02X", rawByte)); + port.write(rawByte); + } + + /** + * Sends a ZStack request to the NCP without waiting for the response. + * + * @param transaction Request {@link ZstackTransaction} + * @return response {@link Future} {@link ZstackFrameResponse} + */ + public Future sendZstackRequestAsync(final ZstackTransaction transaction) { + if (closeHandler) { + logger.debug("ZSTACK: Handler is closed"); + return null; + } + + class TransactionWaiter implements Callable, ZstackListener { + private boolean complete = false; + + @Override + public ZstackFrameResponse call() { + // Register a listener + addTransactionListener(this); + + // Send the transaction + queueFrame(transaction.getRequest()); + + // Wait for the transaction to complete + synchronized (this) { + while (!complete) { + try { + wait(); + } catch (InterruptedException e) { + complete = true; + } + } + } + + // Remove the listener + removeTransactionListener(this); + + return null;// response; + } + + @Override + public boolean transactionEvent(ZstackFrameResponse response) { + // Check if this response completes our transaction + if (!transaction.isMatch(response)) { + return false; + } + + transactionComplete(); + // response = request; + + return true; + } + + @Override + public void transactionComplete() { + synchronized (this) { + complete = true; + notify(); + } + } + } + + Callable worker = new TransactionWaiter(); + return executor.submit(worker); + } + + /** + * Waiting for a specific response from the NCP. + * + * @param transaction Request {@link ZstackTransaction} + * @return response {@link Future} {@link ZstackFrameResponse} + */ + public Future waitForEvent(final Class requiredResponse) { + if (closeHandler) { + logger.debug("ZSTACK: Handler is closed"); + return null; + } + + class TransactionWaiter implements Callable, ZstackListener { + private boolean complete = false; + private ZstackFrameResponse response; + + @Override + public ZstackFrameResponse call() { + // Register a listener + addTransactionListener(this); + + // Wait for the event to be received + synchronized (this) { + while (!complete) { + try { + wait(); + } catch (InterruptedException e) { + complete = true; + } + } + } + + // Remove the listener + removeTransactionListener(this); + + return response; + } + + @Override + public boolean transactionEvent(ZstackFrameResponse response) { + // Check if this response completes our transaction + if (response.getClass() != requiredResponse) { + return true; + } + + transactionComplete(); + this.response = response; + + return true; + } + + @Override + public void transactionComplete() { + synchronized (this) { + complete = true; + notify(); + } + } + } + + Callable worker = new TransactionWaiter(); + return executor.submit(worker); + } + + /** + * Sends a ZStack request to the NCP and waits for the response. The response is correlated with the request and the + * returned {@link ZstackTransaction} contains the request and response data. + * + * @param transaction Request {@link ZstackTransaction} + * @return response {@link ZstackCommand} + */ + public ZstackTransaction sendTransaction(ZstackTransaction transaction) { + logger.debug("TX ZSTACK: {}", transaction.getRequest()); + + Future futureResponse = sendZstackRequestAsync(transaction); + if (futureResponse == null) { + logger.debug("ZSTACK: Error sending transaction: Future is null"); + return null; + } + + try { + futureResponse.get(TIMEOUT, TimeUnit.MILLISECONDS); + } catch (InterruptedException | TimeoutException | ExecutionException e) { + futureResponse.cancel(true); + logger.debug("ZSTACK interrupted in sendTransaction for {}", transaction); + } + + return transaction; + } + + private String frameToString(int[] inputBuffer) { + if (inputBuffer == null) { + return ""; + } + StringBuilder result = new StringBuilder(); + for (int data : inputBuffer) { + result.append(String.format("%02X ", data)); + } + return result.toString(); + } + + interface ZstackListener { + boolean transactionEvent(ZstackFrameResponse response); + + void transactionComplete(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java new file mode 100644 index 0000000000..92eb98f0dd --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.zcl.field.ByteArray; + +/** + * This class provides utility functions to configure, and read the configuration from the Ember stack. + * + * @author Chris Jackson + * + */ +public class ZstackStackConfiguration { + /** + * The {@link ZstackNcp} used to send the EZSP frames to the NCP + */ + private ZstackNcp ncp; + + /** + * Constructor to set the {@link ZstackNcp} + * + * @param ncp the {@link ZstackNcp} used to communicate with the NCP + */ + public ZstackStackConfiguration(ZstackNcp ncp) { + this.ncp = ncp; + } + + /** + * Configuration utility. Takes a {@link Map} of {@link ConfigId} to {@link ByteArray} and will work through + * setting them before returning. + * + * @param configuration {@link Map} of {@link ConfigId} to {@link Integer} with configuration to set + * @return true if all configuration were set successfully + */ + public boolean setConfiguration(Map configuration) { + boolean success = true; + + for (Entry config : configuration.entrySet()) { + if (ncp.writeConfiguration(config.getKey(), config.getValue()) != ZstackResponseCode.SUCCESS) { + success = false; + } + } + return success; + } + + /** + * Configuration utility. Takes a {@link Set} of {@link EzspConfigId} and will work through + * requesting them before returning. + * + * @param configuration {@link Set} of {@link ConfigId} to request + * @return map of configuration data mapping {@link ConfigId} to int[]. Value will be null if error + * occurred. + */ + public Map getConfiguration(Set configuration) { + Map response = new HashMap<>(); + + for (ZstackConfigId configId : configuration) { + response.put(configId, ncp.readConfiguration(configId)); + } + + return response; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java new file mode 100644 index 0000000000..6c843e7efc --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; + +import java.util.Arrays; +import java.util.List; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Single ZStack transaction response handling. This matches a {@link ZstackFrameRequest} with a single + * {@link ZstackFrameResponse}. + * + * @author Chris Jackson + * + */ +public class ZstackSingleResponseTransaction implements ZstackTransaction { + private ZstackFrameRequest request; + private ZstackFrameResponse response; + private Class requiredResponse; + + public ZstackSingleResponseTransaction(ZstackFrameRequest request, Class requiredResponse) { + this.request = request; + this.requiredResponse = requiredResponse; + } + + @Override + public boolean isMatch(ZstackFrameResponse response) { + if (response.getClass() == requiredResponse) { + this.response = response; + return true; + } + + // If this is an RPC Error Response, then it might be telling us that the command we tried to send is + // unsupported. + // We need to terminate the transaction if this is true. + if (response instanceof ZstackRpcSreqErrorSrsp) { + return request.matchSreqError((ZstackRpcSreqErrorSrsp) response); + } + return false; + } + + @Override + public ZstackFrameRequest getRequest() { + return request; + } + + @Override + public ZstackFrameResponse getResponse() { + return response; + } + + @Override + public List getResponses() { + if (response == null) { + return null; + } + + // This transaction only allows a single response + return Arrays.asList(response); + } + + @Override + public String toString() { + return "ZstackSingleResponseTransaction [request=" + request + ", requiredResponse=" + + requiredResponse.getSimpleName() + ", response=" + response + "]"; + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java new file mode 100644 index 0000000000..1d519794da --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; + +import java.util.List; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Interface for ZStack protocol transaction. + *

+ * The transaction looks for a received {@link ZstackFrameResponse} that matches the sent {@link ZstackFrameRequest}. + * Generally, this is matching the Srsp matching the Sreq. + * The {@link ZstackFrameRequest} and {@link ZstackFrameResponse} classes are provided when the transaction is created. + * + * @author Chris Jackson + * + */ +public interface ZstackTransaction { + /** + * Matches request and response. + * + * @param response the response {@link ZstackFrameResponse} + * @return true if response matches the request + */ + boolean isMatch(ZstackFrameResponse response); + + /** + * Gets the {@link ZstackFrameRequest} associated with this transaction + * + * @return the {@link ZstackFrameRequest} + */ + ZstackFrameRequest getRequest(); + + /** + * Gets the {@link ZstackFrameResponse} for the transaction. If multiple responses are returned, this will return + * the + * last response, indicating the final response used to complete the transaction. + * + * @return {@link ZstackFrameResponse} to complete the transaction or null if no response received + */ + ZstackFrameResponse getResponse(); + + /** + * Gets a {@link List} of the {@link ZstackFrameResponse}s received for the transaction. This is used for + * transactions + * returning multiple responses - for single response transactions, use {@link #getResponse}. + * + * @return {@link ZstackFrameResponse} to complete the transaction or null if no response received + */ + List getResponses(); +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java new file mode 100644 index 0000000000..5a0aa9624e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Set; + +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetReqAcmd; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; + +/** + * + * @author Chris Jackson + * + */ +public class ZStackNcpTest { + private ArgumentCaptor transactionCapture = ArgumentCaptor.forClass(ZstackTransaction.class); + private ZstackProtocolHandler handler; + + private ZstackNcp getZstackNcp(ZstackFrameResponse response) { + handler = Mockito.mock(ZstackProtocolHandler.class); + ZstackNcp ncp = new ZstackNcp(handler); + + ZstackTransaction transaction = Mockito.mock(ZstackTransaction.class); + Mockito.when(transaction.getResponse()).thenReturn(response); + Mockito.doAnswer(new Answer() { + @Override + public ZstackTransaction answer(InvocationOnMock invocation) { + return transaction; + } + }).when(handler).sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + + return ncp; + } + + @Test + public void resetNcp() { + ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackSysResetIndAreq.class)); + + ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + + ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + System.out.println(request); + assertTrue(request instanceof ZstackSysResetReqAcmd); + assertEquals(ZstackResetType.SERIAL_BOOTLOADER, ((ZstackSysResetReqAcmd) request).getType()); + + ncp.resetNcp(ZstackResetType.TARGET_DEVICE); + Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture()); + + request = transactionCapture.getValue().getRequest(); + System.out.println(request); + assertTrue(request instanceof ZstackSysResetReqAcmd); + assertEquals(ZstackResetType.TARGET_DEVICE, ((ZstackSysResetReqAcmd) request).getType()); + } + + @Test + public void pingNcp() { + ZstackSysPingSrsp response = Mockito.mock(ZstackSysPingSrsp.class); + Mockito.when(response.getCapabilities()).thenReturn(0x17D); + ZstackNcp ncp = getZstackNcp(response); + + Set capabilities = ncp.pingNcp(); + System.out.println("Capabilities returned " + capabilities); + + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + + ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + System.out.println(request); + assertTrue(request instanceof ZstackSysPingSreq); + assertEquals(7, capabilities.size()); + } + + @Test + public void getDeviceInfo() { + ZstackUtilGetDeviceInfoSrsp response = Mockito.mock(ZstackUtilGetDeviceInfoSrsp.class); + Mockito.when(response.getDeviceState()).thenReturn(ZstackZdoState.DEV_INIT); + Mockito.when(response.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF")); + Mockito.when(response.getShortAddr()).thenReturn(0x1234); + ZstackNcp ncp = getZstackNcp(response); + + ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); + System.out.println("Device info returned " + deviceInfo); + + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + assertEquals(0x1234, deviceInfo.getShortAddr()); + assertEquals(new IeeeAddress("1234567890ABCDEF"), deviceInfo.getIeeeAddress()); + + ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + System.out.println(request); + assertTrue(request instanceof ZstackUtilGetDeviceInfoSreq); + + assertEquals(0x1234, ncp.getNwkAddress()); + assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getIeeeAddress()); + } + + @Test + public void setStartupOptions() { + ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackZbWriteConfigurationSrsp.class)); + + ncp.setStartupOptions(false, false); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + + ncp.setStartupOptions(true, false); + Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture()); + assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + + ncp.setStartupOptions(false, true); + Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture()); + assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + + ncp.setStartupOptions(true, true); + Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture()); + assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java new file mode 100644 index 0000000000..68952be99b --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -0,0 +1,245 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.Mockito; + +import com.zsmartsystems.zigbee.ExtendedPanId; +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.TestUtilities; +import com.zsmartsystems.zigbee.ZigBeeApsFrame; +import com.zsmartsystems.zigbee.ZigBeeChannel; +import com.zsmartsystems.zigbee.ZigBeeNodeStatus; +import com.zsmartsystems.zigbee.ZigBeeNwkAddressMode; +import com.zsmartsystems.zigbee.ZigBeeProfileType; +import com.zsmartsystems.zigbee.ZigBeeStatus; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; +import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; +import com.zsmartsystems.zigbee.transport.ZigBeePort; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportProgressState; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportReceive; +import com.zsmartsystems.zigbee.transport.ZigBeeTransportState; + +/** + * Tests for {@link ZigBeeDongleZstack} + * + * @author Chris Jackson + * + */ +public class ZigBeeDongleZstackTest { + private static int TIMEOUT = 5000; + + @Test + public void setZigBeeExtendedPanId() { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + dongle.setZigBeeExtendedPanId(new ExtendedPanId("123456789abcdef")); + assertEquals(new ExtendedPanId("123456789abcdef"), dongle.getZigBeeExtendedPanId()); + } + + @Test + public void setZigBeePanId() { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + dongle.setZigBeePanId(0x1234); + assertEquals(0x1234, dongle.getZigBeePanId()); + } + + @Test + public void testEzspStackStatusHandler() throws Exception { + ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); + + final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); + Mockito.when(ncp.getNwkAddress()).thenReturn(1243); + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null) { + @Override + public ZstackNcp getZstackNcp() { + return ncp; + } + }; + dongle.setZigBeeTransportReceive(transport); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); + + EzspStackStatusHandler response = Mockito.mock(EzspStackStatusHandler.class); + Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_BUSY); + Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)) + .setNetworkState(ArgumentMatchers.any(ZigBeeTransportState.class)); + + response = Mockito.mock(EzspStackStatusHandler.class); + Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_UP); + dongle.handlePacket(response); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.ONLINE); + assertEquals(Integer.valueOf(1243), dongle.getNwkAddress()); + + response = Mockito.mock(EzspStackStatusHandler.class); + Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_DOWN); + dongle.handlePacket(response); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.OFFLINE); + } + + @Test + public void testEzspChildJoinHandler() throws Exception { + ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); + + final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); + Mockito.when(ncp.getNwkAddress()).thenReturn(1243); + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null) { + @Override + public ZstackNcp getZstackNcp() { + return ncp; + } + }; + dongle.setZigBeeTransportReceive(transport); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); + + EzspChildJoinHandler response = Mockito.mock(EzspChildJoinHandler.class); + Mockito.when(response.getChildId()).thenReturn(123); + Mockito.when(response.getChildEui64()).thenReturn(new IeeeAddress("1234567890ABCDEF")); + dongle.handlePacket(response); + Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(1)).nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, + 123, new IeeeAddress("1234567890ABCDEF")); + } + + @Test + public void setZigBeeChannel() { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + assertEquals(ZigBeeStatus.INVALID_ARGUMENTS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_03)); + + assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_11)); + assertEquals(ZigBeeChannel.CHANNEL_11, dongle.getZigBeeChannel()); + + assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_24)); + assertEquals(ZigBeeChannel.CHANNEL_24, dongle.getZigBeeChannel()); + } + + @Test + public void testEzspMessageSentHandler() throws Exception { + ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); + + final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); + Mockito.when(ncp.getNwkAddress()).thenReturn(1243); + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + dongle.setZigBeeTransportReceive(transport); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", + Executors.newScheduledThreadPool(1)); + + EzspMessageSentHandler response = Mockito.mock(EzspMessageSentHandler.class); + Mockito.when(response.getMessageTag()).thenReturn(231); + Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_SUCCESS); + dongle.handlePacket(response); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, + ZigBeeTransportProgressState.RX_ACK); + + response = Mockito.mock(EzspMessageSentHandler.class); + Mockito.when(response.getMessageTag()).thenReturn(231); + Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_DOWN); + dongle.handlePacket(response); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, + ZigBeeTransportProgressState.RX_NAK); + } + + @Test + public void sendCommandUnicast() throws Exception { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + ZstackProtocolHandler handler = Mockito.mock(ZstackProtocolHandler.class); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", handler); + + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); + + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setCluster(0); + apsFrame.setProfile(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); + apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); + apsFrame.setDestinationAddress(1234); + apsFrame.setApsCounter(1); + apsFrame.setRadius(30); + apsFrame.setPayload(new int[] {}); + + dongle.sendCommand(1, apsFrame); + Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) + .sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + } + + @Test + public void sendCommandBroadcast() throws Exception { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + ZstackProtocolHandler handler = Mockito.mock(ZstackProtocolHandler.class); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", handler); + + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); + + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setCluster(0); + apsFrame.setProfile(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); + apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); + apsFrame.setDestinationAddress(0xfff9); + apsFrame.setApsCounter(1); + apsFrame.setRadius(30); + apsFrame.setPayload(new int[] {}); + + dongle.sendCommand(1, apsFrame); + Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) + .sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + } + + @Test + public void shutdown() throws Exception { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "serialPort", Mockito.mock(ZigBeePort.class)); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", + Mockito.mock(ZstackProtocolHandler.class)); + + dongle.shutdown(); + } + + @Test + public void scheduleNetworkStatePolling() throws Exception { + ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + + ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); + + ZstackProtocolHandler frameHandler = Mockito.mock(ZstackProtocolHandler.class); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "pollRate", 1); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", frameHandler); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); + + TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); + Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) + .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommand", Long.MAX_VALUE - 1); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "networkStateUp", true); + TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); + Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) + .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); + + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommand", 0); + TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); + Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).atLeast(1)) + .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java new file mode 100644 index 0000000000..16ad5ff508 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.IeeeAddress; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackFrameRequestTest { + + @Test + public void deserializeUInt16() { + Request request = new Request(); + request.serializeUInt16(0x1234); + + assertTrue(Arrays.equals(new int[] { 0xFE, 0x04, 0x00, 0x00, 0x34, 0x12, 0x22 }, request.getPayload())); + } + + @Test + public void serializeUInt32() { + Request request = new Request(); + request.serializeUInt32(0x12345678); + + assertTrue(Arrays.equals(new int[] { 0xFE, 0x06, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, 0x0E }, + request.getPayload())); + } + + @Test + public void serializeIeeeAddress() { + Request request = new Request(); + IeeeAddress address = new IeeeAddress("1234567890ABCDEF"); + request.serializeIeeeAddress(address); + + assertTrue(Arrays.equals( + new int[] { 0xFE, 0x0A, 0x00, 0x00, 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12, 0x1B }, + request.getPayload())); + } + + @Test + public void serializeBoolean() { + Request request = new Request(); + request.serializeBoolean(false); + request.serializeBoolean(true); + + assertTrue(Arrays.equals(new int[] { 0xFE, 0x04, 0x00, 0x00, 0x00, 0x01, 0x05 }, request.getPayload())); + } + + class Request extends ZstackFrameRequest { + @Override + public int[] serialize() { + // TODO Auto-generated method stub + return null; + } + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java new file mode 100644 index 0000000000..77c449f3ab --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.IeeeAddress; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackFrameResponseTest { + + @Test + public void deserializeUInt16() { + Response response = new Response(new int[] { 0x00, 0x00, 0x34, 0x12 }); + + assertEquals(0x1234, response.deserializeUInt16()); + } + + @Test + public void deserializeUInt32() { + Response response = new Response(new int[] { 0x00, 0x00, 0x78, 0x56, 0x34, 0x12 }); + + assertEquals(0x12345678, response.deserializeUInt32()); + } + + @Test + public void deserializeBoolean() { + Response response = new Response(new int[] { 0x00, 0x00, 0x00, 0x01 }); + + assertEquals(false, response.deserializeBoolean()); + assertEquals(true, response.deserializeBoolean()); + } + + @Test + public void deserializeIeeeAddress() { + Response response = new Response(new int[] { 0x00, 0x00, 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12 }); + + assertEquals(new IeeeAddress("1234567890ABCDEF"), response.deserializeIeeeAddress()); + } + + class Response extends ZstackFrameResponse { + public Response(int[] inputBuffer) { + super(inputBuffer); + } + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java new file mode 100644 index 0000000000..252d3a5564 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackRpcSreqErrorSrspTest { + @Test + public void test() { + ZstackRpcSreqErrorSrsp res = new ZstackRpcSreqErrorSrsp(new int[] { 0x60, 0x00, 0x02, 0x21, 0x19, 0x59 }); + + System.out.println(res); + + assertEquals(0x21, res.getReqCmd0()); + assertEquals(0x19, res.getReqCmd1()); + assertEquals(ZstackSreqErrorCode.INVALID_COMMAND_ID, res.getErrorCode()); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java new file mode 100644 index 0000000000..3c38d5c643 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackSysResetReqAcmdTest { + @Test + public void test() { + ZstackSysResetReqAcmd req = new ZstackSysResetReqAcmd(); + req.setType(ZstackResetType.TARGET_DEVICE); + + System.out.println(req); + int[] data = req.serialize(); + assertTrue(Arrays.equals(data, new int[] { 0xFE, 0x01, 0x41, 0x00, 0x00, 0x40 })); + + req = new ZstackSysResetReqAcmd(); + req.setType(ZstackResetType.SERIAL_BOOTLOADER); + + System.out.println(req); + data = req.serialize(); + assertTrue(Arrays.equals(data, new int[] { 0xFE, 0x01, 0x41, 0x00, 0x01, 0x41 })); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java new file mode 100644 index 0000000000..f3d5313aef --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; +import org.mockito.Mockito; + +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackSysVersionSreqTest { + @Test + public void test() { + ZstackSysVersionSreq req = new ZstackSysVersionSreq(); + + System.out.println(req); + int[] data = req.serialize(); + assertTrue(Arrays.equals(data, new int[] { 0xFE, 0x00, 0x21, 0x02, 0x23 })); + + ZstackRpcSreqErrorSrsp err = Mockito.mock(ZstackRpcSreqErrorSrsp.class); + Mockito.when(err.getReqCmd0()).thenReturn(0x21); + Mockito.when(err.getReqCmd1()).thenReturn(0x02); + assertTrue(req.matchSreqError(err)); + + Mockito.when(err.getReqCmd0()).thenReturn(0x21); + Mockito.when(err.getReqCmd1()).thenReturn(0x03); + assertFalse(req.matchSreqError(err)); + + Mockito.when(err.getReqCmd0()).thenReturn(0x22); + Mockito.when(err.getReqCmd1()).thenReturn(0x02); + assertFalse(req.matchSreqError(err)); + + Mockito.when(err.getReqCmd0()).thenReturn(0x41); + Mockito.when(err.getReqCmd1()).thenReturn(0x02); + assertTrue(req.matchSreqError(err)); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java new file mode 100644 index 0000000000..008d918e9b --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackUtilGetDeviceInfoSrspTest { + @Test + public void test() { + ZstackUtilGetDeviceInfoSrsp res = new ZstackUtilGetDeviceInfoSrsp( + new int[] { 0x67, 0x00, 0x00, 0x14, 0xD4, 0xF1, 0x02, 0x00, 0x4B, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x04, 0xFC, 0x35, 0x7E, 0xC4, 0xAF, 0x29, 0xE3, 0xF6 }); + + System.out.println(res); + + assertEquals(ZstackResponseCode.SUCCESS, res.getStatus()); + assertEquals(1, res.getDeviceType()); + assertEquals(0, res.getShortAddr()); + assertEquals(new IeeeAddress("00124B0002F1D414"), res.getIeeeAddress()); + assertEquals(ZstackDeviceState.UNINITIALIZED, res.getDeviceState()); + assertEquals(4, res.getAssocDevicesList().length); + assertEquals(0x35FC, res.getAssocDevicesList()[0]); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java new file mode 100644 index 0000000000..265d366e72 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.TestUtilities; +import com.zsmartsystems.zigbee.transport.ZigBeePort; + +/** + * Tests for {@link ZstackProtocolHandler} + * + * @author Chris Jackson + * + */ +public class ZstackProtocolHandlerTest { + private static int TIMEOUT = 5000; + + private int[] getPacket(int[] data) { + ZstackProtocolHandler handler = new ZstackProtocolHandler(null); + byte[] bytedata = new byte[data.length]; + int cnt = 0; + for (int value : data) { + bytedata[cnt++] = (byte) value; + } + ByteArrayInputStream stream = new ByteArrayInputStream(bytedata); + ZigBeePort port = new TestPort(stream, null); + + Method privateMethod; + try { + Field field = handler.getClass().getDeclaredField("port"); + field.setAccessible(true); + field.set(handler, port); + + privateMethod = ZstackProtocolHandler.class.getDeclaredMethod("getPacket"); + privateMethod.setAccessible(true); + + return (int[]) privateMethod.invoke(handler); + } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException + | InvocationTargetException | NoSuchFieldException e) { + e.printStackTrace(); + } + + return null; + } + + @Test + public void testReceivePacket() { + int[] response = getPacket(new int[] { 0xFE, 0x02, 0x61, 0x01, 0x12, 0x34, 0x44 }); + assertTrue(Arrays.equals(response, new int[] { 0x61, 0x01, 0x12, 0x34 })); + } + + @Test + public void testReceivePacketLeadingRubbish() { + int[] response = getPacket(new int[] { 0x00, 0x12, 0xFE, 0x02, 0x61, 0x01, 0x12, 0x34, 0x44 }); + assertTrue(Arrays.equals(response, new int[] { 0x61, 0x01, 0x12, 0x34 })); + } + + @Test + public void isSynchronous() throws NoSuchMethodException, SecurityException, IllegalAccessException, + IllegalArgumentException, InvocationTargetException { + ZstackProtocolHandler handler = new ZstackProtocolHandler(null); + + assertTrue((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", + int.class, 0x61)); + assertTrue((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", + int.class, 0x22)); + assertFalse((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", + int.class, 0x01)); + assertFalse((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", + int.class, 0x42)); + } + + class TestPort implements ZigBeePort { + InputStream input; + List outputData = new ArrayList<>(); + + TestPort(InputStream input, OutputStream output) { + this.input = input; + } + + @Override + public boolean open() { + return true; + } + + @Override + public void close() { + } + + @Override + public void write(int value) { + outputData.add(value); + } + + @Override + public int read(int timeout) { + return read(); + } + + @Override + public int read() { + if (input == null) { + return -1; + } + try { + return input.read(); + } catch (IOException e) { + return -1; + } + } + + @Override + public boolean open(int baudRate) { + return false; + } + + @Override + public boolean open(int baudRate, FlowControl flowControl) { + return false; + } + + @Override + public void purgeRxBuffer() { + } + + public List getOutputData() { + return outputData; + } + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java new file mode 100644 index 0000000000..5d31ea4234 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; + +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 org.junit.Test; + +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackSingleResponseTransactionTest { + @Test + public void testResponseMatches() { + ZstackUtilLedControlSreq request = new ZstackUtilLedControlSreq(); + request.setLedId(1); + request.setMode(false); + System.out.println(request); + + ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackUtilLedControlSrsp.class); + + ZstackUtilLedControlSrsp response = new ZstackUtilLedControlSrsp(new int[] { 0x00, 0x00, 0x34, 0x12 }); + System.out.println(response); + + assertTrue(transaction.isMatch(response)); + + assertEquals(request, transaction.getRequest()); + assertNotNull(transaction.getResponse()); + assertEquals(response, transaction.getResponse()); + } + + @Test + public void testResponseMatchFails() { + ZstackUtilLedControlSreq request = new ZstackUtilLedControlSreq(); + request.setLedId(1); + request.setMode(false); + System.out.println(request); + + ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackUtilLedControlSrsp.class); + + ZstackUtilSetChannelsSrsp response = new ZstackUtilSetChannelsSrsp(new int[] { 0x00, 0x00, 0x34, 0x12 }); + System.out.println(response); + + assertFalse(transaction.isMatch(response)); + + assertEquals(request, transaction.getRequest()); + assertNull(transaction.getResponse()); + } +} diff --git a/pom.xml b/pom.xml index 2cc148b52c..90d51fda2e 100644 --- a/pom.xml +++ b/pom.xml @@ -76,10 +76,13 @@ com.zsmartsystems.zigbee.dongle.conbee com.zsmartsystems.zigbee.dongle.telegesis com.zsmartsystems.zigbee.dongle.telegesis.autocode + com.zsmartsystems.zigbee.dongle.zstack + com.zsmartsystems.zigbee.dongle.zstack.autocode com.zsmartsystems.zigbee.console com.zsmartsystems.zigbee.console.ember com.zsmartsystems.zigbee.console.main com.zsmartsystems.zigbee.console.telegesis + com.zsmartsystems.zigbee.console.zstack com.zsmartsystems.zigbee.serial com.zsmartsystems.zigbee.test releng/p2repo From 62a61c1d49619b8cb0ad8cf10f379623a316d319 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Mon, 22 Apr 2019 11:13:35 +0100 Subject: [PATCH 02/33] Update to use separate serializer/deserialzer classes Signed-off-by: Chris Jackson --- .../zstack/autocode/CommandGenerator.java | 32 ++++---- .../zstack/autocode/ZstackAutocoder.java | 3 + .../dongle/zstack/autocode/xml/Structure.java | 1 + .../src/main/resources/zstack_protocol.xml | 19 +++++ .../dongle/zstack/ZigBeeDongleZstack.java | 3 + .../dongle/zstack/api/ZstackFrameRequest.java | 76 +++--------------- .../zstack/api/ZstackFrameResponse.java | 61 ++------------- .../api/af/ZstackAfDataConfirmAreq.java | 6 +- .../api/af/ZstackAfDataRequestSreq.java | 18 ++--- .../api/af/ZstackAfDataRequestSrsp.java | 2 +- .../api/af/ZstackAfIncomingMsgAreq.java | 24 +++--- .../zstack/api/af/ZstackAfRegisterSreq.java | 18 ++--- .../zstack/api/af/ZstackAfRegisterSrsp.java | 2 +- .../ZstackAppCnfBdbAddInstallcodeSreq.java | 6 +- .../ZstackAppCnfBdbAddInstallcodeSrsp.java | 2 +- ...ppCnfBdbCommissioningNotificationAreq.java | 6 +- ...BdbSetActiveDefaultCentralizedKeySreq.java | 4 +- ...BdbSetActiveDefaultCentralizedKeySrsp.java | 2 +- ...ppCnfBdbSetJoinusesinstallcodekeySreq.java | 2 +- ...ppCnfBdbSetJoinusesinstallcodekeySrsp.java | 2 +- ...kAppCnfBdbSetTcRequireKeyExchangeSreq.java | 2 +- ...kAppCnfBdbSetTcRequireKeyExchangeSrsp.java | 2 +- ...stackAppCnfSetAllowrejoinTcPolicySreq.java | 2 +- ...stackAppCnfSetAllowrejoinTcPolicySrsp.java | 2 +- .../zstack/api/mac/ZstackMacScanReqSreq.java | 16 ++-- .../api/rpc/ZstackRpcSreqErrorSrsp.java | 6 +- .../api/sapi/ZstackZbGetDeviceInfoSreq.java | 2 +- .../api/sapi/ZstackZbGetDeviceInfoSrsp.java | 4 +- .../sapi/ZstackZbReadConfigurationSreq.java | 2 +- .../sapi/ZstackZbReadConfigurationSrsp.java | 8 +- .../sapi/ZstackZbWriteConfigurationSreq.java | 6 +- .../sapi/ZstackZbWriteConfigurationSrsp.java | 2 +- .../api/sbl/ZstackSbHandshakeCmdSrsp.java | 10 +-- .../zstack/api/sbl/ZstackSbWriteCmdSreq.java | 4 +- .../zstack/api/sbl/ZstackSbWriteCmdSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackConfigId.java | 2 +- .../api/sys/ZstackSysGetExtAddrSrsp.java | 2 +- .../api/sys/ZstackSysOsalNvReadSreq.java | 4 +- .../api/sys/ZstackSysOsalNvReadSrsp.java | 6 +- .../api/sys/ZstackSysOsalNvWriteSreq.java | 8 +- .../api/sys/ZstackSysOsalNvWriteSrsp.java | 2 +- .../zstack/api/sys/ZstackSysPingSrsp.java | 2 +- .../zstack/api/sys/ZstackSysResetIndAreq.java | 12 +-- .../zstack/api/sys/ZstackSysResetReqAcmd.java | 2 +- .../api/sys/ZstackSysSetExtAddrSreq.java | 2 +- .../api/sys/ZstackSysSetExtAddrSrsp.java | 2 +- .../api/sys/ZstackSysSetTxPowerSreq.java | 2 +- .../api/sys/ZstackSysSetTxPowerSrsp.java | 2 +- .../zstack/api/sys/ZstackSysVersionSrsp.java | 10 +-- .../sys/ZstackSysZdiagsClearStatsSreq.java | 2 +- .../sys/ZstackSysZdiagsClearStatsSrsp.java | 2 +- .../api/sys/ZstackSysZdiagsGetStatsSreq.java | 2 +- .../api/sys/ZstackSysZdiagsGetStatsSrsp.java | 2 +- .../api/sys/ZstackSysZdiagsInitStatsSrsp.java | 2 +- .../ZstackSysZdiagsRestoreStatsNvSreq.java | 2 +- .../ZstackSysZdiagsRestoreStatsNvSrsp.java | 2 +- .../sys/ZstackSysZdiagsSaveStatsToNvSrsp.java | 2 +- .../ZstackUtilApsmeLinkKeyDataGetSreq.java | 2 +- .../ZstackUtilApsmeLinkKeyDataGetSrsp.java | 8 +- .../ZstackUtilApsmeLinkKeyNvIdGetSreq.java | 2 +- .../ZstackUtilApsmeLinkKeyNvIdGetSrsp.java | 4 +- .../api/util/ZstackUtilGetDeviceInfoSrsp.java | 14 ++-- .../api/util/ZstackUtilGetNvInfoSrsp.java | 12 +-- .../api/util/ZstackUtilLedControlSreq.java | 4 +- .../api/util/ZstackUtilLedControlSrsp.java | 2 +- .../api/util/ZstackUtilSetChannelsSreq.java | 2 +- .../api/util/ZstackUtilSetChannelsSrsp.java | 2 +- .../api/util/ZstackUtilSetPanidSreq.java | 2 +- .../api/util/ZstackUtilSetPanidSrsp.java | 2 +- .../api/util/ZstackUtilSetPrecfgkeySreq.java | 2 +- .../api/util/ZstackUtilSetPrecfgkeySrsp.java | 2 +- .../api/util/ZstackUtilSetSeclevelSreq.java | 2 +- .../api/util/ZstackUtilSetSeclevelSrsp.java | 2 +- .../api/zdo/ZstackZdoGetLinkKeySreq.java | 2 +- .../api/zdo/ZstackZdoGetLinkKeySrsp.java | 6 +- .../zstack/api/zdo/ZstackZdoLeaveIndAreq.java | 10 +-- .../api/zdo/ZstackZdoMsgCbIncomingAreq.java | 14 ++-- .../api/zdo/ZstackZdoMsgCbRegisterSreq.java | 2 +- .../api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 2 +- .../api/zdo/ZstackZdoNwkDiscoveryReqSreq.java | 4 +- .../api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java | 2 +- .../api/zdo/ZstackZdoRemoveLinkKeySreq.java | 2 +- .../api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 2 +- .../api/zdo/ZstackZdoSetLinkKeySreq.java | 6 +- .../api/zdo/ZstackZdoSetLinkKeySrsp.java | 2 +- .../api/zdo/ZstackZdoStartupFromAppSreq.java | 2 +- .../api/zdo/ZstackZdoStartupFromAppSrsp.java | 2 +- .../api/zdo/ZstackZdoStateChangeIndAreq.java | 2 +- .../zstack/api/zdo/ZstackZdoTcDevIndAreq.java | 6 +- .../serializer/ZstackDeserializer.java | 78 +++++++++++++++++++ .../internal/serializer/ZstackSerializer.java | 75 ++++++++++++++++++ .../zstack/api/ZstackFrameRequestTest.java | 22 +++--- .../zstack/api/ZstackFrameResponseTest.java | 10 +-- .../util/ZstackUtilGetDeviceInfoSrspTest.java | 3 +- .../serializer/ZstackDeserializerTest.java | 53 +++++++++++++ .../serializer/ZstackSerializerTest.java | 58 ++++++++++++++ 96 files changed, 529 insertions(+), 333 deletions(-) create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index d18a3a08d4..652246c6a9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -147,13 +147,14 @@ private void createCommandClass(String className, Command command, List autoSizers = new HashMap(); for (Parameter parameter : parameters) { if (parameter.auto_size != null) { - out.println(" int " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" - + getTypeSerializer(command.subsystem, parameter.data_type) + "();"); + out.println( + " int " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(command.subsystem, parameter.data_type) + "();"); autoSizers.put(parameter.auto_size, camelCaseToLowerCamelCase(parameter.name)); continue; } if (autoSizers.get(parameter.name) != null) { - out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserialize" + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + getTypeSerializer(command.subsystem, parameter.data_type) + "(" + autoSizers.get(parameter.name) + ");"); continue; @@ -162,14 +163,14 @@ private void createCommandClass(String className, Command command, List) processNode(nodes.item(temp)); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java index 4e34ee948d..a871fb216d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java @@ -18,4 +18,5 @@ public class Structure { public String name; public String description; public List parameters; + public String subsystem; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 650f04a865..4799d5f6f8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -3025,4 +3025,23 @@ + + + ZstackNwkKeyDesc + SYS + + + + uint8 + keySeqNum + + + + ZigBeeKey + key + + + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index a8b687d5b8..fd0e739667 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -235,6 +235,9 @@ public ZigBeeStatus initialize() { logger.debug("ZStack subsystem capabilities: {}", capabilities); ZstackSysVersionSrsp version = ncp.getVersion(); + if (version == null) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } StringBuilder builder = new StringBuilder(); builder.append("Software="); builder.append(version.getMajorRel()); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java index 18a92672a5..85c8e89fec 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java @@ -9,10 +9,8 @@ import java.util.Arrays; -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.security.ZigBeeKey; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; /** * @@ -20,8 +18,7 @@ * */ public abstract class ZstackFrameRequest extends ZstackCommand { - private int[] buffer = new int[250]; - private int length = 4; + protected ZstackSerializer serializer = new ZstackSerializer(); private static final int ZSTACK_SOF = 0xFE; @@ -32,73 +29,24 @@ public abstract class ZstackFrameRequest extends ZstackCommand { public abstract int[] serialize(); protected void serializeHeader(int type, int subsystem, int id) { - buffer[2] = type + subsystem; - buffer[3] = id; - } - - protected void serializeUInt8(int uint8) { - buffer[length++] = uint8 & 0xFF; - } - - protected void serializeUInt16(int uint16) { - buffer[length++] = uint16 & 0xFF; - buffer[length++] = (uint16 >> 8) & 0xFF; - } - - protected void serializeUInt32(int uint32) { - buffer[length++] = uint32 & 0xFF; - buffer[length++] = (uint32 >> 8) & 0xFF; - buffer[length++] = (uint32 >> 16) & 0xFF; - buffer[length++] = (uint32 >> 24) & 0xFF; - } - - protected void serializeBoolean(boolean bool) { - buffer[length++] = bool ? 1 : 0; - } - - protected void serializeUInt8Array(int[] uint8Array) { - for (int val : uint8Array) { - serializeUInt8(val); - } - } - - protected void serializeUInt16Array(int[] uint16Array) { - for (int val : uint16Array) { - serializeUInt16(val); - } - } - - protected void serializeIeeeAddress(IeeeAddress address) { - buffer[length++] = address.getValue()[0]; - buffer[length++] = address.getValue()[1]; - buffer[length++] = address.getValue()[2]; - buffer[length++] = address.getValue()[3]; - buffer[length++] = address.getValue()[4]; - buffer[length++] = address.getValue()[5]; - buffer[length++] = address.getValue()[6]; - buffer[length++] = address.getValue()[7]; - } - - protected void serializeZigBeeKey(ZigBeeKey keyData) { - serializeUInt8Array(keyData.getValue()); - } - - protected void serializeAfDataOptions(AfDataOptions options2) { - // TODO Auto-generated method stub - + serializer.serializeUInt8(ZSTACK_SOF); + serializer.serializeUInt8(0); // Length will be updated later + serializer.serializeUInt8(type + subsystem); + serializer.serializeUInt8(id); } protected int[] getPayload() { - buffer[0] = ZSTACK_SOF; - buffer[1] = length - 4; + serializer.serializeUInt8(0); // Checksum will be updated later + int buffer[] = serializer.getBuffer(); + buffer[1] = buffer.length - 5; int checksum = 0; - for (int cnt = 1; cnt < length; cnt++) { + for (int cnt = 1; cnt < buffer.length; cnt++) { checksum ^= buffer[cnt]; } - buffer[length++] = checksum & 0xFF; + buffer[buffer.length - 1] = checksum & 0xFF; - return Arrays.copyOfRange(buffer, 0, length); + return Arrays.copyOfRange(buffer, 0, buffer.length); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java index 84f0f04814..59a456da69 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java @@ -7,8 +7,7 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.api; -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.security.ZigBeeKey; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; /** * @@ -16,63 +15,13 @@ * */ public abstract class ZstackFrameResponse extends ZstackCommand { - private int[] buffer; - private int position; + protected ZstackDeserializer deserializer; public ZstackFrameResponse(int[] inputBuffer) { - buffer = inputBuffer; - position = 2; // Skip the command ID - } - - protected int deserializeUInt8() { - return buffer[position++]; - } - - protected int deserializeUInt16() { - return buffer[position++] + (buffer[position++] << 8); - } - - protected int deserializeUInt32() { - return buffer[position++] + (buffer[position++] << 8) + (buffer[position++] << 16) + (buffer[position++] << 24); - } - - protected boolean deserializeBoolean() { - return buffer[position++] != 0; - } - - protected IeeeAddress deserializeIeeeAddress() { - int address[] = new int[8]; - for (int cnt = 0; cnt < 8; cnt++) { - address[cnt] = buffer[position++]; - } - return new IeeeAddress(address); - } - - protected int[] deserializeUInt8Array() { - return deserializeUInt8Array(buffer.length - position); - } - - protected int[] deserializeUInt8Array(int len) { - int[] array = new int[len]; - - for (int cnt = 0; cnt < len; cnt++) { - array[cnt] = deserializeUInt8(); - } + deserializer = new ZstackDeserializer(inputBuffer); - return array; + // Skip the command ID + deserializer.deserializeUInt16(); } - protected int[] deserializeUInt16Array(int len) { - int[] array = new int[len]; - - for (int cnt = 0; cnt < len; cnt++) { - array[cnt] = deserializeUInt16(); - } - - return array; - } - - protected ZigBeeKey deserializeZigBeeKey() { - return new ZigBeeKey(deserializeUInt8Array(16)); - } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java index 401eae51d2..e517917b4d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -50,9 +50,9 @@ public ZstackAfDataConfirmAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - endpoint = deserializeUInt8(); - transId = deserializeUInt8(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + endpoint = deserializer.deserializeUInt8(); + transId = deserializer.deserializeUInt8(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java index 77a8670fd7..10d94543c6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java @@ -244,19 +244,19 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x01); // Serialize the fields - serializeUInt16(dstAddr); - serializeUInt8(destEndpoint); - serializeUInt8(srcEndpoint); - serializeUInt16(clusterId); - serializeUInt8(transId); + serializer.serializeUInt16(dstAddr); + serializer.serializeUInt8(destEndpoint); + serializer.serializeUInt8(srcEndpoint); + serializer.serializeUInt16(clusterId); + serializer.serializeUInt8(transId); int tmpOptions = 0; for (AfDataOptions value : options) { tmpOptions += value.getKey(); } - serializeUInt8(tmpOptions); - serializeUInt8(radius); - serializeUInt8(data.length); - serializeUInt8Array(data); + serializer.serializeUInt8(tmpOptions); + serializer.serializeUInt8(radius); + serializer.serializeUInt8(data.length); + serializer.serializeUInt8Array(data); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java index 3f9f6c747f..79d4f89cb3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java @@ -36,7 +36,7 @@ public ZstackAfDataRequestSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java index 3ea537a930..107102f28e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java @@ -84,18 +84,18 @@ public ZstackAfIncomingMsgAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - groupId = deserializeUInt16(); - clusterId = deserializeUInt16(); - srcAddr = deserializeUInt16(); - srcEndpoint = deserializeUInt8(); - destEndpoint = deserializeUInt8(); - wasBroadcast = deserializeBoolean(); - linkQuality = deserializeUInt8(); - securityUse = deserializeBoolean(); - timeStamp = deserializeUInt32(); - seqNumber = deserializeUInt8(); - int len = deserializeUInt8(); - data = deserializeUInt8Array(len); + groupId = deserializer.deserializeUInt16(); + clusterId = deserializer.deserializeUInt16(); + srcAddr = deserializer.deserializeUInt16(); + srcEndpoint = deserializer.deserializeUInt8(); + destEndpoint = deserializer.deserializeUInt8(); + wasBroadcast = deserializer.deserializeBoolean(); + linkQuality = deserializer.deserializeUInt8(); + securityUse = deserializer.deserializeBoolean(); + timeStamp = deserializer.deserializeUInt32(); + seqNumber = deserializer.deserializeUInt8(); + int len = deserializer.deserializeUInt8(); + data = deserializer.deserializeUInt8Array(len); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index 0a2b4cc365..29b1dfba07 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -203,15 +203,15 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x00); // Serialize the fields - serializeUInt8(endPoint); - serializeUInt16(appProfId); - serializeUInt16(appDeviceId); - serializeUInt8(appDevVer); - serializeUInt8(latencyReq); - serializeUInt8(appInClusterList.length); - serializeUInt16Array(appInClusterList); - serializeUInt8(appOutClusterList.length); - serializeUInt16Array(appOutClusterList); + serializer.serializeUInt8(endPoint); + serializer.serializeUInt16(appProfId); + serializer.serializeUInt16(appDeviceId); + serializer.serializeUInt8(appDevVer); + serializer.serializeUInt8(latencyReq); + serializer.serializeUInt8(appInClusterList.length); + serializer.serializeUInt16Array(appInClusterList); + serializer.serializeUInt8(appOutClusterList.length); + serializer.serializeUInt16Array(appOutClusterList); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java index 43266c7593..2073db3578 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -39,7 +39,7 @@ public ZstackAfRegisterSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java index 2bf6b1aa36..186452cd85 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java @@ -113,9 +113,9 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); // Serialize the fields - serializeUInt8(installCodeFormat.getKey()); - serializeIeeeAddress(ieeeAddress); - serializeZigBeeKey(installCode); + serializer.serializeUInt8(installCodeFormat.getKey()); + serializer.serializeIeeeAddress(ieeeAddress); + serializer.serializeZigBeeKey(installCode); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java index 9c14b9f67c..4ba8025790 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java @@ -36,7 +36,7 @@ public ZstackAppCnfBdbAddInstallcodeSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java index 901474929e..c0a4c337c0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java @@ -48,9 +48,9 @@ public ZstackAppCnfBdbCommissioningNotificationAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - status = ZstackBdbStatus.valueOf(deserializeUInt8()); - commissioningMode = ZstackBdbCommissioningMode.valueOf(deserializeUInt8()); - int tmpRemainingCommissioningModes = deserializeUInt8(); + status = ZstackBdbStatus.valueOf(deserializer.deserializeUInt8()); + commissioningMode = ZstackBdbCommissioningMode.valueOf(deserializer.deserializeUInt8()); + int tmpRemainingCommissioningModes = deserializer.deserializeUInt8(); for (ZstackBdbRemainingCommissioningModes value : ZstackBdbRemainingCommissioningModes.values()) { if ((tmpRemainingCommissioningModes & value.getKey()) != 0) { remainingCommissioningModes.add(value); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java index c0f5a45958..244b54c6af 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java @@ -85,8 +85,8 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x07); // Serialize the fields - serializeUInt8(centralizedLinkKeyMode.getKey()); - serializeUInt8(installCode); + serializer.serializeUInt8(centralizedLinkKeyMode.getKey()); + serializer.serializeUInt8(installCode); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java index 3edc3c6815..9200b66c75 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java @@ -36,7 +36,7 @@ public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java index a8253791d5..4e871c2ebc 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java @@ -86,7 +86,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x06); // Serialize the fields - serializeBoolean(joinUsesInstallCodeKey); + serializer.serializeBoolean(joinUsesInstallCodeKey); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java index 70e05fa3bb..8547b421b6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java @@ -36,7 +36,7 @@ public ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java index a20657cd79..0afe323c69 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java @@ -74,7 +74,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x09); // Serialize the fields - serializeBoolean(trustCenterRequireKeyExchange); + serializer.serializeBoolean(trustCenterRequireKeyExchange); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java index 7618e92946..56c1eea507 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java @@ -36,7 +36,7 @@ public ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java index db90c7c5be..ecc7da12bf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); // Serialize the fields - serializeBoolean(allowRejoin); + serializer.serializeBoolean(allowRejoin); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java index b30e53dfce..95d9a19585 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java @@ -36,7 +36,7 @@ public ZstackAppCnfSetAllowrejoinTcPolicySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java index 19be64b6cb..586620e1df 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java @@ -235,14 +235,14 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_MAC, 0x0C); // Serialize the fields - serializeUInt32(scanChannels); - serializeUInt8(scanType); - serializeUInt8(scanDuration); - serializeUInt8(channelPage); - serializeUInt8(keySource); - serializeUInt8(securityLevel); - serializeUInt8(keyIdMode); - serializeUInt8(keyIndex); + serializer.serializeUInt32(scanChannels); + serializer.serializeUInt8(scanType); + serializer.serializeUInt8(scanDuration); + serializer.serializeUInt8(channelPage); + serializer.serializeUInt8(keySource); + serializer.serializeUInt8(securityLevel); + serializer.serializeUInt8(keyIdMode); + serializer.serializeUInt8(keyIndex); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java index ac6552e32d..2965de8dd1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java @@ -45,9 +45,9 @@ public ZstackRpcSreqErrorSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - errorCode = ZstackSreqErrorCode.valueOf(deserializeUInt8()); - reqCmd0 = deserializeUInt8(); - reqCmd1 = deserializeUInt8(); + errorCode = ZstackSreqErrorCode.valueOf(deserializer.deserializeUInt8()); + reqCmd0 = deserializer.deserializeUInt8(); + reqCmd1 = deserializer.deserializeUInt8(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java index 7371636588..44094589c8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x06); // Serialize the fields - serializeUInt8(param); + serializer.serializeUInt8(param); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java index b76aec286c..754f0781c4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java @@ -40,8 +40,8 @@ public ZstackZbGetDeviceInfoSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - param = deserializeUInt8(); - value = deserializeUInt16(); + param = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt16(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java index d81384ce5e..5f634a02f6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x04); // Serialize the fields - serializeUInt8(configId.getKey()); + serializer.serializeUInt8(configId.getKey()); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java index 1cb2a10e9f..e17fa2c3c4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java @@ -47,10 +47,10 @@ public ZstackZbReadConfigurationSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - configId = ZstackConfigId.valueOf(deserializeUInt8()); - int len = deserializeUInt8(); - value = deserializeUInt8Array(len); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + configId = ZstackConfigId.valueOf(deserializer.deserializeUInt8()); + int len = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(len); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java index 84220da68f..c46a281e6d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java @@ -86,9 +86,9 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x05); // Serialize the fields - serializeUInt8(configId.getKey()); - serializeUInt8(value.length); - serializeUInt8Array(value); + serializer.serializeUInt8(configId.getKey()); + serializer.serializeUInt8(value.length); + serializer.serializeUInt8Array(value); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java index e3ba4423e2..65055010ad 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java @@ -36,7 +36,7 @@ public ZstackZbWriteConfigurationSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java index b39ae5818a..f10c485932 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -52,11 +52,11 @@ public ZstackSbHandshakeCmdSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - bootloaderRevision = deserializeUInt32(); - deviceType = deserializeUInt8(); - bufferLength = deserializeUInt32(); - pageSize = deserializeUInt32(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + bootloaderRevision = deserializer.deserializeUInt32(); + deviceType = deserializer.deserializeUInt8(); + bufferLength = deserializer.deserializeUInt32(); + pageSize = deserializer.deserializeUInt32(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java index 552b14b61d..4ac9970054 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java @@ -60,8 +60,8 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x00); // Serialize the fields - serializeUInt32(payload.length); - serializeUInt8Array(payload); + serializer.serializeUInt32(payload.length); + serializer.serializeUInt8Array(payload); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java index c67e37a891..13e9e6bca6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java @@ -34,7 +34,7 @@ public ZstackSbWriteCmdSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index 9ddc3571cc..f778aace06 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -454,7 +454,7 @@ public enum ZstackConfigId { ZCD_NV_USERDESC(0x0081), /** - * This holds the value of nwkActiveKeyItems struct and restores the NWK key counter after power cycles. + * This holds the value of nwkActiveKeyItems structure and restores the NWK key counter after power cycles. */ ZCD_NV_NWKKEY(0x0082), diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java index ca1482765c..2c8e335ccd 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -36,7 +36,7 @@ public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - extAddress = deserializeIeeeAddress(); + extAddress = deserializer.deserializeIeeeAddress(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java index 1a9fdc51f7..bbb4b17728 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java @@ -86,8 +86,8 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x08); // Serialize the fields - serializeUInt8(id.getKey()); - serializeUInt8(offset); + serializer.serializeUInt8(id.getKey()); + serializer.serializeUInt8(offset); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java index bd9a6ad708..77b667f89a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java @@ -42,9 +42,9 @@ public ZstackSysOsalNvReadSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - int len = deserializeUInt8(); - value = deserializeUInt8Array(len); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + int len = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(len); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java index f825079c44..090a4421f6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java @@ -109,10 +109,10 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x09); // Serialize the fields - serializeUInt8(id.getKey()); - serializeUInt8(offset); - serializeUInt8(value.length); - serializeUInt8Array(value); + serializer.serializeUInt8(id.getKey()); + serializer.serializeUInt8(offset); + serializer.serializeUInt8(value.length); + serializer.serializeUInt8Array(value); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java index 15f481f777..b06ba01548 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java @@ -37,7 +37,7 @@ public ZstackSysOsalNvWriteSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java index 81349e4d8e..23041e9586 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java @@ -35,7 +35,7 @@ public ZstackSysPingSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - capabilities = deserializeUInt16(); + capabilities = deserializer.deserializeUInt16(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java index dd5e456a3b..8d9840c5e7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java @@ -58,12 +58,12 @@ public ZstackSysResetIndAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - reason = ZstackResetReason.valueOf(deserializeUInt8()); - transportRev = deserializeUInt8(); - product = deserializeUInt8(); - majorRel = deserializeUInt8(); - minorRel = deserializeUInt8(); - hwRev = deserializeUInt8(); + reason = ZstackResetReason.valueOf(deserializer.deserializeUInt8()); + transportRev = deserializer.deserializeUInt8(); + product = deserializer.deserializeUInt8(); + majorRel = deserializer.deserializeUInt8(); + minorRel = deserializer.deserializeUInt8(); + hwRev = deserializer.deserializeUInt8(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java index 49a4916f72..5b3e747a42 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java @@ -59,7 +59,7 @@ public int[] serialize() { serializeHeader(ZSTACK_ACMD, ZSTACK_SYS, 0x00); // Serialize the fields - serializeUInt8(type.getKey()); + serializer.serializeUInt8(type.getKey()); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java index 466a9a7b73..39cfed944f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x03); // Serialize the fields - serializeIeeeAddress(extAddress); + serializer.serializeIeeeAddress(extAddress); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java index ed1234a277..fadf08c210 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java @@ -36,7 +36,7 @@ public ZstackSysSetExtAddrSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java index 0fe0b7f88e..4f821e9732 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x14); // Serialize the fields - serializeUInt8(txPower); + serializer.serializeUInt8(txPower); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java index e8110bdf77..bc5e473525 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -36,7 +36,7 @@ public ZstackSysSetTxPowerSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - txPower = deserializeUInt8(); + txPower = deserializer.deserializeUInt8(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java index 10c5cc9754..69728fbd41 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java @@ -55,11 +55,11 @@ public ZstackSysVersionSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - transportRev = deserializeUInt8(); - product = deserializeUInt8(); - majorRel = deserializeUInt8(); - minorRel = deserializeUInt8(); - maintRel = deserializeUInt8(); + transportRev = deserializer.deserializeUInt8(); + product = deserializer.deserializeUInt8(); + majorRel = deserializer.deserializeUInt8(); + minorRel = deserializer.deserializeUInt8(); + maintRel = deserializer.deserializeUInt8(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java index be65c74ca1..3f51f6d98e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x18); // Serialize the fields - serializeBoolean(clearNv); + serializer.serializeBoolean(clearNv); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java index b22b95aab4..eeea7e39c7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java @@ -36,7 +36,7 @@ public ZstackSysZdiagsClearStatsSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - sysClock = deserializeUInt32(); + sysClock = deserializer.deserializeUInt32(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java index 88b2395641..91e27c8598 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x19); // Serialize the fields - serializeUInt16(attributeId.getKey()); + serializer.serializeUInt16(attributeId.getKey()); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java index 4fbfc57946..8354040f0b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java @@ -35,7 +35,7 @@ public ZstackSysZdiagsGetStatsSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - attributeValue = deserializeUInt32(); + attributeValue = deserializer.deserializeUInt32(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java index 191d5ec12f..5b0e84bd56 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java @@ -36,7 +36,7 @@ public ZstackSysZdiagsInitStatsSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java index 03863d237b..c60a2f76b3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1A); // Serialize the fields - serializeUInt16(attributeId.getKey()); + serializer.serializeUInt16(attributeId.getKey()); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java index 413710577f..ca1ebdf4ae 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java @@ -36,7 +36,7 @@ public ZstackSysZdiagsRestoreStatsNvSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java index 7279fcede2..4a9bd13404 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java @@ -35,7 +35,7 @@ public ZstackSysZdiagsSaveStatsToNvSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - sysClock = deserializeUInt32(); + sysClock = deserializer.deserializeUInt32(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java index 94d4221f8d..ffc14c095c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x44); // Serialize the fields - serializeIeeeAddress(extAddr); + serializer.serializeIeeeAddress(extAddr); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java index ed226a22e8..8bd2c98126 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java @@ -52,10 +52,10 @@ public ZstackUtilApsmeLinkKeyDataGetSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - secKey = deserializeZigBeeKey(); - txFrmCntr = deserializeUInt32(); - rxFrmCntr = deserializeUInt32(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + secKey = deserializer.deserializeZigBeeKey(); + txFrmCntr = deserializer.deserializeUInt32(); + rxFrmCntr = deserializer.deserializeUInt32(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java index b658b16c33..27c9b68e24 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x45); // Serialize the fields - serializeIeeeAddress(extAddr); + serializer.serializeIeeeAddress(extAddr); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java index bec07011e3..e0f51b8f78 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java @@ -41,8 +41,8 @@ public ZstackUtilApsmeLinkKeyNvIdGetSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - linkKeyNvId = deserializeUInt16(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + linkKeyNvId = deserializer.deserializeUInt16(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java index 2918e74420..8353cf4609 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java @@ -65,13 +65,13 @@ public ZstackUtilGetDeviceInfoSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - ieeeAddress = deserializeIeeeAddress(); - shortAddr = deserializeUInt16(); - deviceType = deserializeUInt8(); - deviceState = ZstackZdoState.valueOf(deserializeUInt8()); - int numAssocDevices = deserializeUInt8(); - assocDevicesList = deserializeUInt16Array(numAssocDevices); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + ieeeAddress = deserializer.deserializeIeeeAddress(); + shortAddr = deserializer.deserializeUInt16(); + deviceType = deserializer.deserializeUInt8(); + deviceState = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); + int numAssocDevices = deserializer.deserializeUInt8(); + assocDevicesList = deserializer.deserializeUInt16Array(numAssocDevices); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java index 254d467486..d20e973c5b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java @@ -64,12 +64,12 @@ public ZstackUtilGetNvInfoSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = deserializeUInt8(); - ieeeAddress = deserializeIeeeAddress(); - scanChannels = deserializeUInt32(); - panId = deserializeUInt16(); - securityLevel = deserializeUInt8(); - preConfigKey = deserializeZigBeeKey(); + status = deserializer.deserializeUInt8(); + ieeeAddress = deserializer.deserializeIeeeAddress(); + scanChannels = deserializer.deserializeUInt32(); + panId = deserializer.deserializeUInt16(); + securityLevel = deserializer.deserializeUInt8(); + preConfigKey = deserializer.deserializeZigBeeKey(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java index 63e5098e4e..214582fc99 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java @@ -85,8 +85,8 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x09); // Serialize the fields - serializeUInt8(ledId); - serializeBoolean(mode); + serializer.serializeUInt8(ledId); + serializer.serializeBoolean(mode); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java index 8145e54c29..17c511ab1c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java @@ -36,7 +36,7 @@ public ZstackUtilLedControlSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java index e328816599..eb25e1dfb7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x03); // Serialize the fields - serializeUInt32(channels); + serializer.serializeUInt32(channels); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java index 33d70b93e6..0655c5176e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java @@ -37,7 +37,7 @@ public ZstackUtilSetChannelsSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java index 8859b64be4..608fde1050 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x02); // Serialize the fields - serializeUInt16(panId); + serializer.serializeUInt16(panId); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java index 3d96344bcf..d8da673aa6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java @@ -36,7 +36,7 @@ public ZstackUtilSetPanidSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java index aa7e1b9446..2623dcc139 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java @@ -64,7 +64,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x05); // Serialize the fields - serializeZigBeeKey(preCfgKey); + serializer.serializeZigBeeKey(preCfgKey); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java index 1ae29d2201..50b489517b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java @@ -37,7 +37,7 @@ public ZstackUtilSetPrecfgkeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java index d4826d6fa5..417f4d0cd5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x04); // Serialize the fields - serializeUInt8(secLevel); + serializer.serializeUInt8(secLevel); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java index aa8e827678..39e8f10e60 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java @@ -37,7 +37,7 @@ public ZstackUtilSetSeclevelSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java index 8058a1fadf..830a75229e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x25); // Serialize the fields - serializeIeeeAddress(ieeeAddr); + serializer.serializeIeeeAddress(ieeeAddr); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java index 9336f9720c..3ed21a4b50 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -48,9 +48,9 @@ public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); - ieeeAddr = deserializeIeeeAddress(); - linkKeyData = deserializeZigBeeKey(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + ieeeAddr = deserializer.deserializeIeeeAddress(); + linkKeyData = deserializer.deserializeZigBeeKey(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java index c2ff3c50b1..d2335174dd 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java @@ -54,11 +54,11 @@ public ZstackZdoLeaveIndAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - srcAddr = deserializeUInt16(); - extAddr = deserializeIeeeAddress(); - request = deserializeBoolean(); - remove = deserializeBoolean(); - rejoin = deserializeBoolean(); + srcAddr = deserializer.deserializeUInt16(); + extAddr = deserializer.deserializeIeeeAddress(); + request = deserializer.deserializeBoolean(); + remove = deserializer.deserializeBoolean(); + rejoin = deserializer.deserializeBoolean(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java index aadbab059e..bcf9fc7bd1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -63,13 +63,13 @@ public ZstackZdoMsgCbIncomingAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - srcAddr = deserializeUInt16(); - wasBroadcast = deserializeBoolean(); - clusterId = deserializeUInt16(); - securityUse = deserializeBoolean(); - seqNumber = deserializeUInt8(); - dstAddr = deserializeUInt16(); - data = deserializeUInt8Array(); + srcAddr = deserializer.deserializeUInt16(); + wasBroadcast = deserializer.deserializeBoolean(); + clusterId = deserializer.deserializeUInt16(); + securityUse = deserializer.deserializeBoolean(); + seqNumber = deserializer.deserializeUInt8(); + dstAddr = deserializer.deserializeUInt16(); + data = deserializer.deserializeUInt8Array(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java index 28b2608cd6..0807e2662c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x3E); // Serialize the fields - serializeUInt16(clusterId); + serializer.serializeUInt16(clusterId); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java index e61d04b17a..a092446b13 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -36,7 +36,7 @@ public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java index cd7d432007..5a2106eb18 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java @@ -85,8 +85,8 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x26); // Serialize the fields - serializeUInt32(scanChannels); - serializeUInt8(scanDuration); + serializer.serializeUInt32(scanChannels); + serializer.serializeUInt8(scanDuration); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java index 65bc22b997..0375e74602 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java @@ -39,7 +39,7 @@ public ZstackZdoNwkDiscoveryReqSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java index 449e4482db..34e5da8b74 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x24); // Serialize the fields - serializeIeeeAddress(ieeeAddr); + serializer.serializeIeeeAddress(ieeeAddr); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java index 2fd7176b79..e99f6c0d6b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -36,7 +36,7 @@ public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java index ddf377dac0..0bbc3018fc 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java @@ -110,9 +110,9 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x23); // Serialize the fields - serializeUInt16(shortAddr); - serializeIeeeAddress(ieeeAddr); - serializeZigBeeKey(linkKeyData); + serializer.serializeUInt16(shortAddr); + serializer.serializeIeeeAddress(ieeeAddr); + serializer.serializeZigBeeKey(linkKeyData); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java index 1a0b36bb2b..919773d731 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -36,7 +36,7 @@ public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java index 2e4d089337..9cb6d76a37 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java @@ -62,7 +62,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x40); // Serialize the fields - serializeUInt16(startDelay); + serializer.serializeUInt16(startDelay); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java index d04c6c219e..7dc08b9a08 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java @@ -36,7 +36,7 @@ public ZstackZdoStartupFromAppSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializeUInt8()); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java index 10aef95203..789c9af0c2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java @@ -34,7 +34,7 @@ public ZstackZdoStateChangeIndAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - state = ZstackZdoState.valueOf(deserializeUInt8()); + state = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java index d50c592760..9dd6cd5cf0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java @@ -45,9 +45,9 @@ public ZstackZdoTcDevIndAreq(int[] inputBuffer) { super(inputBuffer); // Deserialize the fields - srcAddr = deserializeUInt16(); - extAddr = deserializeIeeeAddress(); - parentAddr = deserializeUInt16(); + srcAddr = deserializer.deserializeUInt16(); + extAddr = deserializer.deserializeIeeeAddress(); + parentAddr = deserializer.deserializeUInt16(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java new file mode 100644 index 0000000000..ead692a8a6 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.serializer; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackDeserializer { + private int[] buffer; + private int position; + + public ZstackDeserializer(int[] inputBuffer) { + buffer = inputBuffer; + position = 0; + } + + public int deserializeUInt8() { + return buffer[position++]; + } + + public int deserializeUInt16() { + return buffer[position++] + (buffer[position++] << 8); + } + + public int deserializeUInt32() { + return buffer[position++] + (buffer[position++] << 8) + (buffer[position++] << 16) + (buffer[position++] << 24); + } + + public boolean deserializeBoolean() { + return buffer[position++] != 0; + } + + public IeeeAddress deserializeIeeeAddress() { + int address[] = new int[8]; + for (int cnt = 0; cnt < 8; cnt++) { + address[cnt] = buffer[position++]; + } + return new IeeeAddress(address); + } + + public int[] deserializeUInt8Array() { + return deserializeUInt8Array(buffer.length - position); + } + + public int[] deserializeUInt8Array(int len) { + int[] array = new int[len]; + + for (int cnt = 0; cnt < len; cnt++) { + array[cnt] = deserializeUInt8(); + } + + return array; + } + + public int[] deserializeUInt16Array(int len) { + int[] array = new int[len]; + + for (int cnt = 0; cnt < len; cnt++) { + array[cnt] = deserializeUInt16(); + } + + return array; + } + + public ZigBeeKey deserializeZigBeeKey() { + return new ZigBeeKey(deserializeUInt8Array(16)); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java new file mode 100644 index 0000000000..14f5f1a253 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.serializer; + +import java.util.Arrays; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackSerializer { + private int[] buffer = new int[250]; + private int length = 0; + + public void serializeUInt8(int uint8) { + buffer[length++] = uint8 & 0xFF; + } + + public void serializeUInt16(int uint16) { + buffer[length++] = uint16 & 0xFF; + buffer[length++] = (uint16 >> 8) & 0xFF; + } + + public void serializeUInt32(int uint32) { + buffer[length++] = uint32 & 0xFF; + buffer[length++] = (uint32 >> 8) & 0xFF; + buffer[length++] = (uint32 >> 16) & 0xFF; + buffer[length++] = (uint32 >> 24) & 0xFF; + } + + public void serializeBoolean(boolean bool) { + buffer[length++] = bool ? 1 : 0; + } + + public void serializeUInt8Array(int[] uint8Array) { + for (int val : uint8Array) { + serializeUInt8(val); + } + } + + public void serializeUInt16Array(int[] uint16Array) { + for (int val : uint16Array) { + serializeUInt16(val); + } + } + + public void serializeIeeeAddress(IeeeAddress address) { + buffer[length++] = address.getValue()[0]; + buffer[length++] = address.getValue()[1]; + buffer[length++] = address.getValue()[2]; + buffer[length++] = address.getValue()[3]; + buffer[length++] = address.getValue()[4]; + buffer[length++] = address.getValue()[5]; + buffer[length++] = address.getValue()[6]; + buffer[length++] = address.getValue()[7]; + } + + public void serializeZigBeeKey(ZigBeeKey keyData) { + serializeUInt8Array(keyData.getValue()); + } + + public int[] getBuffer() { + return Arrays.copyOfRange(buffer, 0, length); + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java index 16ad5ff508..59c5bab7ab 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java @@ -25,17 +25,19 @@ public class ZstackFrameRequestTest { @Test public void deserializeUInt16() { Request request = new Request(); - request.serializeUInt16(0x1234); + request.serializeHeader(0, 0, 0); + request.serializer.serializeUInt16(0x1234); - assertTrue(Arrays.equals(new int[] { 0xFE, 0x04, 0x00, 0x00, 0x34, 0x12, 0x22 }, request.getPayload())); + assertTrue(Arrays.equals(new int[] { 0xFE, 0x02, 0x00, 0x00, 0x34, 0x12, 0x24 }, request.getPayload())); } @Test public void serializeUInt32() { Request request = new Request(); - request.serializeUInt32(0x12345678); + request.serializeHeader(0, 0, 0); + request.serializer.serializeUInt32(0x12345678); - assertTrue(Arrays.equals(new int[] { 0xFE, 0x06, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, 0x0E }, + assertTrue(Arrays.equals(new int[] { 0xFE, 0x04, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, 0x0C }, request.getPayload())); } @@ -43,20 +45,22 @@ public void serializeUInt32() { public void serializeIeeeAddress() { Request request = new Request(); IeeeAddress address = new IeeeAddress("1234567890ABCDEF"); - request.serializeIeeeAddress(address); + request.serializeHeader(0, 0, 0); + request.serializer.serializeIeeeAddress(address); assertTrue(Arrays.equals( - new int[] { 0xFE, 0x0A, 0x00, 0x00, 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12, 0x1B }, + new int[] { 0xFE, 0x08, 0x00, 0x00, 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12, 0x19 }, request.getPayload())); } @Test public void serializeBoolean() { Request request = new Request(); - request.serializeBoolean(false); - request.serializeBoolean(true); + request.serializeHeader(0, 0, 0); + request.serializer.serializeBoolean(false); + request.serializer.serializeBoolean(true); - assertTrue(Arrays.equals(new int[] { 0xFE, 0x04, 0x00, 0x00, 0x00, 0x01, 0x05 }, request.getPayload())); + assertTrue(Arrays.equals(new int[] { 0xFE, 0x02, 0x00, 0x00, 0x00, 0x01, 0x03 }, request.getPayload())); } class Request extends ZstackFrameRequest { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java index 77c449f3ab..3dc0f68f17 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java @@ -24,29 +24,29 @@ public class ZstackFrameResponseTest { public void deserializeUInt16() { Response response = new Response(new int[] { 0x00, 0x00, 0x34, 0x12 }); - assertEquals(0x1234, response.deserializeUInt16()); + assertEquals(0x1234, response.deserializer.deserializeUInt16()); } @Test public void deserializeUInt32() { Response response = new Response(new int[] { 0x00, 0x00, 0x78, 0x56, 0x34, 0x12 }); - assertEquals(0x12345678, response.deserializeUInt32()); + assertEquals(0x12345678, response.deserializer.deserializeUInt32()); } @Test public void deserializeBoolean() { Response response = new Response(new int[] { 0x00, 0x00, 0x00, 0x01 }); - assertEquals(false, response.deserializeBoolean()); - assertEquals(true, response.deserializeBoolean()); + assertEquals(false, response.deserializer.deserializeBoolean()); + assertEquals(true, response.deserializer.deserializeBoolean()); } @Test public void deserializeIeeeAddress() { Response response = new Response(new int[] { 0x00, 0x00, 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12 }); - assertEquals(new IeeeAddress("1234567890ABCDEF"), response.deserializeIeeeAddress()); + assertEquals(new IeeeAddress("1234567890ABCDEF"), response.deserializer.deserializeIeeeAddress()); } class Response extends ZstackFrameResponse { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java index 008d918e9b..afdae47191 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java @@ -13,6 +13,7 @@ import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; /** * @@ -32,7 +33,7 @@ public void test() { assertEquals(1, res.getDeviceType()); assertEquals(0, res.getShortAddr()); assertEquals(new IeeeAddress("00124B0002F1D414"), res.getIeeeAddress()); - assertEquals(ZstackDeviceState.UNINITIALIZED, res.getDeviceState()); + assertEquals(ZstackZdoState.DEV_HOLD, res.getDeviceState()); assertEquals(4, res.getAssocDevicesList().length); assertEquals(0x35FC, res.getAssocDevicesList()[0]); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java new file mode 100644 index 0000000000..d5d37e7d42 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.serializer; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.IeeeAddress; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackDeserializerTest { + + @Test + public void deserializeUInt16() { + ZstackDeserializer response = new ZstackDeserializer(new int[] { 0x34, 0x12 }); + + assertEquals(0x1234, response.deserializeUInt16()); + } + + @Test + public void deserializeUInt32() { + ZstackDeserializer response = new ZstackDeserializer(new int[] { 0x78, 0x56, 0x34, 0x12 }); + + assertEquals(0x12345678, response.deserializeUInt32()); + } + + @Test + public void deserializeBoolean() { + ZstackDeserializer response = new ZstackDeserializer(new int[] { 0x00, 0x01 }); + + assertEquals(false, response.deserializeBoolean()); + assertEquals(true, response.deserializeBoolean()); + } + + @Test + public void deserializeIeeeAddress() { + ZstackDeserializer response = new ZstackDeserializer( + new int[] { 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12 }); + + assertEquals(new IeeeAddress("1234567890ABCDEF"), response.deserializeIeeeAddress()); + } + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java new file mode 100644 index 0000000000..b4c82c6325 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.internal.serializer; + +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; + +import com.zsmartsystems.zigbee.IeeeAddress; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackSerializerTest { + + @Test + public void deserializeUInt16() { + ZstackSerializer request = new ZstackSerializer(); + request.serializeUInt16(0x1234); + + assertTrue(Arrays.equals(new int[] { 0x34, 0x12 }, request.getBuffer())); + } + + @Test + public void serializeUInt32() { + ZstackSerializer request = new ZstackSerializer(); + request.serializeUInt32(0x12345678); + + assertTrue(Arrays.equals(new int[] { 0x78, 0x56, 0x34, 0x12 }, request.getBuffer())); + } + + @Test + public void serializeIeeeAddress() { + ZstackSerializer request = new ZstackSerializer(); + IeeeAddress address = new IeeeAddress("1234567890ABCDEF"); + request.serializeIeeeAddress(address); + + assertTrue(Arrays.equals(new int[] { 0xEF, 0xCD, 0xAB, 0x90, 0x78, 0x56, 0x34, 0x12 }, request.getBuffer())); + } + + @Test + public void serializeBoolean() { + ZstackSerializer request = new ZstackSerializer(); + request.serializeBoolean(false); + request.serializeBoolean(true); + + assertTrue(Arrays.equals(new int[] { 0x00, 0x01 }, request.getBuffer())); + } +} From 367a18af61c0283d6220c4cd5854cd78fb8467d7 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Mon, 22 Apr 2019 18:49:37 +0100 Subject: [PATCH 03/33] Update CLI commands to get more visibility of stack Signed-off-by: Chris Jackson --- .../zstack/ZstackConsoleAbstractCommand.java | 22 ++ .../ZstackConsoleNcpSecurityCommand.java | 33 +- .../zstack/ZstackConsoleNcpStateCommand.java | 5 +- .../zstack/autocode/CommandGenerator.java | 285 +++++++++++++++++- .../src/main/resources/zstack_protocol.xml | 72 ++++- .../dongle/zstack/ZigBeeDongleZstack.java | 10 +- .../dongle/zstack/api/ZstackFrameFactory.java | 4 +- .../ZstackAppCnfBdbAddInstallcodeSreq.java | 4 +- ...stackAppCnfSetAllowrejoinTcPolicySreq.java | 4 +- .../appcnf/ZstackAuthenticationOption.java | 82 +++++ .../dongle/zstack/api/sys/ZstackConfigId.java | 22 +- .../zstack/api/sys/ZstackNwkKeyDesc.java | 100 ++++++ .../zstack/api/sys/ZstackSecMgrEntry.java | 128 ++++++++ .../internal/ZstackNetworkInitialisation.java | 17 +- .../dongle/zstack/ZigBeeDongleZstackTest.java | 65 ++-- 15 files changed, 785 insertions(+), 68 deletions(-) create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java index a15577c110..0b0b980635 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java @@ -51,6 +51,14 @@ protected String hex2Uint8(int[] bytes) { return Integer.valueOf(bytes[0]).toString(); } + protected String hex2Uint16(int[] bytes) { + if (bytes == null) { + return CFG_UNSUPPORTED; + } + + return Integer.valueOf(bytes[0] + (bytes[1] * 256)).toString(); + } + protected String hex2String(int[] bytes) { if (bytes == null) { return CFG_UNSUPPORTED; @@ -72,4 +80,18 @@ protected String hex2String(int[] bytes) { return null; } } + + protected String hexDump(int[] bytes) { + if (bytes == null) { + return CFG_UNSUPPORTED; + } + + StringBuilder builder = new StringBuilder(bytes.length * 3); + + for (int value : bytes) { + builder.append(String.format("%02X ", value)); + } + + return builder.toString(); + } } diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java index 6cea11313f..080854fccf 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -12,7 +12,10 @@ import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackNwkKeyDesc; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSecMgrEntry; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; /** * @@ -20,6 +23,8 @@ * */ public class ZstackConsoleNcpSecurityCommand extends ZstackConsoleAbstractCommand { + private static int INVALID_NODE_ADDR = 0xFFFE; + @Override public String getCommand() { return "ncpsecurity"; @@ -47,10 +52,18 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); int[] nwkKeyConfig = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWKKEY); - int[] apsKeyTable = ncp.readConfiguration(ZstackConfigId.ZCD_NV_APS_LINK_KEY_TABLE); int[] altKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ALTERN_KEY_INFO); int[] nwkActiveKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ACTIVE_KEY_INFO); + int[] apsKeyTable = ncp.readConfiguration(ZstackConfigId.ZCD_NV_APS_LINK_KEY_TABLE); + // apsKeyTable contains a 2 byte header which is an integer defining the number of entries + ZstackDeserializer deserializer = new ZstackDeserializer(apsKeyTable); + int apsKeyTableLen = deserializer.deserializeUInt16(); + for (int cnt = 0; cnt < apsKeyTableLen; cnt++) { + ZstackSecMgrEntry secMgrEntry = new ZstackSecMgrEntry(); + secMgrEntry.deserialize(deserializer); + } + if (nvInfo == null) { out.println("NV Device info : ERROR"); } else { @@ -60,13 +73,29 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr if (nwkKeyConfig == null) { out.println("NWK Key Info : Not Supported"); } else { + out.println("NWK Key Info : TODO: " + hexDump(nwkKeyConfig)); + } + + if (altKeyInfo != null) { + deserializer = new ZstackDeserializer(nwkActiveKeyInfo); + ZstackNwkKeyDesc nwkActiveKey = new ZstackNwkKeyDesc(); + nwkActiveKey.deserialize(deserializer); + out.println("Active NWK Key Info : Sequence=" + nwkActiveKey.getKeySeqNum() + ", Key=" + + nwkActiveKey.getKey()); + } + if (altKeyInfo != null) { + deserializer = new ZstackDeserializer(nwkActiveKeyInfo); + ZstackNwkKeyDesc altKeyDesc = new ZstackNwkKeyDesc(); + altKeyDesc.deserialize(deserializer); + out.println("Alt NWK Key Info : Sequence=" + altKeyDesc.getKeySeqNum() + ", Key=" + + altKeyDesc.getKey()); } if (apsKeyTable == null) { out.println("APS Key Info : Not Supported"); } else { - + out.println("APS Key Info : TODO: " + hexDump(apsKeyTable)); } } diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index 4df7acee86..877a541f5c 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -67,11 +67,14 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { int[] concentratorDiscovery = ncp.readConfiguration(ZstackConfigId.ZCD_NV_CONCENTRATOR_DISCOVERY); int[] routeExpiry = ncp.readConfiguration(ZstackConfigId.ZCD_NV_ROUTE_EXPIRY_TIME); int[] stackProfile = ncp.readConfiguration(ZstackConfigId.ZCD_NV_STACK_PROFILE); + int[] tcAddress = ncp.readConfiguration(ZstackConfigId.ZCD_NV_TRUSTCENTER_ADDR); out.println("User Description : " + hex2String(userDesc)); out.println("BDB Device On Network : " + hex2Boolean(bdbDeviceOnNwk)); out.println("Stack Profile : " + hex2Uint8(stackProfile)); - out.println("Route Expiry : " + hex2Uint8(routeExpiry)); + out.println("Trust Centre Address : " + hex2Uint8(routeExpiry)); + + out.println("Route Expiry : " + hex2Uint16(tcAddress)); out.println("Concentrator Enabled : " + hex2Boolean(concentratorEnable)); out.println("Concentrator Radius : " + hex2Uint8(concentratorRadius)); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 652246c6a9..25d0138965 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -31,6 +31,7 @@ */ public class CommandGenerator extends ClassGenerator { protected final String zssPackage = "com.zsmartsystems.zigbee"; + protected final String zstackInternalPackage = "com.zsmartsystems.zigbee.dongle.zstack.internal"; protected final String zstackCommandPackage = "com.zsmartsystems.zigbee.dongle.zstack.api"; private List enumerations; @@ -63,7 +64,7 @@ public void go(Protocol protocol) throws FileNotFoundException { createZstackFrameFactory(protocol); for (Structure structure : protocol.structures) { - // createStructureClass(structure); + createStructureClass(structure); } for (Enumeration enumeration : protocol.enumerations) { @@ -391,6 +392,288 @@ private void createCommandClass(String className, Command command, List" + structure.name + "."); + out.println(" *

"); + if (structure.description != null && !structure.description.isEmpty()) { + outputWithLinebreak(out, "", structure.description); + out.println(" *

"); + } + out.println(" * Note that this code is autogenerated. Manual changes may be overwritten."); + out.println(" *"); + out.println(" * @author Chris Jackson"); + out.println(" */"); + + addImport(zstackInternalPackage + ".serializer.ZstackSerializer"); + addImport(zstackInternalPackage + ".serializer.ZstackDeserializer"); + out.println("public class " + className + " {"); + + for (Parameter parameter : structure.parameters) { + if (parameter.auto_size != null) { + continue; + } + + out.println(); + out.println(" /**"); + if (parameter.description != null && !parameter.description.isEmpty()) { + outputWithLinebreak(out, " ", parameter.description); + } + if (parameter.multiple) { + out.println(" *

"); + out.println(" * Parameter allows multiple options so implemented as a {@link Set}."); + } + out.println(" */"); + if (parameter.multiple) { + addImport("java.util.Set"); + addImport("java.util.HashSet"); + out.println(" private Set<" + getTypeClass(structure.subsystem, parameter.data_type) + "> " + + camelCaseToLowerCamelCase(parameter.name) + " = new HashSet<>();"); + } else { + out.println(" private " + getTypeClass(structure.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ";"); + } + + // out.println(" private " + getTypeClass(command.subsystem, parameter.data_type) + " " + // + camelCaseToLowerCamelCase(parameter.name) + ";"); + } + + for (Parameter parameter : structure.parameters) { + if (parameter.auto_size != null) { + continue; + } + + out.println(); + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + if (parameter.multiple) { + out.println(" * @return the current " + camelCaseToLowerCamelCase(parameter.name) + + " as {@link Set} of {@link " + getTypeClass(structure.subsystem, parameter.data_type) + "}"); + } else { + out.println(" * @return the current " + camelCaseToLowerCamelCase(parameter.name) + " as {@link " + + getTypeClass(structure.subsystem, parameter.data_type) + "}"); + } + out.println(" */"); + if (parameter.multiple) { + out.println(" public Set<" + getTypeClass(structure.subsystem, parameter.data_type) + "> get" + + upperCaseFirstCharacter(parameter.name) + "() {"); + } else { + out.println(" public " + getTypeClass(structure.subsystem, parameter.data_type) + " get" + + upperCaseFirstCharacter(parameter.name) + "() {"); + } + + out.println(" return " + camelCaseToLowerCamelCase(parameter.name) + ";"); + out.println(" }"); + out.println(); + + if (parameter.multiple) { + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to add to the {@link Set} as {@link " + + getTypeClass(structure.subsystem, parameter.data_type) + "}"); + out.println(" */"); + out.println(" public void add" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(structure.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + ".add(" + + camelCaseToLowerCamelCase(parameter.name) + ");"); + out.println(" }"); + out.println(); + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to remove to the {@link Set} as {@link " + + getTypeClass(structure.subsystem, parameter.data_type) + "}"); + out.println(" */"); + out.println(" public void remove" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(structure.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + ".remove(" + + camelCaseToLowerCamelCase(parameter.name) + ");"); + out.println(" }"); + } else { + out.println(" /**"); + outputWithLinebreak(out, " ", parameter.description); + out.println(" *"); + out.println(" * @param " + camelCaseToLowerCamelCase(parameter.name) + " the " + parameter.name + + " to set as {@link " + getTypeClass(structure.subsystem, parameter.data_type) + "}"); + out.println(" */"); + out.println(" public void set" + upperCaseFirstCharacter(parameter.name) + "(" + + getTypeClass(structure.subsystem, parameter.data_type) + " " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" this." + camelCaseToLowerCamelCase(parameter.name) + " = " + + camelCaseToLowerCamelCase(parameter.name) + ";"); + out.println(" }"); + } + } + + out.println(); + out.println(" /**"); + out.println(" * Serialize the data from this structure class to an integer array"); + out.println(" *"); + out.println(" * @param serializer the {@link ZstackSerializer} to use"); + out.println(" */"); + out.println(" public int[] serialize(ZstackSerializer serializer) {"); + out.println(" // Serialize the fields"); + for (Parameter parameter : structure.parameters) { + String enumModifier = ""; + if (getDataType(parameter.data_type) != parameter.data_type) { + enumModifier = ".getKey()"; + } + if (parameter.auto_size != null) { + out.println(" serializer.serialize" + getTypeSerializer(structure.subsystem, parameter.data_type) + + "(" + camelCaseToLowerCamelCase(parameter.auto_size) + ".length);"); + continue; + } + if (parameter.multiple) { + out.println(" " + getTypeClass(structure.subsystem, getDataType(parameter.data_type)) + " tmp" + + upperCaseFirstCharacter(parameter.name) + " = 0;"); + out.println(" for (" + getTypeClass(parameter.data_type) + " value : " + + camelCaseToLowerCamelCase(parameter.name) + ") {"); + out.println(" tmp" + upperCaseFirstCharacter(parameter.name) + " += value.getKey();"); + out.println(" }"); + out.println(" serializer.serialize" + getTypeSerializer(structure.subsystem, parameter.data_type) + + "(" + "tmp" + upperCaseFirstCharacter(parameter.name) + ");"); + } else { + out.println(" serializer.serialize" + getTypeSerializer(structure.subsystem, parameter.data_type) + + "(" + camelCaseToLowerCamelCase(parameter.name) + enumModifier + ");"); + } + } + out.println(" return serializer.getBuffer();"); + out.println(" }"); + + out.println(); + out.println(" /**"); + out.println(" * Deserialize the data into this structure class"); + out.println(" *"); + out.println(" * @param deserializer the {@link ZstackDeserializer} to use"); + out.println(" */"); + out.println(" public void deserialize (ZstackDeserializer deserializer) {"); + out.println(" // Deserialize the fields"); + Map autoSizers = new HashMap(); + for (Parameter parameter : structure.parameters) { + if (parameter.auto_size != null) { + out.println(" int " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "();"); + autoSizers.put(parameter.auto_size, camelCaseToLowerCamelCase(parameter.name)); + continue; + } + if (autoSizers.get(parameter.name) != null) { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "(" + + autoSizers.get(parameter.name) + ");"); + continue; + } + if (parameter.data_type.contains("[") && parameter.data_type.contains("]") + && !parameter.data_type.contains("[]")) { + int length = Integer.parseInt(parameter.data_type.substring(parameter.data_type.indexOf("[") + 1, + parameter.data_type.indexOf("]"))); + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "(" + length + ");"); + continue; + } + if (getDataType(parameter.data_type) != parameter.data_type) { + if (parameter.multiple) { + out.println(" " + getTypeClass(structure.subsystem, getDataType(parameter.data_type)) + + " tmp" + upperCaseFirstCharacter(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "();"); + out.println(" for (" + getTypeClass(parameter.data_type) + " value : " + + getTypeClass(parameter.data_type) + ".values()) {"); + out.println(" if ((tmp" + upperCaseFirstCharacter(parameter.name) + + " & value.getKey()) != 0) {"); + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + ".add(value);"); + out.println(" }"); + out.println(" }"); + } else { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = " + parameter.data_type + + ".valueOf(deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "());"); + } + } else { + out.println(" " + camelCaseToLowerCamelCase(parameter.name) + " = deserializer.deserialize" + + getTypeSerializer(structure.subsystem, parameter.data_type) + "();"); + } + } + out.println(" }"); + + out.println(); + out.println(" @Override"); + out.println(" public String toString() {"); + + if (structure.parameters == null || structure.parameters.size() == 0) { + out.println(" return \"" + className + " []\";"); + } else { + out.println(" final StringBuilder builder = new StringBuilder(" + + (className.length() + 3 + structure.parameters.size() * 25) + ");"); + boolean first = true; + for (Parameter parameter : structure.parameters) { + if (parameter.auto_size != null) { + continue; + } + + if (first) { + out.println(" builder.append(\"" + className + " [" + + camelCaseToLowerCamelCase(parameter.name) + "=\");"); + } else { + out.println(" builder.append(\", " + camelCaseToLowerCamelCase(parameter.name) + "=\");"); + } + first = false; + if (parameter.data_type.contains("[")) { + out.println(" for (int c = 0; c < " + camelCaseToLowerCamelCase(parameter.name) + + ".length; c++) {"); + out.println(" if (c > 0) {"); + out.println(" builder.append(' ');"); + out.println(" }"); + out.println(" builder.append(String.format(\"%02X\", " + formatParameterString(parameter) + + "[c]));"); + out.println(" }"); + } else { + out.println(" builder.append(" + formatParameterString(parameter) + ");"); + } + } + out.println(" builder.append(']');"); + out.println(" return builder.toString();"); + } + out.println(" }"); + + out.println("}"); + + out.flush(); + + String cmdPackage = zstackCommandPackage + "." + structure.subsystem.toLowerCase().replace("_", ""); + File packageFile = new File(sourceRootPath + cmdPackage.replace(".", "/")); + packageFile.mkdirs(); + PrintWriter outFile = getClassOut(packageFile, className); + + outputCopywrite(outFile); + outFile.println("package " + cmdPackage + ";"); + + outFile.println(); + + outputImports(outFile); + + outFile.println(); + outFile.print(stringWriter.toString()); + + outFile.flush(); + outFile.close(); + + out.close(); + } + private void createEnumClass(Enumeration enumeration) throws FileNotFoundException { String className = upperCaseFirstCharacter(enumeration.name); System.out.println("Processing enum class " + enumeration.name + " [" + className + "()]"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 4799d5f6f8..bdc739c64c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -1500,7 +1500,7 @@ APP_CNF_SET_ALLOWREJOIN_TC_POLICY APP_CNF - 0x02 + 0x03 Sets the AllowRejoin TC policy. SYNC @@ -1522,7 +1522,7 @@ APP_CNF_BDB_ADD_INSTALLCODE APP_CNF - 0x02 + 0x04 Add a preconfigured key (plain key or IC) to Trust Center device. SYNC @@ -2406,6 +2406,26 @@ 0x00D2 + + ZCD_NV_TCLK_TABLE_START + 0x0101 + + + + ZCD_NV_TCLK_TABLE_END + 0x01FF + + + + ZCD_NV_APS_LINK_KEY_DATA_START + 0x0201 + + + + ZCD_NV_APS_LINK_KEY_DATA_END + 0x02FF + + @@ -3025,7 +3045,30 @@ - + + ZstackAuthenticationOption + uint8 + + APP_CNF + + + Not_Authenticated + 0x0000 + The device has not been authenticated + + + Authenticated_CBCK + 0x0001 + The device has been authenticated using CBKE + + + Authenticated_EA + 0x0002 + The device has been authenticated using EA + + + + ZstackNwkKeyDesc SYS @@ -3044,4 +3087,27 @@ + + ZstackSecMgrEntry + SYS + + + + uint16 + ami + Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + + + uint16 + keyNvId + Index to the Link Key table in NV + + + ZstackAuthenticationOption + authenticateOption + + + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index fd0e739667..701e3e2a48 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -38,6 +38,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; @@ -400,7 +401,7 @@ public void run() { return; } // Don't wait for the response. This is running in a single thread scheduler - // frameHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); + frameHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); } }, pollRate, pollRate, TimeUnit.MILLISECONDS); } @@ -627,11 +628,8 @@ public void handleLinkStateChange(final boolean linkState) { @Override public void run() { if (linkState) { - // ZstackNcp ncp = getEmberNcp(); - // int addr = ncp.getNwkAddress(); - // if (addr != 0xFFFE) { - // nwkAddress = addr; - // } + ZstackNcp ncp = getZstackNcp(); + nwkAddress = ncp.getNwkAddress(); } // Handle link changes and notify framework zigbeeTransportReceive diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java index 78b92e9789..8a45c3e40e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -99,12 +99,12 @@ public class ZstackFrameFactory { private static final int AF_DATA_REQUEST = 0x01; private static final int AF_INCOMING_MSG = 0x81; private static final int AF_REGISTER = 0x00; - private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x02; + private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x04; private static final int APP_CNF_BDB_COMMISSIONING_NOTIFICATION = 0x80; private static final int APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY = 0x07; private static final int APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY = 0x06; private static final int APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE = 0x09; - private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x02; + private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x03; private static final int MAC_SCAN_REQ = 0x0C; private static final int RPC_SREQ_ERROR = 0x00; private static final int SB_HANDSHAKE_CMD = 0x04; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java index 186452cd85..1e70d27aad 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java @@ -104,13 +104,13 @@ public void setInstallCode(ZigBeeKey installCode) { @Override public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x02)); + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x04)); } @Override public int[] serialize() { // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x04); // Serialize the fields serializer.serializeUInt8(installCodeFormat.getKey()); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java index ecc7da12bf..6206c9c111 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java @@ -53,13 +53,13 @@ public void setAllowRejoin(boolean allowRejoin) { @Override public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x02)); + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x03)); } @Override public int[] serialize() { // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x02); + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x03); // Serialize the fields serializer.serializeBoolean(allowRejoin); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java new file mode 100644 index 0000000000..4fc235e1cc --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackAuthenticationOption. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackAuthenticationOption { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * The device has not been authenticated + */ + NOT_AUTHENTICATED(0x0000), + + /** + * The device has been authenticated using CBKE + */ + AUTHENTICATED_CBCK(0x0001), + + /** + * The device has been authenticated using EA + */ + AUTHENTICATED_EA(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackAuthenticationOption s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackAuthenticationOption(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackAuthenticationOption valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index f778aace06..fe5bdf8393 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -592,7 +592,27 @@ public enum ZstackConfigId { /** * */ - ZCD_NV_SAS_CURR_NWK_KEY(0x00D2); + ZCD_NV_SAS_CURR_NWK_KEY(0x00D2), + + /** + * + */ + ZCD_NV_TCLK_TABLE_START(0x0101), + + /** + * + */ + ZCD_NV_TCLK_TABLE_END(0x01FF), + + /** + * + */ + ZCD_NV_APS_LINK_KEY_DATA_START(0x0201), + + /** + * + */ + ZCD_NV_APS_LINK_KEY_DATA_END(0x02FF); /** * A mapping between the integer code and its corresponding type to diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java new file mode 100644 index 0000000000..e0e3072bda --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack structure ZstackNwkKeyDesc. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackNwkKeyDesc { + + /** + */ + private int keySeqNum; + + /** + */ + private ZigBeeKey key; + + /** + * + * + * @return the current keySeqNum as {@link int} + */ + public int getKeySeqNum() { + return keySeqNum; + } + + /** + * + * + * @param keySeqNum the keySeqNum to set as {@link int} + */ + public void setKeySeqNum(int keySeqNum) { + this.keySeqNum = keySeqNum; + } + + /** + * + * + * @return the current key as {@link ZigBeeKey} + */ + public ZigBeeKey getKey() { + return key; + } + + /** + * + * + * @param key the key to set as {@link ZigBeeKey} + */ + public void setKey(ZigBeeKey key) { + this.key = key; + } + + /** + * Serialize the data from this structure class to an integer array + * + * @param serializer the {@link ZstackSerializer} to use + */ + public int[] serialize(ZstackSerializer serializer) { + // Serialize the fields + serializer.serializeUInt8(keySeqNum); + serializer.serializeZigBeeKey(key); + return serializer.getBuffer(); + } + + /** + * Deserialize the data into this structure class + * + * @param deserializer the {@link ZstackDeserializer} to use + */ + public void deserialize (ZstackDeserializer deserializer) { + // Deserialize the fields + keySeqNum = deserializer.deserializeUInt8(); + key = deserializer.deserializeZigBeeKey(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(69); + builder.append("ZstackNwkKeyDesc [keySeqNum="); + builder.append(keySeqNum); + builder.append(", key="); + builder.append(key); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java new file mode 100644 index 0000000000..40fa997450 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAuthenticationOption; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; + +/** + * Class to implement the Z-Stack structure ZstackSecMgrEntry. + *

+ * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSecMgrEntry { + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + */ + private int ami; + + /** + * Index to the Link Key table in NV + */ + private int keyNvId; + + /** + */ + private ZstackAuthenticationOption authenticateOption; + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + * + * @return the current ami as {@link int} + */ + public int getAmi() { + return ami; + } + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + * + * @param ami the ami to set as {@link int} + */ + public void setAmi(int ami) { + this.ami = ami; + } + + /** + * Index to the Link Key table in NV + * + * @return the current keyNvId as {@link int} + */ + public int getKeyNvId() { + return keyNvId; + } + + /** + * Index to the Link Key table in NV + * + * @param keyNvId the keyNvId to set as {@link int} + */ + public void setKeyNvId(int keyNvId) { + this.keyNvId = keyNvId; + } + + /** + * + * + * @return the current authenticateOption as {@link ZstackAuthenticationOption} + */ + public ZstackAuthenticationOption getAuthenticateOption() { + return authenticateOption; + } + + /** + * + * + * @param authenticateOption the authenticateOption to set as {@link ZstackAuthenticationOption} + */ + public void setAuthenticateOption(ZstackAuthenticationOption authenticateOption) { + this.authenticateOption = authenticateOption; + } + + /** + * Serialize the data from this structure class to an integer array + * + * @param serializer the {@link ZstackSerializer} to use + */ + public int[] serialize(ZstackSerializer serializer) { + // Serialize the fields + serializer.serializeUInt16(ami); + serializer.serializeUInt16(keyNvId); + serializer.serializeUInt8(authenticateOption.getKey()); + return serializer.getBuffer(); + } + + /** + * Deserialize the data into this structure class + * + * @param deserializer the {@link ZstackDeserializer} to use + */ + public void deserialize (ZstackDeserializer deserializer) { + // Deserialize the fields + ami = deserializer.deserializeUInt16(); + keyNvId = deserializer.deserializeUInt16(); + authenticateOption = ZstackAuthenticationOption.valueOf(deserializer.deserializeUInt8()); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(95); + builder.append("ZstackSecMgrEntry [ami="); + builder.append(ami); + builder.append(", keyNvId="); + builder.append(keyNvId); + builder.append(", authenticateOption="); + builder.append(authenticateOption); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index 2c7ee7927e..79842ec206 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -163,11 +163,24 @@ public ZigBeeStatus startNetwork() { ncp.setNetworkSecurity(true); - // ZCD_NV_SECURITY_LEVEL - + ncp.zdoRegisterCallback(0x0006);// MatchDescriptorRequest + ncp.zdoRegisterCallback(0x8000);// NetworkAddressResponse() { ncp.zdoRegisterCallback(0x8001);// IeeeAddressResponse() { ncp.zdoRegisterCallback(0x8002);// NodeDescriptorResponse.); ncp.zdoRegisterCallback(0x8003);// PowerDescriptorResponse + ncp.zdoRegisterCallback(0x8004);// SimpleDescriptorResponse + ncp.zdoRegisterCallback(0x8005);// ActiveEndpointsResponse + ncp.zdoRegisterCallback(0x8006);// MatchDescriptorResponse + ncp.zdoRegisterCallback(0x8011);// UserDescriptorResponse + ncp.zdoRegisterCallback(0x8013);// DeviceAnnounce + ncp.zdoRegisterCallback(0x8020);// EndDeviceBindResponse + ncp.zdoRegisterCallback(0x8021);// BindResponse + ncp.zdoRegisterCallback(0x8022);// UnbindResponse + ncp.zdoRegisterCallback(0x8031);// ManagementLqiResponse + ncp.zdoRegisterCallback(0x8032);// ManagementRoutingResponse + ncp.zdoRegisterCallback(0x8033);// ManagementBindResponse + ncp.zdoRegisterCallback(0x8034);// ManagementLeaveResponse + ncp.zdoRegisterCallback(0x8036);// ManagementPermitJoiningResponse // Now start the NCP if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index 68952be99b..f5fcc8db95 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -17,15 +17,17 @@ import org.mockito.Mockito; import com.zsmartsystems.zigbee.ExtendedPanId; -import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.TestUtilities; import com.zsmartsystems.zigbee.ZigBeeApsFrame; import com.zsmartsystems.zigbee.ZigBeeChannel; -import com.zsmartsystems.zigbee.ZigBeeNodeStatus; import com.zsmartsystems.zigbee.ZigBeeNwkAddressMode; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; import com.zsmartsystems.zigbee.transport.ZigBeePort; @@ -47,7 +49,6 @@ public void setZigBeeExtendedPanId() { ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); dongle.setZigBeeExtendedPanId(new ExtendedPanId("123456789abcdef")); - assertEquals(new ExtendedPanId("123456789abcdef"), dongle.getZigBeeExtendedPanId()); } @Test @@ -55,7 +56,6 @@ public void setZigBeePanId() { ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); dongle.setZigBeePanId(0x1234); - assertEquals(0x1234, dongle.getZigBeePanId()); } @Test @@ -74,47 +74,22 @@ public ZstackNcp getZstackNcp() { TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); - EzspStackStatusHandler response = Mockito.mock(EzspStackStatusHandler.class); - Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_BUSY); - Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)) - .setNetworkState(ArgumentMatchers.any(ZigBeeTransportState.class)); + ZstackZdoStateChangeIndAreq response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); + Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ZB_COORD); + Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)).setNetworkState(ZigBeeTransportState.ONLINE); - response = Mockito.mock(EzspStackStatusHandler.class); - Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_UP); + response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); + Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ROUTER); dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.ONLINE); assertEquals(Integer.valueOf(1243), dongle.getNwkAddress()); - response = Mockito.mock(EzspStackStatusHandler.class); - Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_DOWN); + response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); + Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_INIT); dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.OFFLINE); } - @Test - public void testEzspChildJoinHandler() throws Exception { - ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); - - final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); - Mockito.when(ncp.getNwkAddress()).thenReturn(1243); - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null) { - @Override - public ZstackNcp getZstackNcp() { - return ncp; - } - }; - dongle.setZigBeeTransportReceive(transport); - - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); - - EzspChildJoinHandler response = Mockito.mock(EzspChildJoinHandler.class); - Mockito.when(response.getChildId()).thenReturn(123); - Mockito.when(response.getChildEui64()).thenReturn(new IeeeAddress("1234567890ABCDEF")); - dongle.handlePacket(response); - Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(1)).nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, - 123, new IeeeAddress("1234567890ABCDEF")); - } - @Test public void setZigBeeChannel() { ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); @@ -122,10 +97,8 @@ public void setZigBeeChannel() { assertEquals(ZigBeeStatus.INVALID_ARGUMENTS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_03)); assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_11)); - assertEquals(ZigBeeChannel.CHANNEL_11, dongle.getZigBeeChannel()); assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_24)); - assertEquals(ZigBeeChannel.CHANNEL_24, dongle.getZigBeeChannel()); } @Test @@ -141,16 +114,16 @@ public void testEzspMessageSentHandler() throws Exception { TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", Executors.newScheduledThreadPool(1)); - EzspMessageSentHandler response = Mockito.mock(EzspMessageSentHandler.class); - Mockito.when(response.getMessageTag()).thenReturn(231); - Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_SUCCESS); + ZstackAfDataConfirmAreq response = Mockito.mock(ZstackAfDataConfirmAreq.class); + Mockito.when(response.getTransId()).thenReturn(231); + Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.SUCCESS); dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, ZigBeeTransportProgressState.RX_ACK); - response = Mockito.mock(EzspMessageSentHandler.class); - Mockito.when(response.getMessageTag()).thenReturn(231); - Mockito.when(response.getStatus()).thenReturn(EmberStatus.EMBER_NETWORK_DOWN); + response = Mockito.mock(ZstackAfDataConfirmAreq.class); + Mockito.when(response.getTransId()).thenReturn(231); + Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.FAILURE); dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, ZigBeeTransportProgressState.RX_NAK); @@ -230,13 +203,13 @@ public void scheduleNetworkStatePolling() throws Exception { Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommand", Long.MAX_VALUE - 1); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommandTime", Long.MAX_VALUE - 1); TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "networkStateUp", true); TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommand", 0); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommandTime", 0); TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).atLeast(1)) .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); From 6c584f9a1b1828567af62d363b8e269edc2e9ea4 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sun, 28 Apr 2019 22:00:32 +0100 Subject: [PATCH 04/33] Initialisation update Signed-off-by: Chris Jackson --- .../zstack/ZstackConsoleNcpStateCommand.java | 2 +- .../src/main/resources/zstack_protocol.xml | 2 +- .../dongle/zstack/ZigBeeDongleZstack.java | 69 ++++++++-------- .../zigbee/dongle/zstack/ZstackNcp.java | 80 ++++++++++++++++++- ...BdbSetActiveDefaultCentralizedKeySreq.java | 19 +++-- .../internal/ZstackNetworkInitialisation.java | 3 +- 6 files changed, 128 insertions(+), 47 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index 877a541f5c..99e672986d 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -69,7 +69,6 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { int[] stackProfile = ncp.readConfiguration(ZstackConfigId.ZCD_NV_STACK_PROFILE); int[] tcAddress = ncp.readConfiguration(ZstackConfigId.ZCD_NV_TRUSTCENTER_ADDR); - out.println("User Description : " + hex2String(userDesc)); out.println("BDB Device On Network : " + hex2Boolean(bdbDeviceOnNwk)); out.println("Stack Profile : " + hex2Uint8(stackProfile)); out.println("Trust Centre Address : " + hex2Uint8(routeExpiry)); @@ -113,6 +112,7 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { } else { out.println("NCP API Capabilities : " + ncpCapabilities); } + out.println("User Description : " + hex2String(userDesc)); } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index bdc739c64c..b39a4d1f72 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -1601,7 +1601,7 @@ - uint8 + uint8[] InstallCode Buffer with the key in any of its formats. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 701e3e2a48..2d77fcc1bd 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -26,6 +26,7 @@ import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; +import com.zsmartsystems.zigbee.ZigBeeNodeStatus; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; @@ -35,6 +36,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; @@ -43,6 +45,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackNetworkInitialisation; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; @@ -66,7 +69,6 @@ * */ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameHandler { - /** * The {@link Logger}. */ @@ -179,6 +181,7 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { // Define the default configuration stackConfiguration = new LinkedHashMap<>(); + stackConfiguration.put(ZstackConfigId.ZCD_NV_APS_ALLOW_R19_SECURITY, new int[] { 0x01 }); networkKey = new ZigBeeKey(); } @@ -525,6 +528,11 @@ public void handlePacket(ZstackCommand response) { } if (response instanceof ZstackZdoMsgCbIncomingAreq) { + // Ignore frames before we're initialised + if (nwkAddress == null) { + return; + } + ZstackZdoMsgCbIncomingAreq incomingMsg = (ZstackZdoMsgCbIncomingAreq) response; ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); apsFrame.setCluster(incomingMsg.getClusterId()); @@ -579,36 +587,13 @@ public void run() { return; } - /* - * if (response instanceof EzspTrustCenterJoinHandler) { - * EzspTrustCenterJoinHandler joinHandler = (EzspTrustCenterJoinHandler) response; - * - * ZigBeeNodeStatus status; - * switch (joinHandler.getStatus()) { - * case EMBER_HIGH_SECURITY_UNSECURED_JOIN: - * case EMBER_STANDARD_SECURITY_UNSECURED_JOIN: - * status = ZigBeeNodeStatus.UNSECURED_JOIN; - * break; - * case EMBER_HIGH_SECURITY_UNSECURED_REJOIN: - * case EMBER_STANDARD_SECURITY_UNSECURED_REJOIN: - * status = ZigBeeNodeStatus.UNSECURED_REJOIN; - * break; - * case EMBER_HIGH_SECURITY_SECURED_REJOIN: - * case EMBER_STANDARD_SECURITY_SECURED_REJOIN: - * status = ZigBeeNodeStatus.SECURED_REJOIN; - * break; - * case EMBER_DEVICE_LEFT: - * status = ZigBeeNodeStatus.DEVICE_LEFT; - * break; - * default: - * logger.debug("Unknown state in trust centre join handler {}", joinHandler.getStatus()); - * return; - * } - * - * zigbeeTransportReceive.nodeStatusUpdate(status, joinHandler.getNewNodeId(), joinHandler.getNewNodeEui64()); - * return; - * } - */ + if (response instanceof ZstackZdoTcDevIndAreq) { + ZstackZdoTcDevIndAreq tcDeviceInd = (ZstackZdoTcDevIndAreq) response; + + zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, tcDeviceInd.getSrcAddr(), + tcDeviceInd.getExtAddr()); + return; + } } @Override @@ -697,11 +682,10 @@ public ZigBeeKey getZigBeeNetworkKey() { @Override public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { - linkKey = key; - if (networkStateUp) { - return ZigBeeStatus.INVALID_STATE; - } - return ZigBeeStatus.SUCCESS; + ZstackNcp ncp = getZstackNcp(); + + return ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, + key.getValue()) == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE; } @Override @@ -709,6 +693,19 @@ public ZigBeeKey getTcLinkKey() { return null; } + /** + * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + * + * @param required true if the TCLK exchange procedure is required. + * @return {@link ZigBeeStatus} + */ + public ZigBeeStatus requireKeyExchange(boolean required) { + ZstackNcp ncp = getZstackNcp(); + + return ncp.requireKeyExchange(required) == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS + : ZigBeeStatus.FAILURE; + } + @Override public void updateTransportConfig(TransportConfig configuration) { for (TransportConfigOption option : configuration.getOptions()) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index e993633258..fe9eef81a8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -22,6 +22,13 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackInstallCodeFormat; import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; @@ -499,7 +506,78 @@ public ZstackResponseCode startupApplication() { .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoStartupFromAppSrsp.class)); ZstackZdoStartupFromAppSrsp response = (ZstackZdoStartupFromAppSrsp) transaction.getResponse(); if (response == null) { - logger.debug("No response from StartupApplication command"); + logger.debug("No response from startupApplication command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

+ * APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE + * + * @param required true if the TCLK exchange procedure is required. + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode requireKeyExchange(boolean required) { + ZstackAppCnfBdbSetTcRequireKeyExchangeSreq request = new ZstackAppCnfBdbSetTcRequireKeyExchangeSreq(); + request.setTrustCenterRequireKeyExchange(required); + ZstackTransaction transaction = protocolHandler.sendTransaction( + new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class)); + ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp response = (ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp) transaction + .getResponse(); + if (response == null) { + logger.debug("No response from requireKeyExchange command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

+ * APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY + * + * @param mode the {@link ZstackCentralizedLinkKeyMode} + * @param installCode array with the code in the required format + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode setCentralisedKey(ZstackCentralizedLinkKeyMode mode, int[] installCode) { + ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq request = new ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq(); + request.setCentralizedLinkKeyMode(mode); + request.setInstallCode(installCode); + ZstackTransaction transaction = protocolHandler.sendTransaction( + new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class)); + ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp response = (ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp) transaction + .getResponse(); + if (response == null) { + logger.debug("No response from setCentralisedKey command"); + return ZstackResponseCode.FAILURE; + } + logger.debug(response.toString()); + return response.getStatus(); + } + + /** + * Sets the AllowRejoin TC policy. + *

+ * APP_CNF_SET_ALLOWREJOIN_TC_POLICY + * + * @param allow true to allow rejoins + * @return {@link ZstackResponseCode} returned from the NCP + */ + public ZstackResponseCode allowRejoin(boolean allow) { + ZstackAppCnfSetAllowrejoinTcPolicySreq request = new ZstackAppCnfSetAllowrejoinTcPolicySreq(); + request.setAllowRejoin(allow); + ZstackTransaction transaction = protocolHandler.sendTransaction( + new ZstackSingleResponseTransaction(request, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class)); + ZstackAppCnfSetAllowrejoinTcPolicySrsp response = (ZstackAppCnfSetAllowrejoinTcPolicySrsp) transaction + .getResponse(); + if (response == null) { + logger.debug("No response from allowRejoin command"); return ZstackResponseCode.FAILURE; } logger.debug(response.toString()); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java index 244b54c6af..2da9a33f5f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java @@ -29,7 +29,7 @@ public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq extends ZstackFra /** * Buffer with the key in any of its formats. */ - private int installCode; + private int[] installCode; /** * Request constructor @@ -59,18 +59,18 @@ public void setCentralizedLinkKeyMode(ZstackCentralizedLinkKeyMode centralizedLi /** * Buffer with the key in any of its formats. * - * @return the current installCode as {@link int} + * @return the current installCode as {@link int[]} */ - public int getInstallCode() { + public int[] getInstallCode() { return installCode; } /** * Buffer with the key in any of its formats. * - * @param installCode the InstallCode to set as {@link int} + * @param installCode the InstallCode to set as {@link int[]} */ - public void setInstallCode(int installCode) { + public void setInstallCode(int[] installCode) { this.installCode = installCode; } @@ -86,7 +86,7 @@ public int[] serialize() { // Serialize the fields serializer.serializeUInt8(centralizedLinkKeyMode.getKey()); - serializer.serializeUInt8(installCode); + serializer.serializeUInt8Array(installCode); return getPayload(); } @@ -96,7 +96,12 @@ public String toString() { builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq [centralizedLinkKeyMode="); builder.append(centralizedLinkKeyMode); builder.append(", installCode="); - builder.append(installCode); + for (int c = 0; c < installCode.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", installCode[c])); + } builder.append(']'); return builder.toString(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index 79842ec206..ecdc0cd970 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -164,6 +164,8 @@ public ZigBeeStatus startNetwork() { ncp.setNetworkSecurity(true); ncp.zdoRegisterCallback(0x0006);// MatchDescriptorRequest + ncp.zdoRegisterCallback(0x0013);// DeviceAnnounce + ncp.zdoRegisterCallback(0x0036);// ManagementPermitJoiningRequest ncp.zdoRegisterCallback(0x8000);// NetworkAddressResponse() { ncp.zdoRegisterCallback(0x8001);// IeeeAddressResponse() { ncp.zdoRegisterCallback(0x8002);// NodeDescriptorResponse.); @@ -172,7 +174,6 @@ public ZigBeeStatus startNetwork() { ncp.zdoRegisterCallback(0x8005);// ActiveEndpointsResponse ncp.zdoRegisterCallback(0x8006);// MatchDescriptorResponse ncp.zdoRegisterCallback(0x8011);// UserDescriptorResponse - ncp.zdoRegisterCallback(0x8013);// DeviceAnnounce ncp.zdoRegisterCallback(0x8020);// EndDeviceBindResponse ncp.zdoRegisterCallback(0x8021);// BindResponse ncp.zdoRegisterCallback(0x8022);// UnbindResponse From 82c02ae1110872e56b8ede27350c422a4743d0f7 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Tue, 7 May 2019 17:09:59 +0100 Subject: [PATCH 05/33] Handle HA1.2 join Signed-off-by: Chris Jackson --- .../zigbee/console/main/ZigBeeConsoleMain.java | 10 +++++++++- .../src/main/resources/zstack_protocol.xml | 10 ++++++++-- .../zigbee/dongle/zstack/ZigBeeDongleZstack.java | 10 +++++++++- .../dongle/zstack/internal/ZstackProtocolHandler.java | 7 ++++++- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java index e53f8cab1f..79e71d9f40 100644 --- a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java +++ b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java @@ -443,12 +443,20 @@ public static void main(final String[] args) { System.out.println("ZigBee console starting up ... [OK]"); } - if (dongleName.toUpperCase().equals("CC2531")) { + networkManager.addSupportedCluster(ZclIasZoneCluster.CLUSTER_ID); + + if (dongleName.equalsIgnoreCase("CC2531")) { ZigBeeDongleTiCc2531 tiDongle = (ZigBeeDongleTiCc2531) dongle; tiDongle.setLedMode(1, false); tiDongle.setLedMode(2, false); } + if (dongleName.equalsIgnoreCase("ZSTACK")) { + // Required to allow HA1.2 devices to join the ZB3.0 compatible coordinator + ZigBeeDongleZstack zstackDongle = (ZigBeeDongleZstack) dongle; + zstackDongle.requireKeyExchange(false); + } + console.start(); System.out.println("Console closed."); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index b39a4d1f72..7ec0e1fd9e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -466,6 +466,7 @@ uint16 AppProfId + hex[4] Specifies the profile id of the application. @@ -495,7 +496,7 @@ uint16[] AppInClusterList - Specifies the list of Input Cluster Ids ( 2bytes each ). + Specifies the list of Input Cluster Ids (2 bytes each). uint8 @@ -506,7 +507,7 @@ uint16[] AppOutClusterList - Specifies the list of Output Cluster Ids ( 2bytes each ) + Specifies the list of Output Cluster Ids (2 bytes each) @@ -1761,6 +1762,11 @@ 0x40 Set this bit to enable APS security for this packet. + + AF_NO_ROUTING + 0x80 + Skip routing. + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 2d77fcc1bd..413ce2e103 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -64,6 +64,14 @@ /** * Implementation of the Texas instruments Z-Stack dongle implementation. + *

+ * Usage notes... + *

    + *
  • To be compatible with older devices (ie pre-ZigBee 3.0), MT_APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE should be set + * to FALSE. Failing to set this to FALSE will require the R21 join procedure to exchange keys following the initial + * association, which older devices will not perform, and the coordinator will then remove them from the network. This + * can be achieved with the {@link ZigBeeDongleZstack#requireKeyExchange(boolean)} method. + *
* * @author Chris Jackson * @@ -181,7 +189,6 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { // Define the default configuration stackConfiguration = new LinkedHashMap<>(); - stackConfiguration.put(ZstackConfigId.ZCD_NV_APS_ALLOW_R19_SECURITY, new int[] { 0x01 }); networkKey = new ZigBeeKey(); } @@ -277,6 +284,7 @@ public ZigBeeStatus initialize() { // Add the endpoint ncp.addEndpoint(1, 0, ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), new int[] { 0 }, new int[] { 0 }); + sender2EndPoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); /* * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index 12ba58ace0..e36175dcaa 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -353,10 +353,15 @@ private synchronized boolean sendNextFrame() { private synchronized void sendFrame(ZstackFrameRequest request) { logger.debug("ZSTACK TX: {}", request); + StringBuilder builder = new StringBuilder(100); + builder.append("ZSTACK TX: FrameData [ data="); + for (int outByte : request.serialize()) { - logger.trace("ZSTACK TX Byte: {}", String.format("%02X", outByte)); port.write(outByte); + builder.append(String.format("%02X ", outByte)); } + builder.append(']'); + logger.debug(builder.toString()); } public void sendRaw(int rawByte) { From a26892b063cefe41a7e17d7fed6a37e10dc710e4 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 18 May 2019 11:26:16 +0100 Subject: [PATCH 06/33] Refactored after 1.2 breaking changes Signed-off-by: Chris Jackson --- .../zigbee/dongle/zstack/ZigBeeDongleZstack.java | 8 +++++--- .../zigbee/dongle/zstack/ZigBeeDongleZstackTest.java | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 413ce2e103..afca8263c8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -22,13 +22,13 @@ import com.zsmartsystems.zigbee.ExtendedPanId; import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.ZigBeeApsFrame; import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.ZigBeeNodeStatus; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; +import com.zsmartsystems.zigbee.aps.ZigBeeApsFrame; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; @@ -626,7 +626,7 @@ public void run() { } // Handle link changes and notify framework zigbeeTransportReceive - .setNetworkState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); + .setTransportState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); } }.start(); } @@ -703,6 +703,9 @@ public ZigBeeKey getTcLinkKey() { /** * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

+ * Note that for ZB3, this should be set to true, however for backward compatability with HA1.2, this needs to be + * set to false or devices will not be able to join the network. * * @param required true if the TCLK exchange procedure is required. * @return {@link ZigBeeStatus} @@ -817,5 +820,4 @@ private int getEndpointProfile(int endpointId) { } } } - } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index f5fcc8db95..9bc7ac0899 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -18,11 +18,11 @@ import com.zsmartsystems.zigbee.ExtendedPanId; import com.zsmartsystems.zigbee.TestUtilities; -import com.zsmartsystems.zigbee.ZigBeeApsFrame; import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeNwkAddressMode; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; +import com.zsmartsystems.zigbee.aps.ZigBeeApsFrame; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; @@ -76,18 +76,18 @@ public ZstackNcp getZstackNcp() { ZstackZdoStateChangeIndAreq response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ZB_COORD); - Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)).setNetworkState(ZigBeeTransportState.ONLINE); + Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)).setTransportState(ZigBeeTransportState.ONLINE); response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ROUTER); dongle.handlePacket(response); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.ONLINE); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.ONLINE); assertEquals(Integer.valueOf(1243), dongle.getNwkAddress()); response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_INIT); dongle.handlePacket(response); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setNetworkState(ZigBeeTransportState.OFFLINE); + Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.OFFLINE); } @Test From 2ebd3e9e71b6b94fad2b39f6e1e457914e317572 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 18 May 2019 18:49:55 +0100 Subject: [PATCH 07/33] Initialisation changes Signed-off-by: Chris Jackson --- .../zstack/autocode/CommandGenerator.java | 37 +++++++++++++++++-- .../src/main/resources/zstack_protocol.xml | 2 + .../dongle/zstack/ZigBeeDongleZstack.java | 17 ++++----- .../zigbee/dongle/zstack/ZstackNcp.java | 17 --------- .../dongle/zstack/api/af/AfDataOptions.java | 7 +++- .../zstack/api/af/ZstackAfRegisterSreq.java | 18 ++++----- .../internal/ZstackProtocolHandler.java | 8 ++-- .../api/af/ZstackAfRegisterSreqTest.java | 34 +++++++++++++++++ 8 files changed, 96 insertions(+), 44 deletions(-) create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 25d0138965..f8cd1b723b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -355,8 +355,26 @@ private void createCommandClass(String className, Command command, List 0) {"); out.println(" builder.append(' ');"); out.println(" }"); - out.println(" builder.append(String.format(\"%02X\", " + formatParameterString(parameter) - + "[c]));"); + + String format = "%02X"; + if (parameter.displayType != null) { + switch (parameter.displayType.toLowerCase()) { + case "hex": + String size = ""; + if (parameter.displayLength != 0) { + size = "0" + parameter.displayLength; + } + format = "%" + size + "X"; + break; + } + } + + out.println(" builder.append(String.format(\"" + format + "\", " + + camelCaseToLowerCamelCase(parameter.name) + "[c]));"); + + // + // out.println(" builder.append(String.format(\"%02X\", " + formatParameterString(parameter) + // + "[c]));"); out.println(" }"); } else { out.println(" builder.append(" + formatParameterString(parameter) + ");"); @@ -637,8 +655,19 @@ private void createStructureClass(Structure structure) throws FileNotFoundExcept out.println(" if (c > 0) {"); out.println(" builder.append(' ');"); out.println(" }"); - out.println(" builder.append(String.format(\"%02X\", " + formatParameterString(parameter) - + "[c]));"); + + String format = "%02X"; + switch (parameter.displayType.toLowerCase()) { + case "hex": + String size = ""; + if (parameter.displayLength != 0) { + size = "0" + parameter.displayLength; + } + format = "%" + size; + break; + } + + out.println(" builder.append(String.format(\"" + format + "\", " + parameter + "[c]));"); out.println(" }"); } else { out.println(" builder.append(" + formatParameterString(parameter) + ");"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 7ec0e1fd9e..9ce6445ed5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -497,6 +497,7 @@ uint16[] AppInClusterList Specifies the list of Input Cluster Ids (2 bytes each). + hex[4] uint8 @@ -508,6 +509,7 @@ uint16[] AppOutClusterList Specifies the list of Output Cluster Ids (2 bytes each) + hex[4] diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index afca8263c8..97cfe40e3a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -24,6 +24,7 @@ import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; +import com.zsmartsystems.zigbee.ZigBeeDeviceType; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.ZigBeeNodeStatus; import com.zsmartsystems.zigbee.ZigBeeProfileType; @@ -282,10 +283,6 @@ public ZigBeeStatus initialize() { ieeeAddress = ncp.getIeeeAddress(); logger.debug("ZStack local IEEE Address is {}", ieeeAddress); - // Add the endpoint - ncp.addEndpoint(1, 0, ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), new int[] { 0 }, new int[] { 0 }); - sender2EndPoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); - /* * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing * of responses is performed in order @@ -327,7 +324,7 @@ public ZigBeeStatus startup(boolean reinitialize) { return ZigBeeStatus.COMMUNICATION_ERROR; } - ncpResponse = ncp.setTcLinkKey(linkKey); + ncpResponse = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, linkKey.getValue()); if (ncpResponse != ZstackResponseCode.SUCCESS) { logger.debug("ZStack error setting link key: {}", ncpResponse); // return ZigBeeStatus.COMMUNICATION_ERROR; @@ -354,6 +351,11 @@ public ZigBeeStatus startup(boolean reinitialize) { } } + // Add the endpoint + ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), + new int[] { 0 }, new int[] { 0 }); + sender2EndPoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); + if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { logger.debug("ZStack error setting transmit power"); return ZigBeeStatus.COMMUNICATION_ERROR; @@ -361,10 +363,6 @@ public ZigBeeStatus startup(boolean reinitialize) { netInitialiser.startNetwork(); - // Check if the network is now up - // networkState = ncp.getNetworkState(); - // logger.debug("ZStack networkStateResponse {}", networkState); - ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); if (deviceInfo == null) { logger.debug("Error getting device info"); @@ -690,6 +688,7 @@ public ZigBeeKey getZigBeeNetworkKey() { @Override public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { + linkKey = key; ZstackNcp ncp = getZstackNcp(); return ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index fe9eef81a8..2336af910a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -60,8 +60,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; @@ -434,21 +432,6 @@ public ZstackResponseCode setNetworkKey(ZigBeeKey key) { return writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, valueFromUInt8(1)); } - public ZstackResponseCode setTcLinkKey(ZigBeeKey key) { - ZstackZdoSetLinkKeySreq request = new ZstackZdoSetLinkKeySreq(); - request.setIeeeAddr(new IeeeAddress("FFFFFFFFFFFFFFFF")); - request.setLinkKeyData(key); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoSetLinkKeySrsp.class)); - ZstackZdoSetLinkKeySrsp response = (ZstackZdoSetLinkKeySrsp) transaction.getResponse(); - if (response == null) { - logger.debug("No response from SetLinkKey command"); - return null; - } - logger.debug(response.toString()); - return response.getStatus(); - } - public ZstackResponseCode setNetworkSecurity(boolean enableSecurity) { return writeConfiguration(ZstackConfigId.ZCD_NV_SECURITY_MODE, valueFromBoolean(enableSecurity)); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index 1608a9f294..739d60753a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -38,7 +38,12 @@ public enum AfDataOptions { /** * Set this bit to enable APS security for this packet. */ - AF_EN_SECURITY(0x0040); + AF_EN_SECURITY(0x0040), + + /** + * Skip routing. + */ + AF_NO_ROUTING(0x0080); /** * A mapping between the integer code and its corresponding type to diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index 29b1dfba07..ec1f160a31 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -50,12 +50,12 @@ public class ZstackAfRegisterSreq extends ZstackFrameRequest { private int latencyReq; /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). + * Specifies the list of Input Cluster Ids (2 bytes each). */ private int[] appInClusterList; /** - * Specifies the list of Output Cluster Ids ( 2bytes each ) + * Specifies the list of Output Cluster Ids (2 bytes each) */ private int[] appOutClusterList; @@ -157,7 +157,7 @@ public void setLatencyReq(int latencyReq) { } /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). + * Specifies the list of Input Cluster Ids (2 bytes each). * * @return the current appInClusterList as {@link int[]} */ @@ -166,7 +166,7 @@ public int[] getAppInClusterList() { } /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). + * Specifies the list of Input Cluster Ids (2 bytes each). * * @param appInClusterList the AppInClusterList to set as {@link int[]} */ @@ -175,7 +175,7 @@ public void setAppInClusterList(int[] appInClusterList) { } /** - * Specifies the list of Output Cluster Ids ( 2bytes each ) + * Specifies the list of Output Cluster Ids (2 bytes each) * * @return the current appOutClusterList as {@link int[]} */ @@ -184,7 +184,7 @@ public int[] getAppOutClusterList() { } /** - * Specifies the list of Output Cluster Ids ( 2bytes each ) + * Specifies the list of Output Cluster Ids (2 bytes each) * * @param appOutClusterList the AppOutClusterList to set as {@link int[]} */ @@ -221,7 +221,7 @@ public String toString() { builder.append("ZstackAfRegisterSreq [endPoint="); builder.append(String.format("%02X", endPoint)); builder.append(", appProfId="); - builder.append(appProfId); + builder.append(String.format("%04X", appProfId)); builder.append(", appDeviceId="); builder.append(appDeviceId); builder.append(", appDevVer="); @@ -233,14 +233,14 @@ public String toString() { if (c > 0) { builder.append(' '); } - builder.append(String.format("%02X", appInClusterList[c])); + builder.append(String.format("%04X", appInClusterList[c])); } builder.append(", appOutClusterList="); for (int c = 0; c < appOutClusterList.length; c++) { if (c > 0) { builder.append(' '); } - builder.append(String.format("%02X", appOutClusterList[c])); + builder.append(String.format("%04X", appOutClusterList[c])); } builder.append(']'); return builder.toString(); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index e36175dcaa..ee4b94d999 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -130,10 +130,10 @@ public void run() { ZstackFrameResponse response = ZstackFrameFactory.createFrame(frameData); if (response == null) { - logger.debug("ZSTACK RX: ZstackUnknownFrame [ data={}]", frameToString(frameData)); + logger.debug("RX ZSTACK: ZstackUnknownFrame [ data={}]", frameToString(frameData)); continue; } else { - logger.debug("ZSTACK RX: {}", response); + logger.debug("RX ZSTACK: {}", response); } // Send this into the stack @@ -351,7 +351,7 @@ private synchronized boolean sendNextFrame() { } private synchronized void sendFrame(ZstackFrameRequest request) { - logger.debug("ZSTACK TX: {}", request); + logger.debug("TX ZSTACK: {}", request); StringBuilder builder = new StringBuilder(100); builder.append("ZSTACK TX: FrameData [ data="); @@ -507,7 +507,7 @@ public void transactionComplete() { * @return response {@link ZstackCommand} */ public ZstackTransaction sendTransaction(ZstackTransaction transaction) { - logger.debug("TX ZSTACK: {}", transaction.getRequest()); + logger.debug("QUEUE ZSTACK: {}", transaction.getRequest()); Future futureResponse = sendZstackRequestAsync(transaction); if (futureResponse == null) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java new file mode 100644 index 0000000000..52afc097df --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java @@ -0,0 +1,34 @@ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; + +/** + * + * @author Chris Jackson + * + */ +public class ZstackAfRegisterSreqTest { + @Test + public void test() { + ZstackAfRegisterSreq request = new ZstackAfRegisterSreq(); + + request.setEndPoint(1); + request.setAppDeviceId(2); + request.setAppProfId(0x1122); + request.setAppInClusterList(new int[] { 1, 2, 3 }); + request.setAppOutClusterList(new int[] { 0x1234 }); + request.setLatencyReq(0x21); + request.setAppDevVer(0x12); + + System.out.println(request); + + int[] x = request.serialize(); + + assertTrue(Arrays.equals(new int[] { 0xFE, 0x11, 0x24, 0x00, 0x01, 0x22, 0x11, 0x02, 0x00, 0x12, 0x21, 0x03, + 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x34, 0x12, 0x12 }, x)); + } +} From 81922c0b4a7465fd2681a1151b59faa78bb849b7 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Wed, 29 May 2019 18:53:07 +0100 Subject: [PATCH 08/33] Update for SeqNum bug Signed-off-by: Chris Jackson --- .../zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 97cfe40e3a..3d00d0b791 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -72,6 +72,7 @@ * to FALSE. Failing to set this to FALSE will require the R21 join procedure to exchange keys following the initial * association, which older devices will not perform, and the coordinator will then remove them from the network. This * can be achieved with the {@link ZigBeeDongleZstack#requireKeyExchange(boolean)} method. + *

  • There is a bug in the TI ZStack 3.0.2 which always return 00 as the SeqNum in the ZstackZdoMsgCbIncomingAreq * * * @author Chris Jackson @@ -545,7 +546,7 @@ public void handlePacket(ZstackCommand response) { apsFrame.setDestinationAddress(nwkAddress); apsFrame.setDestinationEndpoint(0); apsFrame.setSourceEndpoint(0); - apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setSourceAddress(-1); apsFrame.setApsCounter(incomingMsg.getSeqNumber()); apsFrame.setProfile(0); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); From b970744c0bb1707c8bb0a1db21391eafaa28ce08 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 1 Jun 2019 17:51:59 +0100 Subject: [PATCH 09/33] Finalise initialisation Signed-off-by: Chris Jackson --- .../zstack/autocode/CommandGenerator.java | 18 +++-- .../zstack/autocode/ZstackAutocoder.java | 3 + .../zstack/autocode/xml/Enumeration.java | 1 + .../src/main/resources/zstack_protocol.xml | 2 +- .../dongle/zstack/ZigBeeDongleZstack.java | 75 +++++++++++-------- .../zigbee/dongle/zstack/ZstackNcp.java | 20 +++++ .../dongle/zstack/api/af/AfDataOptions.java | 7 -- .../appcnf/ZstackAuthenticationOption.java | 7 -- .../appcnf/ZstackBdbCommissioningMode.java | 7 -- .../ZstackBdbRemainingCommissioningModes.java | 7 -- .../zstack/api/appcnf/ZstackBdbStatus.java | 7 -- .../api/appcnf/ZstackInstallCodeFormat.java | 7 -- .../internal/ZstackNetworkInitialisation.java | 27 ++----- .../api/af/ZstackAfRegisterSreqTest.java | 7 ++ 14 files changed, 94 insertions(+), 101 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index f8cd1b723b..0c30c1ee9d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -729,10 +729,12 @@ private void createEnumClass(Enumeration enumeration) throws FileNotFoundExcepti out.println("public enum " + className + " {"); - out.println(" /**"); - out.println(" * Default unknown value"); - out.println(" */"); - out.println(" UNKNOWN(-1),"); + if (!enumeration.fullyDefined) { + out.println(" /**"); + out.println(" * Default unknown value"); + out.println(" */"); + out.println(" UNKNOWN(-1),"); + } boolean first = true; for (Value value : enumeration.values) { @@ -781,9 +783,11 @@ private void createEnumClass(Enumeration enumeration) throws FileNotFoundExcepti out.println(" * @return enumeration value of the alarm type."); out.println(" */"); out.println(" public static " + className + " valueOf(int code) {"); - out.println(" if (codeMapping.get(code) == null) {"); - out.println(" return UNKNOWN;"); - out.println(" }"); + if (!enumeration.fullyDefined) { + out.println(" if (codeMapping.get(code) == null) {"); + out.println(" return UNKNOWN;"); + out.println(" }"); + } out.println(); out.println(" return codeMapping.get(code);"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java index 26a39bb26e..3361903edb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java @@ -202,6 +202,9 @@ private static Object processNode(Node node) { enumeration.description = nodes.item(temp).getTextContent().trim(); } if (nodes.item(temp).getNodeName().equals("values")) { + Element dataTypeElement = (Element) nodes.item(temp); + enumeration.fullyDefined = "true" + .equalsIgnoreCase(dataTypeElement.getAttribute("fully_defined")); enumeration.values = (List) processNode(nodes.item(temp)); } if (nodes.item(temp).getNodeName().equals("format")) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java index dab179bdb1..6ed7e71419 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java @@ -21,4 +21,5 @@ public class Enumeration { public String format; public List values; public String data_type; + public boolean fullyDefined; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 9ce6445ed5..72e11368c3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -1748,7 +1748,7 @@ uint8 Options applied when sending frames AF - + AF_ACK_REQUEST 0x10 diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 3d00d0b791..b4e02940ea 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -39,6 +39,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; @@ -178,7 +179,7 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH */ private long lastSendCommandTime; - private final HashMap sender2EndPoint = new HashMap(); + private final HashMap sender2Endpoint = new HashMap(); private final HashMap endpoint2Profile = new HashMap(); /** @@ -240,7 +241,7 @@ public ZigBeeStatus initialize() { ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); netInitialiser.setMagicNumber(magicNumber); - netInitialiser.initializeNcp(); + netInitialiser.initializeNcp(false); ZstackNcp ncp = getZstackNcp(); @@ -267,29 +268,11 @@ public ZigBeeStatus initialize() { ieeeAddress = ncp.getIeeeAddress(); logger.debug("ZStack local IeeeAddress: {}", ieeeAddress); - // Perform any stack configuration - ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); - - Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); - for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); - } - - stackConfigurer.setConfiguration(stackConfiguration); - configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); - for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); - } - - ieeeAddress = ncp.getIeeeAddress(); - logger.debug("ZStack local IEEE Address is {}", ieeeAddress); - /* * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing * of responses is performed in order */ executorService = Executors.newScheduledThreadPool(1); - scheduleNetworkStatePolling(); logger.debug("ZStack dongle initialize: Done"); @@ -313,12 +296,16 @@ public ZigBeeStatus startup(boolean reinitialize) { netInitialiser.setMagicNumber(magicNumber); if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); + netInitialiser.initializeNcp(true); + if (deviceType == DeviceType.COORDINATOR) { netInitialiser.formNetwork(); } else { netInitialiser.joinNetwork(); } + ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + ZstackResponseCode ncpResponse = ncp.setNetworkKey(networkKey); if (ncpResponse != ZstackResponseCode.SUCCESS) { logger.debug("ZStack error setting network key: {}", ncpResponse); @@ -343,7 +330,7 @@ public ZigBeeStatus startup(boolean reinitialize) { if (extendedPanId == null) { // Allow the NCP to create a random extended PAN ID - extendedPanId = new ExtendedPanId("FFFFFFFF"); + extendedPanId = new ExtendedPanId("FFFFFFFFFFFFFFFF"); } ncpResponse = ncp.setExtendedPanId(extendedPanId); if (ncpResponse != ZstackResponseCode.SUCCESS) { @@ -352,10 +339,25 @@ public ZigBeeStatus startup(boolean reinitialize) { } } + // Perform any stack configuration + ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); + + Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); + } + + stackConfigurer.setConfiguration(stackConfiguration); + configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); + } + // Add the endpoint ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), new int[] { 0 }, new int[] { 0 }); - sender2EndPoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); + sender2Endpoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); + endpoint2Profile.put(1, ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { logger.debug("ZStack error setting transmit power"); @@ -388,6 +390,9 @@ public ZigBeeStatus startup(boolean reinitialize) { logger.debug("ZStack dongle startup: Done"); initialised = true; + handleLinkStateChange(true); + scheduleNetworkStatePolling(); + return ZigBeeStatus.SUCCESS; } @@ -525,7 +530,7 @@ public void handlePacket(ZstackCommand response) { apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setApsCounter(incomingMsg.getSeqNumber()); + apsFrame.setApsCounter(-1); apsFrame.setProfile(getEndpointProfile(incomingMsg.getDestEndpoint())); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); apsFrame.setPayload(incomingMsg.getData()); @@ -546,8 +551,8 @@ public void handlePacket(ZstackCommand response) { apsFrame.setDestinationAddress(nwkAddress); apsFrame.setDestinationEndpoint(0); apsFrame.setSourceEndpoint(0); - apsFrame.setSourceAddress(-1); - apsFrame.setApsCounter(incomingMsg.getSeqNumber()); + apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setApsCounter(-1); apsFrame.setProfile(0); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); @@ -656,6 +661,7 @@ public ZigBeeStatus setZigBeePanId(int panId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } + this.panId = panId; return ZigBeeStatus.SUCCESS; } @@ -670,21 +676,23 @@ public ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } + this.extendedPanId = extendedPanId; return ZigBeeStatus.SUCCESS; } @Override public ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key) { - networkKey = key; if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } + networkKey = key; return ZigBeeStatus.SUCCESS; } @Override public ZigBeeKey getZigBeeNetworkKey() { - return null; + ZstackNcp ncp = getZstackNcp(); + return ncp.getNetworkKey(); } @Override @@ -791,13 +799,18 @@ public String getVersionString() { return versionString; } + /** + * Gets the endpoint given the profile - for sending + * + * @param profileId the profile ID + * @return the endpoint used for this profile + */ private int getSendingEndpoint(int profileId) { - synchronized (sender2EndPoint) { - if (sender2EndPoint.containsKey(profileId)) { - return sender2EndPoint.get(profileId); + synchronized (sender2Endpoint) { + if (sender2Endpoint.containsKey(profileId)) { + return sender2Endpoint.get(profileId); } else { logger.info("No endpoint registered for profileId={}", profileId); - // final byte ep = createEndPoint( profileId); return -1; } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index 2336af910a..710f9bb833 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -432,6 +432,26 @@ public ZstackResponseCode setNetworkKey(ZigBeeKey key) { return writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, valueFromUInt8(1)); } + /** + * Gets the network key. + * + * @return the {@link ZigBeeKey} returned from the NCP or null on error + */ + public ZigBeeKey getNetworkKey() { + int[] response = readConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY); + if (response == null) { + return null; + } + + return new ZigBeeKey(response); + } + + /** + * Enables network security + * + * @param enableSecurity true to enable network security + * @return {@link ZstackResponseCode} returned from the NCP + */ public ZstackResponseCode setNetworkSecurity(boolean enableSecurity) { return writeConfiguration(ZstackConfigId.ZCD_NV_SECURITY_MODE, valueFromBoolean(enableSecurity)); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index 739d60753a..3b6d4b8a96 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -20,10 +20,6 @@ * @author Chris Jackson */ public enum AfDataOptions { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * Set this bit to request APS acknowledgement for this packet @@ -71,9 +67,6 @@ private AfDataOptions(int key) { * @return enumeration value of the alarm type. */ public static AfDataOptions valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java index 4fc235e1cc..423ed85050 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java @@ -18,10 +18,6 @@ * @author Chris Jackson */ public enum ZstackAuthenticationOption { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * The device has not been authenticated @@ -64,9 +60,6 @@ private ZstackAuthenticationOption(int key) { * @return enumeration value of the alarm type. */ public static ZstackAuthenticationOption valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java index 691e506422..8f919300e4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java @@ -18,10 +18,6 @@ * @author Chris Jackson */ public enum ZstackBdbCommissioningMode { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * @@ -79,9 +75,6 @@ private ZstackBdbCommissioningMode(int key) { * @return enumeration value of the alarm type. */ public static ZstackBdbCommissioningMode valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java index 6e490b83b3..7c062f9a9f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java @@ -18,10 +18,6 @@ * @author Chris Jackson */ public enum ZstackBdbRemainingCommissioningModes { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * @@ -79,9 +75,6 @@ private ZstackBdbRemainingCommissioningModes(int key) { * @return enumeration value of the alarm type. */ public static ZstackBdbRemainingCommissioningModes valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java index bb15853bec..00f05c1047 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java @@ -18,10 +18,6 @@ * @author Chris Jackson */ public enum ZstackBdbStatus { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * @@ -124,9 +120,6 @@ private ZstackBdbStatus(int key) { * @return enumeration value of the alarm type. */ public static ZstackBdbStatus valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java index 6538ddd1c9..bf8a343962 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java @@ -18,10 +18,6 @@ * @author Chris Jackson */ public enum ZstackInstallCodeFormat { - /** - * Default unknown value - */ - UNKNOWN(-1), /** * @@ -59,9 +55,6 @@ private ZstackInstallCodeFormat(int key) { * @return enumeration value of the alarm type. */ public static ZstackInstallCodeFormat valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } return codeMapping.get(code); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index ecdc0cd970..fd3710e7fa 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -89,8 +89,10 @@ public void setMagicNumber(int magicNumber) { * defaults. From here we have a known configuration on which to start our session. *

    * The dongle is not reset completely, thus allowing it to be placed back into the previous network. + * + * @param initialize set to true to reset the dongle and erase all current network settings */ - public ZigBeeStatus initializeNcp() { + public ZigBeeStatus initializeNcp(boolean initialize) { logger.debug("ZStack Initialisation: Initialise"); ZstackNcp ncp = new ZstackNcp(protocolHandler); @@ -105,7 +107,10 @@ public ZigBeeStatus initializeNcp() { } } - return resetNcp(ncp, false); + if (initialize) { + return resetNcp(ncp, true); + } + return ZigBeeStatus.SUCCESS; } /** @@ -124,9 +129,6 @@ public ZigBeeStatus formNetwork() { return ZigBeeStatus.COMMUNICATION_ERROR; } - // Reset the NCP so that this take effect, and also scrub the network information - resetNcp(ncp, true); - return ZigBeeStatus.SUCCESS; } @@ -146,9 +148,6 @@ public ZigBeeStatus joinNetwork() { return ZigBeeStatus.COMMUNICATION_ERROR; } - // Reset the NCP so that this take effect, and also scrub the network information - resetNcp(ncp, true); - return ZigBeeStatus.SUCCESS; } @@ -227,18 +226,6 @@ private ZigBeeStatus resetNcp(ZstackNcp ncp, boolean initialise) { return ZigBeeStatus.COMMUNICATION_ERROR; } - // Perform another reset so that the startup options take effect - ZstackSysResetIndAreq resetResponse = ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - logger.debug("ZStack Initialisation: Reset response {}", resetResponse); - - // Clear the clearState option so the next restart doesn't clear the network information - if (initialise) { - if (ncp.setStartupOptions(true, initialise) != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack Initialisation: Failed to set startup options"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - } - return ZigBeeStatus.SUCCESS; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java index 52afc097df..510d73efff 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java @@ -1,3 +1,10 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ package com.zsmartsystems.zigbee.dongle.zstack.api.af; import static org.junit.Assert.assertTrue; From 5c385474026473c7f230e0f132669a3b9c83fcd3 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 15 Jun 2019 11:23:03 +0100 Subject: [PATCH 10/33] Remove APS Counter setting as this is now default Signed-off-by: Chris Jackson --- .../zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index b4e02940ea..449885131f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -530,7 +530,6 @@ public void handlePacket(ZstackCommand response) { apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setApsCounter(-1); apsFrame.setProfile(getEndpointProfile(incomingMsg.getDestEndpoint())); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); apsFrame.setPayload(incomingMsg.getData()); @@ -552,7 +551,6 @@ public void handlePacket(ZstackCommand response) { apsFrame.setDestinationEndpoint(0); apsFrame.setSourceEndpoint(0); apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setApsCounter(-1); apsFrame.setProfile(0); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); From 42dab6daa62fe45b8491f698f9fac86b6b894a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 27 Nov 2021 12:00:39 +0100 Subject: [PATCH 11/33] Update POM version for zstack dongle --- com.zsmartsystems.zigbee.console.main/pom.xml | 4 ++-- com.zsmartsystems.zigbee.console.zstack/pom.xml | 8 ++++---- com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml | 2 +- com.zsmartsystems.zigbee.dongle.zstack/pom.xml | 7 ++++--- .../dongle/zstack/internal/ZstackProtocolHandlerTest.java | 7 +++++++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.main/pom.xml b/com.zsmartsystems.zigbee.console.main/pom.xml index e23fbe535f..0b5b33a610 100644 --- a/com.zsmartsystems.zigbee.console.main/pom.xml +++ b/com.zsmartsystems.zigbee.console.main/pom.xml @@ -35,7 +35,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.zstack - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT @@ -83,7 +83,7 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.zstack - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console.zstack/pom.xml b/com.zsmartsystems.zigbee.console.zstack/pom.xml index bf89ee6063..63accd1916 100644 --- a/com.zsmartsystems.zigbee.console.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.console.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT @@ -17,19 +17,19 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.zstack - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml index 1f83e1b2d2..22f10adff0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml @@ -14,7 +14,7 @@ com.zsmartsystems zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml index 28af35cb2c..5ebc2deab7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT @@ -17,13 +17,13 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.1.11-SNAPSHOT + 1.4.3-SNAPSHOT tests test @@ -31,3 +31,4 @@ + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index 265d366e72..3eefffc8bb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -112,6 +112,13 @@ public void write(int value) { outputData.add(value); } + @Override + public void write(int[] bytes) { + for (int b: bytes) { + outputData.add(b); + } + } + @Override public int read(int timeout) { return read(); From 54a4a03a8df8ccb59f246631e6a855b04cc2f951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 27 Nov 2021 14:10:04 +0100 Subject: [PATCH 12/33] console: mark baudrate as required --- .../zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java index 79e71d9f40..a0be005629 100644 --- a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java +++ b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java @@ -159,7 +159,7 @@ public static void main(final String[] args) { options.addOption(Option.builder("p").longOpt("port").argName("port name").hasArg().desc("Set the port") .required().build()); options.addOption( - Option.builder("b").longOpt("baud").hasArg().argName("baud").desc("Set the port baud rate").build()); + Option.builder("b").longOpt("baud").hasArg().argName("baud").desc("Set the port baud rate").required().build()); options.addOption(Option.builder("f").longOpt("flow").hasArg().argName("type") .desc("Set the flow control (none | hardware | software)").build()); options.addOption(Option.builder("c").longOpt("channel").hasArg().argName("channel id") From 83f5702a3385f55fa5e7e56f747241436f0224e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 27 Nov 2021 16:18:49 +0100 Subject: [PATCH 13/33] Use hardware bootloader reset if necessary --- .../dongle/cc2531/Cc2351TestPacket.java | 8 +++ .../EmberFirmwareUpdateHandlerTest.java | 8 +++ .../internal/ash/AshFrameHandlerTest.java | 8 +++ .../internal/spi/SpiFrameHandlerTest.java | 8 +++ .../TelegesisFirmwareUpdateHandlerTest.java | 8 +++ .../internal/TelegesisFrameHandlerTest.java | 8 +++ .../xbee/internal/XBeeFrameHandlerTest.java | 8 +++ .../dongle/zstack/ZigBeeDongleZstack.java | 4 +- .../internal/ZstackNetworkInitialisation.java | 63 +++++++++++-------- .../internal/ZstackProtocolHandler.java | 2 +- .../internal/ZstackProtocolHandlerTest.java | 8 +++ .../zigbee/serial/ZigBeeSerialPort.java | 14 +++-- .../zigbee/transport/ZigBeePort.java | 10 +++ 13 files changed, 123 insertions(+), 34 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java b/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java index aecbcfe8cc..0449458747 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java +++ b/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java @@ -111,5 +111,13 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } + + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } } } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java index 2b3419ed96..8a4605b56e 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java @@ -202,6 +202,14 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } + public byte[] getOutput() { return Arrays.copyOfRange(output, 0, cnt); } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java index d35af6d74b..62b294eec9 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java @@ -206,6 +206,14 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } + public List getOutputData() { return outputData; } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java index fe3df70a93..6a71caa1d0 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java @@ -354,5 +354,13 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } + + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } } } diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java index 1781a584ad..7ffca8f6a5 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java @@ -203,6 +203,14 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } + public byte[] getOutput() { return Arrays.copyOfRange(output, 0, cnt); } diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java index c053c3c9ad..57ed8c1652 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java @@ -328,5 +328,13 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } + + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } } } diff --git a/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java index 133a63cb9e..486755c25d 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java @@ -151,5 +151,13 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } + + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 449885131f..c8445741ec 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -241,7 +241,7 @@ public ZigBeeStatus initialize() { ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); netInitialiser.setMagicNumber(magicNumber); - netInitialiser.initializeNcp(false); + netInitialiser.initializeNcp(false, serialPort); ZstackNcp ncp = getZstackNcp(); @@ -296,7 +296,7 @@ public ZigBeeStatus startup(boolean reinitialize) { netInitialiser.setMagicNumber(magicNumber); if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); - netInitialiser.initializeNcp(true); + netInitialiser.initializeNcp(true, serialPort); if (deviceType == DeviceType.COORDINATOR) { netInitialiser.formNetwork(); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index fd3710e7fa..a8792bad13 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -7,24 +7,23 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.internal; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.transport.DeviceType; +import com.zsmartsystems.zigbee.transport.ZigBeePort; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; /** * This class provides utility functions to establish a ZStack ZigBee network @@ -91,20 +90,16 @@ public void setMagicNumber(int magicNumber) { * The dongle is not reset completely, thus allowing it to be placed back into the previous network. * * @param initialize set to true to reset the dongle and erase all current network settings + * @param serialPort */ - public ZigBeeStatus initializeNcp(boolean initialize) { + public ZigBeeStatus initializeNcp(boolean initialize, ZigBeePort serialPort) { logger.debug("ZStack Initialisation: Initialise"); ZstackNcp ncp = new ZstackNcp(protocolHandler); - ZstackSysResetIndAreq resetResponse = ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - logger.debug("ZStack Initialisation: Reset response {}", resetResponse); - - if (resetResponse == null) { - // The reset failed - assume we're in the bootloader and try and exit - if (exitBootloader() == false) { - logger.debug("ZStack Initialisation: Failed to exit bootloader"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } + // The reset failed - assume we're in the bootloader and try and exit + if (exitBootloader(serialPort) == false) { + logger.debug("ZStack Initialisation: Failed to exit bootloader"); + return ZigBeeStatus.COMMUNICATION_ERROR; } if (initialize) { @@ -194,20 +189,38 @@ public ZigBeeStatus startNetwork() { * Attempts to exit the bootloader by sending the "magic number" and waiting for the {@link ZstackSysResetIndAreq} * to be received to confirm that the NCP application firmware has started. * + * https://www.ti.com/lit/an/swra466d/swra466d.pdf + * https://www.ti.com/lit/ug/swcu185d/swcu185d.pdf + * * @return true if the {@link ZstackSysResetIndAreq} was received, otherwise false + * @param serialPort Serial port */ - private boolean exitBootloader() { - Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); + private boolean exitBootloader(ZigBeePort serialPort) { + // FIXME this does not work in the OpenHAB binding, as it seems their write() implementation blocks + /* protocolHandler.sendRaw(magicNumber); + if (waitForBoot("Magicnumber")) { + return true; + } + */ + serialPort.setDtr(false); + + serialPort.setRts(false); + serialPort.setRts(true); + serialPort.setRts(false); + + return waitForBoot("Hardware reset"); + } + + private boolean waitForBoot(String resetMode) { + Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); try { ZstackFrameResponse response = waiter.get(BOOTLOAD_TIMEOUT, TimeUnit.MILLISECONDS); - logger.debug("ZStack Initialisation: Bootloader reset response {}", response); - + logger.debug("ZStack Initialisation: Bootloader reset via {} response {}", resetMode, response); return true; } catch (InterruptedException | ExecutionException | TimeoutException e) { - logger.debug("ZStack Initialisation: Bootloader reset failed"); - + logger.debug("ZStack Initialisation: Bootloader reset via {} failed", resetMode, e); return false; } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index ee4b94d999..7ad1b59176 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -519,7 +519,7 @@ public ZstackTransaction sendTransaction(ZstackTransaction transaction) { futureResponse.get(TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException | TimeoutException | ExecutionException e) { futureResponse.cancel(true); - logger.debug("ZSTACK interrupted in sendTransaction for {}", transaction); + logger.debug("ZSTACK interrupted in sendTransaction for {}", transaction, e); } return transaction; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index 3eefffc8bb..1998d7d20e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -150,6 +150,14 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } + @Override + public void setDtr(boolean state) { + } + + @Override + public void setRts(boolean state) { + } + public List getOutputData() { return outputData; } diff --git a/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java b/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java index 24c5d254e4..43f1f88dbe 100644 --- a/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java +++ b/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java @@ -273,19 +273,21 @@ public void purgeRxBuffer() { } } - public boolean setDtr(boolean state) { + @Override + public void setDtr(boolean state) { try { - return serialPort.setDTR(state); + serialPort.setDTR(state); } catch (SerialPortException e) { - return false; + logger.warn("Could not set DTR to {} on {}", state, this.portName, e); } } - public boolean setRts(boolean state) { + @Override + public void setRts(boolean state) { try { - return serialPort.setRTS(state); + serialPort.setRTS(state); } catch (SerialPortException e) { - return false; + logger.warn("Could not set RTS to {} on {}", state, this.portName, e); } } } \ No newline at end of file diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java index 6b52712c8d..1a95a67c8c 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java @@ -85,6 +85,16 @@ public interface ZigBeePort { */ void purgeRxBuffer(); + /** + * Set DTR on Port + */ + void setDtr(boolean state); + + /** + * Set DTS on Port + */ + void setRts(boolean state); + /** * Enumeration of flow control options */ From 43a25ad4811f994a1cf981c915db3c426d3184b4 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sat, 10 Sep 2022 08:42:34 +0200 Subject: [PATCH 14/33] Fixing Zstack branch --- com.zsmartsystems.zigbee.autocode/.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ com.zsmartsystems.zigbee.console/.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ .../.project | 11 ++ .../.project | 17 +++ .../.project | 11 ++ .../.project | 17 +++ com.zsmartsystems.zigbee.dongle.xbee/.project | 11 ++ .../.project | 11 ++ .../src/main/resources/zstack_protocol.xml | 47 ++++++- .../.project | 11 ++ .../dongle/zstack/ZigBeeDongleZstack.java | 127 +++++------------- .../zigbee/dongle/zstack/ZstackNcp.java | 95 ++++--------- .../dongle/zstack/api/ZstackFrameFactory.java | 2 + .../api/sys/ZstackSysOsalNvWriteSreq.java | 2 +- .../api/zdo/ZstackZdoExtNwkInfoSreq.java | 51 +++++++ .../api/zdo/ZstackZdoExtNwkInfoSrsp.java | 96 +++++++++++++ .../internal/ZstackNetworkInitialisation.java | 28 +--- .../internal/ZstackProtocolHandler.java | 46 ++++--- .../ZstackSingleResponseTransaction.java | 76 ----------- .../transaction/ZstackTransaction.java | 58 -------- .../zigbee/dongle/zstack/ZStackNcpTest.java | 45 +++---- .../dongle/zstack/ZigBeeDongleZstackTest.java | 7 +- .../ZstackSingleResponseTransactionTest.java | 64 --------- com.zsmartsystems.zigbee.serial/.project | 11 ++ com.zsmartsystems.zigbee.serial/pom.xml | 4 +- com.zsmartsystems.zigbee/.project | 11 ++ 33 files changed, 522 insertions(+), 436 deletions(-) create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java diff --git a/com.zsmartsystems.zigbee.autocode/.project b/com.zsmartsystems.zigbee.autocode/.project index a27386da2f..7a38cc08e1 100644 --- a/com.zsmartsystems.zigbee.autocode/.project +++ b/com.zsmartsystems.zigbee.autocode/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237406 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.console.ember/.project b/com.zsmartsystems.zigbee.console.ember/.project index f97df57fbc..266c4ad69d 100644 --- a/com.zsmartsystems.zigbee.console.ember/.project +++ b/com.zsmartsystems.zigbee.console.ember/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237418 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.console.main/.project b/com.zsmartsystems.zigbee.console.main/.project index 672224a318..0dd0e6471f 100644 --- a/com.zsmartsystems.zigbee.console.main/.project +++ b/com.zsmartsystems.zigbee.console.main/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237426 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.console.telegesis/.project b/com.zsmartsystems.zigbee.console.telegesis/.project index 90412ce652..6751d3e2b0 100644 --- a/com.zsmartsystems.zigbee.console.telegesis/.project +++ b/com.zsmartsystems.zigbee.console.telegesis/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237433 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.console.zstack/.project b/com.zsmartsystems.zigbee.console.zstack/.project index 5d70aa078c..8204721de1 100644 --- a/com.zsmartsystems.zigbee.console.zstack/.project +++ b/com.zsmartsystems.zigbee.console.zstack/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237440 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.console/.project b/com.zsmartsystems.zigbee.console/.project index 73b4baa7b0..60f6f90e66 100644 --- a/com.zsmartsystems.zigbee.console/.project +++ b/com.zsmartsystems.zigbee.console/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237413 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/.project b/com.zsmartsystems.zigbee.dongle.cc2531/.project index ab1640565b..bf3309027d 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/.project +++ b/com.zsmartsystems.zigbee.dongle.cc2531/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237446 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.conbee/.project b/com.zsmartsystems.zigbee.dongle.conbee/.project index afa224ba91..72f3f6d3c1 100644 --- a/com.zsmartsystems.zigbee.dongle.conbee/.project +++ b/com.zsmartsystems.zigbee.dongle.conbee/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237452 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/.project b/com.zsmartsystems.zigbee.dongle.ember.autocode/.project index efa71c9fdd..8ce2c7d771 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237467 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.ember/.project b/com.zsmartsystems.zigbee.dongle.ember/.project index 82c819d54f..1fd8bf8cad 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/.project +++ b/com.zsmartsystems.zigbee.dongle.ember/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237460 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project index 955eaf0299..cdacbcd20a 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project @@ -10,8 +10,25 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237480 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/.project b/com.zsmartsystems.zigbee.dongle.telegesis/.project index 13c3b5f2f6..4e169a714e 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/.project +++ b/com.zsmartsystems.zigbee.dongle.telegesis/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237474 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project b/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project index e3c5391c52..e824b875eb 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project @@ -10,8 +10,25 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237497 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.xbee/.project b/com.zsmartsystems.zigbee.dongle.xbee/.project index 2563c02c1a..4e096af033 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee/.project +++ b/com.zsmartsystems.zigbee.dongle.xbee/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237490 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project index eefabd1d51..b4dba4c0d6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237511 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 72e11368c3..650e24f7ab 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -840,6 +840,51 @@ + + ZDO_EXT_NWK_INFO + ZDO + 0x50 + + SYNC + + + + + uint16 + ShortAddress + hex[2] + Short address + + + uint16 + PanId + hex[2] + Pan id + + + uint16 + ParentAddress + hex[2] + Parent address + + + ExtendedPanId + ExtendedPanId + Extended pan id + + + IeeeAddr + ExtendedParentAddress + Extended parent address + + + uint8 + Channel + Channel + + + + ZDO_MSG_CB_REGISTER ZDO @@ -1774,7 +1819,7 @@ ZstackConfigId - uint8 + uint16 Device specific configuration parameters. SYS diff --git a/com.zsmartsystems.zigbee.dongle.zstack/.project b/com.zsmartsystems.zigbee.dongle.zstack/.project index b5a16713fc..2ce6b16a85 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/.project +++ b/com.zsmartsystems.zigbee.dongle.zstack/.project @@ -20,4 +20,15 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + + + 1659338237505 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index c8445741ec..035f8771c1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -25,8 +25,10 @@ import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeDeviceType; +import com.zsmartsystems.zigbee.ZigBeeExecutors; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.ZigBeeNodeStatus; +import com.zsmartsystems.zigbee.ZigBeeNwkAddressMode; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.aps.ZigBeeApsFrame; @@ -40,6 +42,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; @@ -52,8 +55,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackNetworkInitialisation; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackStackConfiguration; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackSingleResponseTransaction; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.DeviceType; import com.zsmartsystems.zigbee.transport.TransportConfig; @@ -90,11 +91,6 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH */ private ZigBeePort serialPort; - /** - * The magic number used to make the dongle exit the bootloader - */ - private int magicNumber = ZstackNetworkInitialisation.MAGIC_NUMBER_DEFAULT; - /** * The protocol handler used to send and receive ZStack packets */ @@ -160,6 +156,8 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH */ private boolean networkStateUp = false; + ZigBeeProfileType defaultProfile = ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION; + /** * Boolean to hold initialisation state. Set to true after {@link #startup()} completes. */ @@ -179,9 +177,6 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH */ private long lastSendCommandTime; - private final HashMap sender2Endpoint = new HashMap(); - private final HashMap endpoint2Profile = new HashMap(); - /** * Create a {@link ZigBeeDongleZstack} * @@ -193,6 +188,8 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { // Define the default configuration stackConfiguration = new LinkedHashMap<>(); + stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] {0x00}); + networkKey = new ZigBeeKey(); } @@ -213,19 +210,6 @@ public int[] updateDefaultConfiguration(ZstackConfigId configId, int[] value) { return stackConfiguration.put(configId, value); } - /** - * Different hardware may use a different "Magic Number" to skip waiting in the bootloader. Otherwise - * the dongle may wait in the bootloader for 60 seconds after it's powered on or reset. - *

    - * This method allows the user to change the magic number which may be required when using different - * sticks. - * - * @param magicNumber the byte to send to the dongle to exit the bootloader - */ - public void setMagicNumber(int magicNumber) { - this.magicNumber = magicNumber; - } - @Override public ZigBeeStatus initialize() { logger.debug("ZStack dongle initialize: Starting"); @@ -239,7 +223,6 @@ public ZigBeeStatus initialize() { frameHandler.start(serialPort); ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); - netInitialiser.setMagicNumber(magicNumber); netInitialiser.initializeNcp(false, serialPort); @@ -272,7 +255,7 @@ public ZigBeeStatus initialize() { * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing * of responses is performed in order */ - executorService = Executors.newScheduledThreadPool(1); + executorService = ZigBeeExecutors.newScheduledThreadPool(1, "ZstackTransport"); logger.debug("ZStack dongle initialize: Done"); @@ -293,11 +276,15 @@ public ZigBeeStatus startup(boolean reinitialize) { // If we want to reinitialize the network, then go... ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); - netInitialiser.setMagicNumber(magicNumber); if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); netInitialiser.initializeNcp(true, serialPort); + ZstackSysResetIndAreq result = ncp.resetNcp(ZstackResetType.TARGET_DEVICE); + if (result == null) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } + if (deviceType == DeviceType.COORDINATOR) { netInitialiser.formNetwork(); } else { @@ -315,7 +302,7 @@ public ZigBeeStatus startup(boolean reinitialize) { ncpResponse = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, linkKey.getValue()); if (ncpResponse != ZstackResponseCode.SUCCESS) { logger.debug("ZStack error setting link key: {}", ncpResponse); - // return ZigBeeStatus.COMMUNICATION_ERROR; + return ZigBeeStatus.COMMUNICATION_ERROR; } if (panId == null) { @@ -353,15 +340,16 @@ public ZigBeeStatus startup(boolean reinitialize) { logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); } + // reset the device + ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + // Add the endpoint ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), new int[] { 0 }, new int[] { 0 }); - sender2Endpoint.put(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), 1); - endpoint2Profile.put(1, ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { - logger.debug("ZStack error setting transmit power"); - return ZigBeeStatus.COMMUNICATION_ERROR; + logger.error("ZStack error setting transmit power"); + // return ZigBeeStatus.COMMUNICATION_ERROR; } netInitialiser.startNetwork(); @@ -469,20 +457,12 @@ public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { // Remember the time to reduce unnecessary polling lastSendCommandTime = System.currentTimeMillis(); - final int srcEndpoint; - if (apsFrame.getProfile() == 0) { - srcEndpoint = 0; - } else { - srcEndpoint = (short) getSendingEndpoint(apsFrame.getProfile()); - } - // TODO: How to differentiate group and device addressing????? - ZstackAfDataRequestSreq request = new ZstackAfDataRequestSreq(); request.setClusterID(apsFrame.getCluster()); request.setDstAddr(apsFrame.getDestinationAddress()); request.setDestEndpoint(apsFrame.getDestinationEndpoint()); - request.setSrcEndpoint(srcEndpoint); + request.setSrcEndpoint(apsFrame.getSourceEndpoint()); request.setTransID(apsFrame.getApsCounter()); request.setRadius(apsFrame.getRadius()); request.setData(apsFrame.getPayload()); @@ -493,21 +473,17 @@ public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { request.addOptions(AfDataOptions.AF_EN_SECURITY); } - ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackAfDataRequestSrsp.class); - // We need to correlate with the messageTag executorService.execute(new Runnable() { @Override public void run() { - frameHandler.sendTransaction(transaction); - - ZstackAfDataRequestSrsp response = (ZstackAfDataRequestSrsp) transaction.getResponse(); + ZstackAfDataRequestSrsp response = frameHandler.sendTransaction(request, ZstackAfDataRequestSrsp.class); ZigBeeTransportProgressState sentHandlerState; if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { - sentHandlerState = ZigBeeTransportProgressState.RX_NAK; + sentHandlerState = ZigBeeTransportProgressState.TX_NAK; } else { - sentHandlerState = ZigBeeTransportProgressState.RX_ACK; + sentHandlerState = ZigBeeTransportProgressState.TX_ACK; } zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); @@ -525,12 +501,12 @@ public void handlePacket(ZstackCommand response) { if (response instanceof ZstackAfIncomingMsgAreq) { ZstackAfIncomingMsgAreq incomingMsg = (ZstackAfIncomingMsgAreq) response; ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setProfile(defaultProfile.getKey()); apsFrame.setCluster(incomingMsg.getClusterId()); apsFrame.setDestinationAddress(nwkAddress); apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setProfile(getEndpointProfile(incomingMsg.getDestEndpoint())); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); apsFrame.setPayload(incomingMsg.getData()); @@ -546,15 +522,17 @@ public void handlePacket(ZstackCommand response) { ZstackZdoMsgCbIncomingAreq incomingMsg = (ZstackZdoMsgCbIncomingAreq) response; ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setProfile(0); apsFrame.setCluster(incomingMsg.getClusterId()); - apsFrame.setDestinationAddress(nwkAddress); + apsFrame.setDestinationAddress(incomingMsg.getDstAddr()); apsFrame.setDestinationEndpoint(0); - apsFrame.setSourceEndpoint(0); apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setProfile(0); + apsFrame.setSourceEndpoint(0); apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); + apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); int[] payload = new int[incomingMsg.getData().length + 1]; + payload[0] = incomingMsg.getSeqNumber(); System.arraycopy(incomingMsg.getData(), 0, payload, 1, incomingMsg.getData().length); apsFrame.setPayload(payload); @@ -600,8 +578,7 @@ public void run() { if (response instanceof ZstackZdoTcDevIndAreq) { ZstackZdoTcDevIndAreq tcDeviceInd = (ZstackZdoTcDevIndAreq) response; - zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, tcDeviceInd.getSrcAddr(), - tcDeviceInd.getExtAddr()); + zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, tcDeviceInd.getSrcAddr(), tcDeviceInd.getExtAddr()); return; } } @@ -635,7 +612,7 @@ public void run() { @Override public ZigBeeChannel getZigBeeChannel() { - return ZigBeeChannel.create(0); + return ZigBeeChannel.create(getZstackNcp().getNetworkInfo().getChannel()); } @Override @@ -650,7 +627,7 @@ public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { @Override public int getZigBeePanId() { - return 0; + return getZstackNcp().getNetworkInfo().getPanId(); } @Override @@ -665,7 +642,7 @@ public ZigBeeStatus setZigBeePanId(int panId) { @Override public ExtendedPanId getZigBeeExtendedPanId() { - return extendedPanId; + return new ExtendedPanId(getZstackNcp().getNetworkInfo().getExtendedPanId()); } @Override @@ -689,8 +666,7 @@ public ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key) { @Override public ZigBeeKey getZigBeeNetworkKey() { - ZstackNcp ncp = getZstackNcp(); - return ncp.getNetworkKey(); + return getZstackNcp().getNetworkKey(); } @Override @@ -796,39 +772,4 @@ private ZigBeeStatus setTxPower(int txPower) { public String getVersionString() { return versionString; } - - /** - * Gets the endpoint given the profile - for sending - * - * @param profileId the profile ID - * @return the endpoint used for this profile - */ - private int getSendingEndpoint(int profileId) { - synchronized (sender2Endpoint) { - if (sender2Endpoint.containsKey(profileId)) { - return sender2Endpoint.get(profileId); - } else { - logger.info("No endpoint registered for profileId={}", profileId); - return -1; - } - } - } - - /** - * Gets the profile used in an endpoint. - * - * @param endpointId the endpoint - * @return the profile used in the endpoint - */ - private int getEndpointProfile(int endpointId) { - synchronized (endpoint2Profile) { - if (endpoint2Profile.containsKey(endpointId)) { - return endpoint2Profile.get(endpointId); - } else { - logger.info("No endpoint {} registered", endpointId); - // final byte ep = createEndPoint( profileId); - return -1; - } - } - } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index 710f9bb833..ec552217cb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -58,14 +58,14 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackSingleResponseTransaction; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.DeviceType; @@ -85,7 +85,7 @@ public class ZstackNcp { /** * Flag to use the old (deprecated) config functions */ - private boolean useOldCfgCalls = true; + private boolean useOldCfgCalls = false; /* * Startup options bitmap @@ -116,9 +116,7 @@ public ZstackNcp(ZstackProtocolHandler protocolHandler) { public ZstackSysResetIndAreq resetNcp(ZstackResetType resetType) { ZstackSysResetReqAcmd request = new ZstackSysResetReqAcmd(); request.setType(resetType); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysResetIndAreq.class)); - ZstackSysResetIndAreq response = (ZstackSysResetIndAreq) transaction.getResponse(); + ZstackSysResetIndAreq response = protocolHandler.sendTransaction(request, ZstackSysResetIndAreq.class); if (response == null) { logger.debug("No response from Reset command"); return null; @@ -136,9 +134,7 @@ public ZstackSysResetIndAreq resetNcp(ZstackResetType resetType) { */ public Set pingNcp() { ZstackSysPingSreq request = new ZstackSysPingSreq(); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysPingSrsp.class)); - ZstackSysPingSrsp response = (ZstackSysPingSrsp) transaction.getResponse(); + ZstackSysPingSrsp response = protocolHandler.sendTransaction(request, ZstackSysPingSrsp.class); if (response == null) { logger.debug("No response from Ping command"); return Collections.emptySet(); @@ -164,10 +160,7 @@ public Set pingNcp() { * @return the {@link ZstackSysVersionSrsp} */ public ZstackSysVersionSrsp getVersion() { - ZstackSysVersionSreq request = new ZstackSysVersionSreq(); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysVersionSrsp.class)); - ZstackSysVersionSrsp response = (ZstackSysVersionSrsp) transaction.getResponse(); + ZstackSysVersionSrsp response = protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); if (response == null) { logger.debug("No response from Version command"); return null; @@ -177,16 +170,17 @@ public ZstackSysVersionSrsp getVersion() { return response; } + public ZstackZdoExtNwkInfoSrsp getNetworkInfo() { + return protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); + } + /** * The command reads the device information from the NCP * * @return the {@link ZstackUtilGetDeviceInfoSrsp} */ public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { - ZstackUtilGetDeviceInfoSreq request = new ZstackUtilGetDeviceInfoSreq(); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilGetDeviceInfoSrsp.class)); - ZstackUtilGetDeviceInfoSrsp response = (ZstackUtilGetDeviceInfoSrsp) transaction.getResponse(); + ZstackUtilGetDeviceInfoSrsp response = protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); if (response == null) { logger.debug("No response from DeviceInfo command"); return null; @@ -203,9 +197,7 @@ public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { */ public ZstackUtilGetNvInfoSrsp getNvDeviceInfo() { ZstackUtilGetNvInfoSreq request = new ZstackUtilGetNvInfoSreq(); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilGetNvInfoSrsp.class)); - ZstackUtilGetNvInfoSrsp response = (ZstackUtilGetNvInfoSrsp) transaction.getResponse(); + ZstackUtilGetNvInfoSrsp response = protocolHandler.sendTransaction(request, ZstackUtilGetNvInfoSrsp.class); if (response == null) { logger.debug("No response from NvInfo command"); return null; @@ -250,9 +242,7 @@ public int getNwkAddress() { public Long getDiagnosticsAttribute(ZstackDiagnosticAttribute attributeId) { ZstackSysZdiagsGetStatsSreq request = new ZstackSysZdiagsGetStatsSreq(); request.setAttributeID(attributeId); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysZdiagsGetStatsSrsp.class)); - ZstackSysZdiagsGetStatsSrsp response = (ZstackSysZdiagsGetStatsSrsp) transaction.getResponse(); + ZstackSysZdiagsGetStatsSrsp response = protocolHandler.sendTransaction(request, ZstackSysZdiagsGetStatsSrsp.class); if (response == null) { logger.debug("No response from GetDiagnostics command"); return null; @@ -306,9 +296,7 @@ public int[] readConfiguration(ZstackConfigId configId) { if (useOldCfgCalls) { ZstackZbReadConfigurationSreq request = new ZstackZbReadConfigurationSreq(); request.setConfigId(configId); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZbReadConfigurationSrsp.class)); - ZstackZbReadConfigurationSrsp response = (ZstackZbReadConfigurationSrsp) transaction.getResponse(); + ZstackZbReadConfigurationSrsp response = protocolHandler.sendTransaction(request, ZstackZbReadConfigurationSrsp.class); if (response == null) { logger.debug("No response from ReadConfiguration command"); return null; @@ -322,9 +310,7 @@ public int[] readConfiguration(ZstackConfigId configId) { } else { ZstackSysOsalNvReadSreq request = new ZstackSysOsalNvReadSreq(); request.setId(configId); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysOsalNvReadSrsp.class)); - ZstackSysOsalNvReadSrsp response = (ZstackSysOsalNvReadSrsp) transaction.getResponse(); + ZstackSysOsalNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvReadSrsp.class); if (response == null) { logger.debug("No response from ReadConfiguration command"); return null; @@ -350,9 +336,7 @@ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] valu ZstackZbWriteConfigurationSreq request = new ZstackZbWriteConfigurationSreq(); request.setConfigId(configId); request.setValue(value); - ZstackTransaction transaction = protocolHandler.sendTransaction( - new ZstackSingleResponseTransaction(request, ZstackZbWriteConfigurationSrsp.class)); - ZstackZbWriteConfigurationSrsp response = (ZstackZbWriteConfigurationSrsp) transaction.getResponse(); + ZstackZbWriteConfigurationSrsp response = protocolHandler.sendTransaction(request, ZstackZbWriteConfigurationSrsp.class); if (response == null) { logger.debug("No response from WriteConfiguration command"); return ZstackResponseCode.FAILURE; @@ -363,9 +347,7 @@ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] valu ZstackSysOsalNvWriteSreq request = new ZstackSysOsalNvWriteSreq(); request.setId(configId); request.setValue(value); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysOsalNvWriteSrsp.class)); - ZstackSysOsalNvWriteSrsp response = (ZstackSysOsalNvWriteSrsp) transaction.getResponse(); + ZstackSysOsalNvWriteSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvWriteSrsp.class); if (response == null) { logger.debug("No response from WriteConfiguration command"); return ZstackResponseCode.FAILURE; @@ -465,9 +447,7 @@ public ZstackResponseCode setNetworkSecurity(boolean enableSecurity) { public Integer setTxPower(int txPower) { ZstackSysSetTxPowerSreq request = new ZstackSysSetTxPowerSreq(); request.setTxPower(txPower); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackSysSetTxPowerSrsp.class)); - ZstackSysSetTxPowerSrsp response = (ZstackSysSetTxPowerSrsp) transaction.getResponse(); + ZstackSysSetTxPowerSrsp response = protocolHandler.sendTransaction(request, ZstackSysSetTxPowerSrsp.class); if (response == null) { logger.debug("No response from SetTxPower command"); return null; @@ -486,9 +466,7 @@ public ZstackResponseCode setChannelMask(ZigBeeChannelMask channelMask) { // TODO: ZCD_NV_CHANLIST ZstackUtilSetChannelsSreq request = new ZstackUtilSetChannelsSreq(); request.setChannels(channelMask.getChannelMask()); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackUtilSetChannelsSrsp.class)); - ZstackUtilSetChannelsSrsp response = (ZstackUtilSetChannelsSrsp) transaction.getResponse(); + ZstackUtilSetChannelsSrsp response = protocolHandler.sendTransaction(request, ZstackUtilSetChannelsSrsp.class); if (response == null) { logger.debug("No response from SetChannels command"); return ZstackResponseCode.FAILURE; @@ -505,9 +483,7 @@ public ZstackResponseCode setChannelMask(ZigBeeChannelMask channelMask) { public ZstackResponseCode startupApplication() { ZstackZdoStartupFromAppSreq request = new ZstackZdoStartupFromAppSreq(); request.setStartDelay(100); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoStartupFromAppSrsp.class)); - ZstackZdoStartupFromAppSrsp response = (ZstackZdoStartupFromAppSrsp) transaction.getResponse(); + ZstackZdoStartupFromAppSrsp response = protocolHandler.sendTransaction(request, ZstackZdoStartupFromAppSrsp.class); if (response == null) { logger.debug("No response from startupApplication command"); return ZstackResponseCode.FAILURE; @@ -527,10 +503,7 @@ public ZstackResponseCode startupApplication() { public ZstackResponseCode requireKeyExchange(boolean required) { ZstackAppCnfBdbSetTcRequireKeyExchangeSreq request = new ZstackAppCnfBdbSetTcRequireKeyExchangeSreq(); request.setTrustCenterRequireKeyExchange(required); - ZstackTransaction transaction = protocolHandler.sendTransaction( - new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class)); - ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp response = (ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp) transaction - .getResponse(); + ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); if (response == null) { logger.debug("No response from requireKeyExchange command"); return ZstackResponseCode.FAILURE; @@ -552,10 +525,7 @@ public ZstackResponseCode setCentralisedKey(ZstackCentralizedLinkKeyMode mode, i ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq request = new ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq(); request.setCentralizedLinkKeyMode(mode); request.setInstallCode(installCode); - ZstackTransaction transaction = protocolHandler.sendTransaction( - new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class)); - ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp response = (ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp) transaction - .getResponse(); + ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); if (response == null) { logger.debug("No response from setCentralisedKey command"); return ZstackResponseCode.FAILURE; @@ -575,10 +545,7 @@ public ZstackResponseCode setCentralisedKey(ZstackCentralizedLinkKeyMode mode, i public ZstackResponseCode allowRejoin(boolean allow) { ZstackAppCnfSetAllowrejoinTcPolicySreq request = new ZstackAppCnfSetAllowrejoinTcPolicySreq(); request.setAllowRejoin(allow); - ZstackTransaction transaction = protocolHandler.sendTransaction( - new ZstackSingleResponseTransaction(request, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class)); - ZstackAppCnfSetAllowrejoinTcPolicySrsp response = (ZstackAppCnfSetAllowrejoinTcPolicySrsp) transaction - .getResponse(); + ZstackAppCnfSetAllowrejoinTcPolicySrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); if (response == null) { logger.debug("No response from allowRejoin command"); return ZstackResponseCode.FAILURE; @@ -595,9 +562,7 @@ public ZstackResponseCode allowRejoin(boolean allow) { public ZstackResponseCode zdoRegisterCallback(int clusterId) { ZstackZdoMsgCbRegisterSreq request = new ZstackZdoMsgCbRegisterSreq(); request.setClusterId(clusterId); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackZdoMsgCbRegisterSrsp.class)); - ZstackZdoMsgCbRegisterSrsp response = (ZstackZdoMsgCbRegisterSrsp) transaction.getResponse(); + ZstackZdoMsgCbRegisterSrsp response = protocolHandler.sendTransaction(request, ZstackZdoMsgCbRegisterSrsp.class); if (response == null) { logger.debug("No response from RegisterZdoCallback command"); return ZstackResponseCode.FAILURE; @@ -616,8 +581,7 @@ public ZstackResponseCode zdoRegisterCallback(int clusterId) { * @param outputClusters an array of output clusters supported by the endpoint * @return {@link ZstackResponseCode} returned from the NCP */ - public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters, - int[] outputClusters) { + public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters, int[] outputClusters) { ZstackAfRegisterSreq request = new ZstackAfRegisterSreq(); request.setEndPoint(endpointId); request.setAppDeviceId(deviceId); @@ -627,9 +591,7 @@ public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileI request.setLatencyReq(0); request.setAppDevVer(0); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackAfRegisterSrsp.class)); - ZstackAfRegisterSrsp response = (ZstackAfRegisterSrsp) transaction.getResponse(); + ZstackAfRegisterSrsp response = protocolHandler.sendTransaction(request, ZstackAfRegisterSrsp.class); if (response == null) { logger.debug("No response from RegisterEndpoint command"); return ZstackResponseCode.FAILURE; @@ -651,9 +613,7 @@ public ZstackResponseCode addInstallCode(IeeeAddress ieeeAddress, ZigBeeKey key) request.setIeeeAddress(ieeeAddress); request.setInstallCode(key); - ZstackTransaction transaction = protocolHandler - .sendTransaction(new ZstackSingleResponseTransaction(request, ZstackAppCnfBdbAddInstallcodeSrsp.class)); - ZstackAppCnfBdbAddInstallcodeSrsp response = (ZstackAppCnfBdbAddInstallcodeSrsp) transaction.getResponse(); + ZstackAppCnfBdbAddInstallcodeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbAddInstallcodeSrsp.class); if (response == null) { logger.debug("No response from AddInstallCode command"); return ZstackResponseCode.FAILURE; @@ -673,5 +633,4 @@ private int[] valueFromUInt8(int value) { private int[] valueFromUInt16(int value) { return new int[] { value & 0xFF, (value >> 8) & 0xFF }; } - } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java index 8a45c3e40e..ba4cf51c09 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -46,6 +46,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPanidSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPrecfgkeySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetSeclevelSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoGetLinkKeySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoLeaveIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; @@ -197,6 +198,7 @@ public class ZstackFrameFactory { zstackFrameMap.put(ZSTACK_ZDO + ZDO_STARTUP_FROM_APP, ZstackZdoStartupFromAppSrsp.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_STATE_CHANGE_IND, ZstackZdoStateChangeIndAreq.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_TC_DEV_IND, ZstackZdoTcDevIndAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + 0x50, ZstackZdoExtNwkInfoSrsp.class); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java index 090a4421f6..4a82e6d37c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java @@ -109,7 +109,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x09); // Serialize the fields - serializer.serializeUInt8(id.getKey()); + serializer.serializeUInt16(id.getKey()); serializer.serializeUInt8(offset); serializer.serializeUInt8(value.length); serializer.serializeUInt8Array(value); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java new file mode 100644 index 0000000000..006d341686 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

    + * This command retrieves the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoExtNwkInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackZdoExtNwkInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x50)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x50); + + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackZdoExtNwkInfoSreq [ieeeAddr="); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java new file mode 100644 index 0000000000..4b94ca6e4f --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

    + * This command retrieves the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackZdoExtNwkInfoSrsp extends ZstackFrameResponse { + + private int shortAddress; + public int getShortAddress() { + return shortAddress; + } + + public void setShortAddress(int shortAddress) { + this.shortAddress = shortAddress; + } + + private int panId; + public int getPanId() { + return panId; + } + + public void setPanId(int panId) { + this.panId = panId; + } + + private int parentAddress; + public int getParentAddress() { + return parentAddress; + } + + public void setParentAddress(int parentAddress) { + this.parentAddress = parentAddress; + } + + private int[] extendedPanId; + public int[] getExtendedPanId() { + return extendedPanId; + } + + public void setExtendedPanId(int[] extendedPanId) { + this.extendedPanId = extendedPanId; + } + + private IeeeAddress extendedParentAddress; + public IeeeAddress getExtendedParentAddress() { + return extendedParentAddress; + } + + public void setExtendedParentAddress(IeeeAddress extendedParentAddress) { + this.extendedParentAddress = extendedParentAddress; + } + + private int channel; + + public int getChannel() { + return channel; + } + + public void setChannel(int channel) { + this.channel = channel; + } + + /** + * Response and Handler constructor + */ + public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + shortAddress = deserializer.deserializeUInt16(); + panId = deserializer.deserializeUInt16(); + parentAddress = deserializer.deserializeUInt16(); + extendedPanId = deserializer.deserializeUInt8Array(8); + extendedParentAddress = deserializer.deserializeIeeeAddress(); + channel = deserializer.deserializeUInt8(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index a8792bad13..b4e597561a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -57,11 +57,6 @@ public class ZstackNetworkInitialisation { */ private ZstackProtocolHandler protocolHandler; - /** - * The magic number used to make the dongle exit the bootloader - */ - private int magicNumber = MAGIC_NUMBER_DEFAULT; - /** * @param protocolHandler the {@link ZstackProtocolHandler} used to communicate with the NCP */ @@ -69,19 +64,6 @@ public ZstackNetworkInitialisation(ZstackProtocolHandler protocolHandler) { this.protocolHandler = protocolHandler; } - /** - * Different hardware may use a different "Magic Number" to skip waiting in the bootloader. Otherwise - * the dongle may wait in the bootloader for 60 seconds after it's powered on or reset. - *

    - * This method allows the user to change the magic number which may be required when using different - * sticks. - * - * @param magicNumber - */ - public void setMagicNumber(int magicNumber) { - this.magicNumber = magicNumber; - } - /** * This method performs the initial initialisation of the dongle application firmware. This simply starts the * dongle, ensuring that it enters the application (ie exiting the bootloader) and sets the configuration to use the @@ -155,7 +137,7 @@ public ZigBeeStatus startNetwork() { logger.debug("ZStack starting network"); ZstackNcp ncp = new ZstackNcp(protocolHandler); - ncp.setNetworkSecurity(true); + // ncp.setNetworkSecurity(true); ncp.zdoRegisterCallback(0x0006);// MatchDescriptorRequest ncp.zdoRegisterCallback(0x0013);// DeviceAnnounce @@ -214,7 +196,7 @@ private boolean exitBootloader(ZigBeePort serialPort) { } private boolean waitForBoot(String resetMode) { - Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); + Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); try { ZstackFrameResponse response = waiter.get(BOOTLOAD_TIMEOUT, TimeUnit.MILLISECONDS); logger.debug("ZStack Initialisation: Bootloader reset via {} response {}", resetMode, response); @@ -252,11 +234,9 @@ public boolean waitForNcpOnline(ZstackNcp ncp) { long waitTime = System.currentTimeMillis() + ONLINE_TIMEOUT; while (waitTime > System.currentTimeMillis()) { logger.debug("ZStack dongle waiting for NCP to come online"); - Future stateChangeFuture = protocolHandler - .waitForEvent(ZstackZdoStateChangeIndAreq.class); + Future stateChangeFuture = protocolHandler.waitForEvent(ZstackZdoStateChangeIndAreq.class); try { - ZstackZdoStateChangeIndAreq stateChange = (ZstackZdoStateChangeIndAreq) stateChangeFuture.get(500, - TimeUnit.MILLISECONDS); + ZstackZdoStateChangeIndAreq stateChange = stateChangeFuture.get(500, TimeUnit.MILLISECONDS); if (isStackOnline(stateChange.getState())) { return true; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index 7ad1b59176..b714fa3029 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -28,7 +28,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameFactory; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; import com.zsmartsystems.zigbee.transport.ZigBeePort; /** @@ -38,7 +38,6 @@ * */ public class ZstackProtocolHandler { - private static int ZSTACK_MIN_LENGTH = 3; private static int ZSTACK_MAX_LENGTH = 100; /** @@ -375,22 +374,23 @@ public void sendRaw(int rawByte) { * @param transaction Request {@link ZstackTransaction} * @return response {@link Future} {@link ZstackFrameResponse} */ - public Future sendZstackRequestAsync(final ZstackTransaction transaction) { + public Future sendZstackRequestAsync(final REQ request, final Class responseType) { if (closeHandler) { logger.debug("ZSTACK: Handler is closed"); return null; } - class TransactionWaiter implements Callable, ZstackListener { + class TransactionWaiter implements Callable, ZstackListener { private boolean complete = false; + private RES response = null; @Override - public ZstackFrameResponse call() { + public RES call() { // Register a listener addTransactionListener(this); // Send the transaction - queueFrame(transaction.getRequest()); + queueFrame(request); // Wait for the transaction to complete synchronized (this) { @@ -406,18 +406,20 @@ public ZstackFrameResponse call() { // Remove the listener removeTransactionListener(this); - return null;// response; + return response; } @Override public boolean transactionEvent(ZstackFrameResponse response) { // Check if this response completes our transaction - if (!transaction.isMatch(response)) { + if (responseType.isInstance(response)) { + this.response = responseType.cast(response); + } else if (ZstackRpcSreqErrorSrsp.class.isInstance(response) && request.matchSreqError((ZstackRpcSreqErrorSrsp) response)) { + } else { return false; } transactionComplete(); - // response = request; return true; } @@ -431,7 +433,7 @@ public void transactionComplete() { } } - Callable worker = new TransactionWaiter(); + Callable worker = new TransactionWaiter(); return executor.submit(worker); } @@ -441,18 +443,18 @@ public void transactionComplete() { * @param transaction Request {@link ZstackTransaction} * @return response {@link Future} {@link ZstackFrameResponse} */ - public Future waitForEvent(final Class requiredResponse) { + public Future waitForEvent(final Class requiredResponse) { if (closeHandler) { logger.debug("ZSTACK: Handler is closed"); return null; } - class TransactionWaiter implements Callable, ZstackListener { + class TransactionWaiter implements Callable, ZstackListener { private boolean complete = false; - private ZstackFrameResponse response; + private RES response; @Override - public ZstackFrameResponse call() { + public RES call() { // Register a listener addTransactionListener(this); @@ -481,7 +483,7 @@ public boolean transactionEvent(ZstackFrameResponse response) { } transactionComplete(); - this.response = response; + this.response = requiredResponse.cast(response); return true; } @@ -495,7 +497,7 @@ public void transactionComplete() { } } - Callable worker = new TransactionWaiter(); + Callable worker = new TransactionWaiter(); return executor.submit(worker); } @@ -506,23 +508,23 @@ public void transactionComplete() { * @param transaction Request {@link ZstackTransaction} * @return response {@link ZstackCommand} */ - public ZstackTransaction sendTransaction(ZstackTransaction transaction) { - logger.debug("QUEUE ZSTACK: {}", transaction.getRequest()); + public RES sendTransaction(REQ request, Class responseType) { + logger.debug("QUEUE ZSTACK: {}", request); - Future futureResponse = sendZstackRequestAsync(transaction); + Future futureResponse = sendZstackRequestAsync(request, responseType); if (futureResponse == null) { logger.debug("ZSTACK: Error sending transaction: Future is null"); return null; } try { - futureResponse.get(TIMEOUT, TimeUnit.MILLISECONDS); + return futureResponse.get(TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException | TimeoutException | ExecutionException e) { futureResponse.cancel(true); - logger.debug("ZSTACK interrupted in sendTransaction for {}", transaction, e); + logger.debug("ZSTACK interrupted in sendTransaction for {}", request, e); } - return transaction; + return null; } private String frameToString(int[] inputBuffer) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java deleted file mode 100644 index 6c843e7efc..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransaction.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) 2016-2019 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; - -import java.util.Arrays; -import java.util.List; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Single ZStack transaction response handling. This matches a {@link ZstackFrameRequest} with a single - * {@link ZstackFrameResponse}. - * - * @author Chris Jackson - * - */ -public class ZstackSingleResponseTransaction implements ZstackTransaction { - private ZstackFrameRequest request; - private ZstackFrameResponse response; - private Class requiredResponse; - - public ZstackSingleResponseTransaction(ZstackFrameRequest request, Class requiredResponse) { - this.request = request; - this.requiredResponse = requiredResponse; - } - - @Override - public boolean isMatch(ZstackFrameResponse response) { - if (response.getClass() == requiredResponse) { - this.response = response; - return true; - } - - // If this is an RPC Error Response, then it might be telling us that the command we tried to send is - // unsupported. - // We need to terminate the transaction if this is true. - if (response instanceof ZstackRpcSreqErrorSrsp) { - return request.matchSreqError((ZstackRpcSreqErrorSrsp) response); - } - return false; - } - - @Override - public ZstackFrameRequest getRequest() { - return request; - } - - @Override - public ZstackFrameResponse getResponse() { - return response; - } - - @Override - public List getResponses() { - if (response == null) { - return null; - } - - // This transaction only allows a single response - return Arrays.asList(response); - } - - @Override - public String toString() { - return "ZstackSingleResponseTransaction [request=" + request + ", requiredResponse=" - + requiredResponse.getSimpleName() + ", response=" + response + "]"; - } - -} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java deleted file mode 100644 index 1d519794da..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackTransaction.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2016-2019 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; - -import java.util.List; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Interface for ZStack protocol transaction. - *

    - * The transaction looks for a received {@link ZstackFrameResponse} that matches the sent {@link ZstackFrameRequest}. - * Generally, this is matching the Srsp matching the Sreq. - * The {@link ZstackFrameRequest} and {@link ZstackFrameResponse} classes are provided when the transaction is created. - * - * @author Chris Jackson - * - */ -public interface ZstackTransaction { - /** - * Matches request and response. - * - * @param response the response {@link ZstackFrameResponse} - * @return true if response matches the request - */ - boolean isMatch(ZstackFrameResponse response); - - /** - * Gets the {@link ZstackFrameRequest} associated with this transaction - * - * @return the {@link ZstackFrameRequest} - */ - ZstackFrameRequest getRequest(); - - /** - * Gets the {@link ZstackFrameResponse} for the transaction. If multiple responses are returned, this will return - * the - * last response, indicating the final response used to complete the transaction. - * - * @return {@link ZstackFrameResponse} to complete the transaction or null if no response received - */ - ZstackFrameResponse getResponse(); - - /** - * Gets a {@link List} of the {@link ZstackFrameResponse}s received for the transaction. This is used for - * transactions - * returning multiple responses - for single response transactions, use {@link #getResponse}. - * - * @return {@link ZstackFrameResponse} to complete the transaction or null if no response received - */ - List getResponses(); -} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java index 5a0aa9624e..c18c5596b2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -34,7 +34,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; /** * @@ -42,21 +41,19 @@ * */ public class ZStackNcpTest { - private ArgumentCaptor transactionCapture = ArgumentCaptor.forClass(ZstackTransaction.class); + private ArgumentCaptor transactionCapture = ArgumentCaptor.forClass(ZstackFrameRequest.class); private ZstackProtocolHandler handler; private ZstackNcp getZstackNcp(ZstackFrameResponse response) { handler = Mockito.mock(ZstackProtocolHandler.class); ZstackNcp ncp = new ZstackNcp(handler); - ZstackTransaction transaction = Mockito.mock(ZstackTransaction.class); - Mockito.when(transaction.getResponse()).thenReturn(response); - Mockito.doAnswer(new Answer() { + Mockito.doAnswer(new Answer() { @Override - public ZstackTransaction answer(InvocationOnMock invocation) { - return transaction; + public ZstackFrameResponse answer(InvocationOnMock invocation) { + return response; } - }).when(handler).sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + }).when(handler).sendTransaction(ArgumentMatchers.any(ZstackFrameRequest.class), ArgumentMatchers.eq(response.getClass())); return ncp; } @@ -66,17 +63,17 @@ public void resetNcp() { ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackSysResetIndAreq.class)); ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackSysResetIndAreq.class); - ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + ZstackFrameRequest request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackSysResetReqAcmd); assertEquals(ZstackResetType.SERIAL_BOOTLOADER, ((ZstackSysResetReqAcmd) request).getType()); ncp.resetNcp(ZstackResetType.TARGET_DEVICE); - Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture()); + Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackSysResetIndAreq.class); - request = transactionCapture.getValue().getRequest(); + request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackSysResetReqAcmd); assertEquals(ZstackResetType.TARGET_DEVICE, ((ZstackSysResetReqAcmd) request).getType()); @@ -91,9 +88,9 @@ public void pingNcp() { Set capabilities = ncp.pingNcp(); System.out.println("Capabilities returned " + capabilities); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackSysPingSrsp.class); - ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + ZstackFrameRequest request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackSysPingSreq); assertEquals(7, capabilities.size()); @@ -110,11 +107,11 @@ public void getDeviceInfo() { ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); System.out.println("Device info returned " + deviceInfo); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackUtilGetDeviceInfoSrsp.class); assertEquals(0x1234, deviceInfo.getShortAddr()); assertEquals(new IeeeAddress("1234567890ABCDEF"), deviceInfo.getIeeeAddress()); - ZstackFrameRequest request = transactionCapture.getValue().getRequest(); + ZstackFrameRequest request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackUtilGetDeviceInfoSreq); @@ -127,19 +124,19 @@ public void setStartupOptions() { ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackZbWriteConfigurationSrsp.class)); ncp.setStartupOptions(false, false); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture()); - assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); ncp.setStartupOptions(true, false); - Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture()); - assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); ncp.setStartupOptions(false, true); - Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture()); - assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); ncp.setStartupOptions(true, true); - Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture()); - assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue().getRequest()).getValue()[0]); + Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index 9bc7ac0899..e29fe00c4c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -26,10 +26,11 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; -import com.zsmartsystems.zigbee.dongle.zstack.internal.transaction.ZstackTransaction; import com.zsmartsystems.zigbee.transport.ZigBeePort; import com.zsmartsystems.zigbee.transport.ZigBeeTransportProgressState; import com.zsmartsystems.zigbee.transport.ZigBeeTransportReceive; @@ -150,7 +151,7 @@ public void sendCommandUnicast() throws Exception { dongle.sendCommand(1, apsFrame); Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) - .sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + .sendTransaction(ArgumentMatchers.any(ZstackAfDataRequestSreq.class), ArgumentMatchers.eq(ZstackAfDataRequestSrsp.class)); } @Test @@ -174,7 +175,7 @@ public void sendCommandBroadcast() throws Exception { dongle.sendCommand(1, apsFrame); Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) - .sendTransaction(ArgumentMatchers.any(ZstackTransaction.class)); + .sendTransaction(ArgumentMatchers.any(ZstackAfDataRequestSreq.class), ArgumentMatchers.eq(ZstackAfDataRequestSrsp.class)); } @Test diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java deleted file mode 100644 index 5d31ea4234..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/transaction/ZstackSingleResponseTransactionTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2016-2019 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.internal.transaction; - -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 org.junit.Test; - -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; - -/** - * - * @author Chris Jackson - * - */ -public class ZstackSingleResponseTransactionTest { - @Test - public void testResponseMatches() { - ZstackUtilLedControlSreq request = new ZstackUtilLedControlSreq(); - request.setLedId(1); - request.setMode(false); - System.out.println(request); - - ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackUtilLedControlSrsp.class); - - ZstackUtilLedControlSrsp response = new ZstackUtilLedControlSrsp(new int[] { 0x00, 0x00, 0x34, 0x12 }); - System.out.println(response); - - assertTrue(transaction.isMatch(response)); - - assertEquals(request, transaction.getRequest()); - assertNotNull(transaction.getResponse()); - assertEquals(response, transaction.getResponse()); - } - - @Test - public void testResponseMatchFails() { - ZstackUtilLedControlSreq request = new ZstackUtilLedControlSreq(); - request.setLedId(1); - request.setMode(false); - System.out.println(request); - - ZstackTransaction transaction = new ZstackSingleResponseTransaction(request, ZstackUtilLedControlSrsp.class); - - ZstackUtilSetChannelsSrsp response = new ZstackUtilSetChannelsSrsp(new int[] { 0x00, 0x00, 0x34, 0x12 }); - System.out.println(response); - - assertFalse(transaction.isMatch(response)); - - assertEquals(request, transaction.getRequest()); - assertNull(transaction.getResponse()); - } -} diff --git a/com.zsmartsystems.zigbee.serial/.project b/com.zsmartsystems.zigbee.serial/.project index 7480b855c6..b11f0ee946 100644 --- a/com.zsmartsystems.zigbee.serial/.project +++ b/com.zsmartsystems.zigbee.serial/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237516 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + diff --git a/com.zsmartsystems.zigbee.serial/pom.xml b/com.zsmartsystems.zigbee.serial/pom.xml index c3895d0500..c8f9e350c5 100644 --- a/com.zsmartsystems.zigbee.serial/pom.xml +++ b/com.zsmartsystems.zigbee.serial/pom.xml @@ -25,9 +25,9 @@ - org.scream3r + io.github.java-native jssc - 2.8.0 + 2.9.4 diff --git a/com.zsmartsystems.zigbee/.project b/com.zsmartsystems.zigbee/.project index e332fa7c4e..09b4641ddb 100644 --- a/com.zsmartsystems.zigbee/.project +++ b/com.zsmartsystems.zigbee/.project @@ -20,4 +20,15 @@ org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + + + 1659338237398 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + From eaf00fbd42aa5b8a63ef4f34d119b1ec3e49016c Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sat, 10 Sep 2022 09:21:33 +0200 Subject: [PATCH 15/33] Bring version of zstack up to date --- com.zsmartsystems.zigbee.console.zstack/pom.xml | 8 ++++---- .../console/zstack/ZstackConsoleAbstractCommand.java | 2 +- .../zstack/ZstackConsoleNcpDiagnosticsCommand.java | 2 +- .../console/zstack/ZstackConsoleNcpSecurityCommand.java | 2 +- .../console/zstack/ZstackConsoleNcpStateCommand.java | 2 +- com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml | 2 +- .../zigbee/dongle/zstack/autocode/ClassGenerator.java | 2 +- .../zigbee/dongle/zstack/autocode/CommandGenerator.java | 2 +- .../zigbee/dongle/zstack/autocode/ZstackAutocoder.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Command.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Enumeration.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Parameter.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Protocol.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Structure.java | 2 +- .../zigbee/dongle/zstack/autocode/xml/Value.java | 2 +- com.zsmartsystems.zigbee.dongle.zstack/pom.xml | 6 +++--- .../zigbee/dongle/zstack/ZigBeeDongleZstack.java | 2 +- .../com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java | 2 +- .../zigbee/dongle/zstack/api/ZstackCommand.java | 2 +- .../zigbee/dongle/zstack/api/ZstackFrameFactory.java | 2 +- .../zigbee/dongle/zstack/api/ZstackFrameRequest.java | 2 +- .../zigbee/dongle/zstack/api/ZstackFrameResponse.java | 2 +- .../zigbee/dongle/zstack/api/ZstackResponseCode.java | 2 +- .../zigbee/dongle/zstack/api/af/AfDataOptions.java | 2 +- .../dongle/zstack/api/af/ZstackAfDataConfirmAreq.java | 2 +- .../dongle/zstack/api/af/ZstackAfDataRequestSreq.java | 2 +- .../dongle/zstack/api/af/ZstackAfDataRequestSrsp.java | 2 +- .../dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java | 2 +- .../zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java | 2 +- .../zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java | 2 +- .../api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java | 2 +- .../api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java | 2 +- .../ZstackAppCnfBdbCommissioningNotificationAreq.java | 2 +- ...ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java | 2 +- ...ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java | 2 +- .../ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java | 2 +- .../ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java | 2 +- .../ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java | 2 +- .../ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java | 2 +- .../appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java | 2 +- .../appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java | 2 +- .../zstack/api/appcnf/ZstackAuthenticationOption.java | 2 +- .../zstack/api/appcnf/ZstackBdbCommissioningMode.java | 2 +- .../api/appcnf/ZstackBdbRemainingCommissioningModes.java | 2 +- .../zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java | 2 +- .../zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java | 2 +- .../dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java | 2 +- .../dongle/zstack/api/mac/ZstackMacScanReqSreq.java | 2 +- .../dongle/zstack/api/mac/ZstackMacScanReqSrsp.java | 2 +- .../dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java | 2 +- .../zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java | 2 +- .../dongle/zstack/api/sapi/ZstackDeviceInformation.java | 2 +- .../dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java | 2 +- .../dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java | 2 +- .../zstack/api/sapi/ZstackZbReadConfigurationSreq.java | 2 +- .../zstack/api/sapi/ZstackZbReadConfigurationSrsp.java | 2 +- .../zstack/api/sapi/ZstackZbWriteConfigurationSreq.java | 2 +- .../zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java | 2 +- .../dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java | 2 +- .../dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java | 2 +- .../dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java | 2 +- .../dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackConfigId.java | 2 +- .../dongle/zstack/api/sys/ZstackDiagnosticAttribute.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackResetReason.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackResetType.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java | 2 +- .../dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSysResetIndAreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysResetReqAcmd.java | 2 +- .../dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSysVersionSreq.java | 2 +- .../dongle/zstack/api/sys/ZstackSysVersionSrsp.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java | 2 +- .../zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java | 2 +- .../dongle/zstack/api/sys/ZstackSystemCapabilities.java | 2 +- .../zigbee/dongle/zstack/api/sys/ZstackZdoState.java | 2 +- .../api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java | 2 +- .../api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java | 2 +- .../api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java | 2 +- .../api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java | 2 +- .../zstack/api/util/ZstackUtilGetDeviceInfoSreq.java | 2 +- .../zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java | 2 +- .../dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java | 2 +- .../dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java | 2 +- .../dongle/zstack/api/util/ZstackUtilLedControlSreq.java | 2 +- .../dongle/zstack/api/util/ZstackUtilLedControlSrsp.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetPanidSreq.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java | 2 +- .../zstack/api/util/ZstackUtilSetPrecfgkeySreq.java | 2 +- .../zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java | 2 +- .../dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 2 +- .../zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java | 2 +- .../zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java | 2 +- .../zstack/api/zdo/ZstackZdoStartupFromAppSreq.java | 2 +- .../zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java | 2 +- .../zstack/api/zdo/ZstackZdoStateChangeIndAreq.java | 2 +- .../dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java | 2 +- .../zigbee/dongle/zstack/internal/ZstackFrameHandler.java | 2 +- .../zstack/internal/ZstackNetworkInitialisation.java | 2 +- .../dongle/zstack/internal/ZstackProtocolHandler.java | 2 +- .../dongle/zstack/internal/ZstackStackConfiguration.java | 2 +- .../zstack/internal/serializer/ZstackDeserializer.java | 2 +- .../zstack/internal/serializer/ZstackSerializer.java | 2 +- .../zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java | 2 +- .../zigbee/dongle/zstack/ZigBeeDongleZstackTest.java | 2 +- .../zigbee/dongle/zstack/api/ZstackFrameRequestTest.java | 2 +- .../zigbee/dongle/zstack/api/ZstackFrameResponseTest.java | 2 +- .../dongle/zstack/api/af/ZstackAfRegisterSreqTest.java | 2 +- .../dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java | 2 +- .../dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java | 2 +- .../dongle/zstack/api/sys/ZstackSysVersionSreqTest.java | 2 +- .../zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java | 2 +- .../dongle/zstack/internal/ZstackProtocolHandlerTest.java | 2 +- .../internal/serializer/ZstackDeserializerTest.java | 2 +- .../zstack/internal/serializer/ZstackSerializerTest.java | 2 +- 150 files changed, 155 insertions(+), 155 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.zstack/pom.xml b/com.zsmartsystems.zigbee.console.zstack/pom.xml index 63accd1916..7eff784e19 100644 --- a/com.zsmartsystems.zigbee.console.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.console.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT @@ -17,19 +17,19 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.zstack - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java index 0b0b980635..0003041930 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java index 884132c289..c1771c7d90 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java index 080854fccf..ad93996463 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index 99e672986d..bed0251a8b 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml index 22f10adff0..4c9f208e9b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml @@ -14,7 +14,7 @@ com.zsmartsystems zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index b3a77cac08..d2f8efc43f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 0c30c1ee9d..0c7263e337 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java index 3361903edb..483aba9732 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java index cdf11509cb..e916c6ff64 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Command.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java index 6ed7e71419..9ea59ac7e0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Enumeration.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java index 757f2c68fc..5916fb91e1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Parameter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java index 6d5384f150..67e2c0fdb6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Protocol.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java index a871fb216d..3f69c1ca2a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Structure.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java index 5ba82665ee..e7bcc66034 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/xml/Value.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml index 5ebc2deab7..81d3714ac2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT @@ -17,13 +17,13 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.3-SNAPSHOT + 1.4.8-SNAPSHOT tests test diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 035f8771c1..fd49feae8a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index ec552217cb..276fc82b44 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java index fa0dfe6a0d..b7236ad9dc 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java index ba4cf51c09..448c2b42cf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java index 85c8e89fec..6cb41c0ad5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java index 59a456da69..436e9efc0d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponse.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java index 370a17daf5..d7f00b92fd 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index 3b6d4b8a96..d53716698e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java index e517917b4d..e0680b3c9c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java index 10d94543c6..fc19d27a90 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java index 79d4f89cb3..afcc1c3180 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java index 107102f28e..d985a7e389 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index ec1f160a31..f9941b60b4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java index 2073db3578..4d9a261d27 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java index 1e70d27aad..f86dc6f756 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java index 4ba8025790..a09d940512 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java index c0a4c337c0..ca7866fe4c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java index 2da9a33f5f..d363ca876a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java index 9200b66c75..3cd012b121 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java index 4e871c2ebc..fa0dbec4ea 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java index 8547b421b6..3c21ebd0b2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java index 0afe323c69..c044654085 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java index 56c1eea507..dd76b30872 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java index 6206c9c111..fc64e1449f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java index 95d9a19585..847b181d21 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java index 423ed85050..5eb88d198b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java index 8f919300e4..ce8ece91cb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java index 7c062f9a9f..c81ea2358c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java index 00f05c1047..5164503bdc 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java index bff6527453..4cd9080415 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java index bf8a343962..9d059278e1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java index 586620e1df..186387c43e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java index ed1b6a51b9..e0ea6b5da9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java index 2965de8dd1..0d4194c3ab 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java index 1913654f82..1d36c1fa05 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java index 1548e284f7..3a90139c0c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java index 44094589c8..98e79a6faf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java index 754f0781c4..3509ea390a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java index 5f634a02f6..e74f8f30b6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java index e17fa2c3c4..b8435ac73c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java index c46a281e6d..ee1f31d93f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java index 65055010ad..9c54fe2488 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java index a4dff033a6..86be7f9db2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java index f10c485932..664318705a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java index 4ac9970054..e10b22b581 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java index 13e9e6bca6..7f2dba54a1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index fe5bdf8393..62cfd90ee0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java index f18c1e7e38..201ceed1ba 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java index e0e3072bda..9e1fe4072d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java index 6487a20ced..b3947de67f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java index 754fb01b8e..87abe5e4df 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java index 40fa997450..ba93991378 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java index 27c76cd145..fcffd4b90f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java index 2c8e335ccd..2faec3ff5d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java index bbb4b17728..026c714940 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java index 77b667f89a..43af8d1a33 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java index 4a82e6d37c..619c16a2e1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java index b06ba01548..0efcf52a64 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java index 8f953acd39..17983409af 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java index 23041e9586..d63f0f99ac 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java index 8d9840c5e7..8b8e96c937 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java index 5b3e747a42..5d9fb4ba1e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java index 39cfed944f..ff18f9a06a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java index fadf08c210..c997380732 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java index 4f821e9732..0c9f880305 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java index bc5e473525..456b8da6aa 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java index 3b0810af13..f86dc977b6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java index 69728fbd41..8370d199d9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java index 3f51f6d98e..2cf9f4dc11 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java index eeea7e39c7..e9665f040a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java index 91e27c8598..c3f0b8fb71 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java index 8354040f0b..9d60d6690f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java index e75ddd3bce..7084cc740d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java index 5b0e84bd56..98ef68a7cf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java index c60a2f76b3..a8644f2641 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java index ca1ebdf4ae..f0fc7c0d15 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java index ca8a96c788..9ce977c8c2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java index 4a9bd13404..5b0658cde9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java index fdb0c686b1..557f2dade5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java index 0197882bbd..36de6a5f39 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java index ffc14c095c..0ea069c317 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java index 8bd2c98126..2bdef2a99b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java index 27c9b68e24..8f1b1d023b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java index e0f51b8f78..294aa355c1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java index 90e2eac0b9..6311981322 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java index 8353cf4609..17e3f7bd33 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java index 492250e6f9..ee95ed1b75 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java index d20e973c5b..2bae41e7b2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java index 214582fc99..2ced0c238f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java index 17c511ab1c..7da7884346 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java index eb25e1dfb7..7382df9226 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java index 0655c5176e..f1956c52e0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java index 608fde1050..f027e61be9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java index d8da673aa6..940c02f0b9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java index 2623dcc139..25a12bf45b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java index 50b489517b..44895fe5ef 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java index 417f4d0cd5..ac978ace39 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java index 39e8f10e60..5baec19c2e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java index 006d341686..7710581e60 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java index 4b94ca6e4f..5453875198 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java index 830a75229e..c78fdbf52b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java index 3ed21a4b50..8110706066 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java index d2335174dd..fb6362c864 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java index bcf9fc7bd1..b3363d9819 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java index 0807e2662c..690c876474 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java index a092446b13..33d473fe16 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java index 5a2106eb18..3972c60175 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java index 0375e74602..3e40303a46 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java index 34e5da8b74..9887a6a91a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java index e99f6c0d6b..dba377b8c8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java index 0bbc3018fc..00a0ede242 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java index 919773d731..53f9591fd1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java index 9cb6d76a37..ccd5f96652 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java index 7dc08b9a08..a544fe85cb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java index 789c9af0c2..0c7bee990c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java index 9dd6cd5cf0..3dd0ed4db6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java index 413953b129..8a8b3a9e1b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java index b4e597561a..eb95354ba0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index b714fa3029..b4c915666a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java index 92eb98f0dd..aec816fc1a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java index ead692a8a6..2cc4aee38b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java index 14f5f1a253..54766f7b5e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java index c18c5596b2..5f87d7a345 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index e29fe00c4c..df65604905 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java index 59c5bab7ab..834e35e14b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java index 3dc0f68f17..affc137cd4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameResponseTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java index 510d73efff..0c4fc8ef68 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreqTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java index 252d3a5564..454f0af871 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrspTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java index 3c38d5c643..f67a98bdec 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmdTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java index f3d5313aef..a1b2fb9944 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreqTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java index afdae47191..8261e2bfed 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrspTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index 1998d7d20e..88286dde25 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java index d5d37e7d42..6514e84a50 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializerTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java index b4c82c6325..de6a898a5c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackSerializerTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2016-2019 by the respective copyright holders. + * Copyright (c) 2016-2022 by the respective copyright holders. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at From 739d149ccef0e6d12e58fc66c316eb86798a8b57 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Mon, 19 Sep 2022 22:58:10 +0200 Subject: [PATCH 16/33] Update pom versions automatically --- com.zsmartsystems.zigbee.console.main/pom.xml | 24 +++++++++---------- .../pom.xml | 6 ++--- .../pom.xml | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.main/pom.xml b/com.zsmartsystems.zigbee.console.main/pom.xml index 0b5b33a610..e202119027 100644 --- a/com.zsmartsystems.zigbee.console.main/pom.xml +++ b/com.zsmartsystems.zigbee.console.main/pom.xml @@ -17,73 +17,73 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.serial - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.cc2531 - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.zstack - 1.4.3-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.xbee - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.conbee - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.ember - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.telegesis - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.ember - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.telegesis - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console.zstack - 1.4.3-SNAPSHOT + ${project.version} diff --git a/com.zsmartsystems.zigbee.console.zstack/pom.xml b/com.zsmartsystems.zigbee.console.zstack/pom.xml index 7eff784e19..54113f4763 100644 --- a/com.zsmartsystems.zigbee.console.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.console.zstack/pom.xml @@ -17,19 +17,19 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.console - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee.dongle.zstack - 1.4.8-SNAPSHOT + ${project.version} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml index 81d3714ac2..3d2c4a3263 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml @@ -17,13 +17,13 @@ com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.8-SNAPSHOT + ${project.version} com.zsmartsystems.zigbee com.zsmartsystems.zigbee - 1.4.8-SNAPSHOT + ${project.version} tests test From 0c093aef622de92efed85fe96e5b3016635e1f7c Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Mon, 26 Sep 2022 09:10:06 +0200 Subject: [PATCH 17/33] Fixes transaction issues --- .../src/main/resources/zstack_protocol.xml | 5 + .../dongle/zstack/ZigBeeDongleZstack.java | 421 +++++++++--------- .../zigbee/dongle/zstack/ZstackNcp.java | 83 +--- .../dongle/zstack/api/ZstackResponseCode.java | 7 +- .../zstack/internal/ZstackFrameHandler.java | 33 -- .../internal/ZstackNetworkInitialisation.java | 266 ----------- .../internal/ZstackProtocolHandler.java | 158 +++---- .../dongle/zstack/ZigBeeDongleZstackTest.java | 4 - .../internal/ZstackProtocolHandlerTest.java | 6 +- 9 files changed, 303 insertions(+), 680 deletions(-) delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 650e24f7ab..f3d66c5b58 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -2871,6 +2871,11 @@ 0x00FC The scan request failed because a scan is already in progress + + MAC_TRANSACTION_EXPIRED + 0x00F0 + The outstanding transaction has expired + diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index fd49feae8a..cdfd91e29d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -7,12 +7,10 @@ */ package com.zsmartsystems.zigbee.dongle.zstack; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -32,7 +30,6 @@ import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.aps.ZigBeeApsFrame; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; @@ -46,17 +43,12 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; -import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackNetworkInitialisation; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackStackConfiguration; import com.zsmartsystems.zigbee.security.ZigBeeKey; -import com.zsmartsystems.zigbee.transport.DeviceType; import com.zsmartsystems.zigbee.transport.TransportConfig; import com.zsmartsystems.zigbee.transport.TransportConfigOption; import com.zsmartsystems.zigbee.transport.ZigBeePort; @@ -64,6 +56,25 @@ import com.zsmartsystems.zigbee.transport.ZigBeeTransportReceive; import com.zsmartsystems.zigbee.transport.ZigBeeTransportState; import com.zsmartsystems.zigbee.transport.ZigBeeTransportTransmit; +import com.zsmartsystems.zigbee.zdo.command.ActiveEndpointsResponse; +import com.zsmartsystems.zigbee.zdo.command.BindResponse; +import com.zsmartsystems.zigbee.zdo.command.DeviceAnnounce; +import com.zsmartsystems.zigbee.zdo.command.EndDeviceBindResponse; +import com.zsmartsystems.zigbee.zdo.command.IeeeAddressResponse; +import com.zsmartsystems.zigbee.zdo.command.ManagementBindResponse; +import com.zsmartsystems.zigbee.zdo.command.ManagementLeaveResponse; +import com.zsmartsystems.zigbee.zdo.command.ManagementLqiResponse; +import com.zsmartsystems.zigbee.zdo.command.ManagementPermitJoiningRequest; +import com.zsmartsystems.zigbee.zdo.command.ManagementPermitJoiningResponse; +import com.zsmartsystems.zigbee.zdo.command.ManagementRoutingResponse; +import com.zsmartsystems.zigbee.zdo.command.MatchDescriptorRequest; +import com.zsmartsystems.zigbee.zdo.command.MatchDescriptorResponse; +import com.zsmartsystems.zigbee.zdo.command.NetworkAddressResponse; +import com.zsmartsystems.zigbee.zdo.command.NodeDescriptorResponse; +import com.zsmartsystems.zigbee.zdo.command.PowerDescriptorResponse; +import com.zsmartsystems.zigbee.zdo.command.SimpleDescriptorResponse; +import com.zsmartsystems.zigbee.zdo.command.UnbindResponse; +import com.zsmartsystems.zigbee.zdo.command.UserDescriptorResponse; /** * Implementation of the Texas instruments Z-Stack dongle implementation. @@ -80,7 +91,7 @@ * @author Chris Jackson * */ -public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameHandler { +public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { /** * The {@link Logger}. */ @@ -94,7 +105,7 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH /** * The protocol handler used to send and receive ZStack packets */ - private ZstackProtocolHandler frameHandler; + private ZstackProtocolHandler protocolHandler; /** * The stack configuration we need for the NCP @@ -142,12 +153,7 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH private ExtendedPanId extendedPanId; /** - * Defines the type of device we want to be - normally this should be COORDINATOR - */ - private DeviceType deviceType = DeviceType.COORDINATOR; - - /** - * The ZStack version used in this system. Set during initialisation and saved in case the client is interested. + * The ZStack version used in this system. Set during initialisation and save in case the client is interested. */ private String versionString = "Unknown"; @@ -156,6 +162,9 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit, ZstackFrameH */ private boolean networkStateUp = false; + /** + * Default profile to use for the main endpoint + */ ZigBeeProfileType defaultProfile = ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION; /** @@ -188,28 +197,11 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { // Define the default configuration stackConfiguration = new LinkedHashMap<>(); - stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] {0x00}); + stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] { 0x00 }); networkKey = new ZigBeeKey(); } - /** - * Update the ZStack configuration that will be sent to the dongle during the initialisation. - *

    - * Note that this must be called prior to {@link #initialize()} for the configuration to be effective. - * - * @param configId the {@link ZstackConfigId} to be updated. - * @param value the value to set (as int[]). Setting this to null will remove the configuration Id from - * the list of configuration to be sent during NCP initialisation. - * @return the previously configured value, or null if no value was set for the {@link ZstackConfigId} - */ - public int[] updateDefaultConfiguration(ZstackConfigId configId, int[] value) { - if (value == null) { - return stackConfiguration.remove(configId); - } - return stackConfiguration.put(configId, value); - } - @Override public ZigBeeStatus initialize() { logger.debug("ZStack dongle initialize: Starting"); @@ -219,12 +211,8 @@ public ZigBeeStatus initialize() { return ZigBeeStatus.COMMUNICATION_ERROR; } - frameHandler = new ZstackProtocolHandler(this); - frameHandler.start(serialPort); - - ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); - - netInitialiser.initializeNcp(false, serialPort); + protocolHandler = new ZstackProtocolHandler(); + protocolHandler.start(serialPort); ZstackNcp ncp = getZstackNcp(); @@ -267,7 +255,7 @@ public ZigBeeStatus startup(boolean reinitialize) { logger.debug("ZStack dongle startup: Starting"); // If frameHandler is null then the serial port didn't initialise - if (frameHandler == null) { + if (protocolHandler == null) { logger.error("Initialising ZStack Dongle but low level handler is not initialised."); return ZigBeeStatus.INVALID_STATE; } @@ -275,24 +263,19 @@ public ZigBeeStatus startup(boolean reinitialize) { ZstackNcp ncp = getZstackNcp(); // If we want to reinitialize the network, then go... - ZstackNetworkInitialisation netInitialiser = new ZstackNetworkInitialisation(frameHandler); if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); - netInitialiser.initializeNcp(true, serialPort); + if (ncp.setStartupOptions(true, true) != ZstackResponseCode.SUCCESS) { + logger.debug("ZStack Initialisation: Failed to set startup options"); + return ZigBeeStatus.COMMUNICATION_ERROR; + } ZstackSysResetIndAreq result = ncp.resetNcp(ZstackResetType.TARGET_DEVICE); if (result == null) { return ZigBeeStatus.COMMUNICATION_ERROR; } - if (deviceType == DeviceType.COORDINATOR) { - netInitialiser.formNetwork(); - } else { - netInitialiser.joinNetwork(); - } - - ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - + // configure non-volatile ZstackResponseCode ncpResponse = ncp.setNetworkKey(networkKey); if (ncpResponse != ZstackResponseCode.SUCCESS) { logger.debug("ZStack error setting network key: {}", ncpResponse); @@ -341,10 +324,33 @@ public ZigBeeStatus startup(boolean reinitialize) { } // reset the device + // reload non-volatile memory ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + // volatile configuration + // setup callbacks + ncp.zdoRegisterCallback(MatchDescriptorRequest.CLUSTER_ID); + ncp.zdoRegisterCallback(DeviceAnnounce.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementPermitJoiningRequest.CLUSTER_ID); + ncp.zdoRegisterCallback(NetworkAddressResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(IeeeAddressResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(NodeDescriptorResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(PowerDescriptorResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(SimpleDescriptorResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ActiveEndpointsResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(MatchDescriptorResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(UserDescriptorResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(EndDeviceBindResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(BindResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(UnbindResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementLqiResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementRoutingResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementBindResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementLeaveResponse.CLUSTER_ID); + ncp.zdoRegisterCallback(ManagementPermitJoiningResponse.CLUSTER_ID); + // Add the endpoint - ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(), + ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), defaultProfile.getKey(), new int[] { 0 }, new int[] { 0 }); if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { @@ -352,29 +358,7 @@ public ZigBeeStatus startup(boolean reinitialize) { // return ZigBeeStatus.COMMUNICATION_ERROR; } - netInitialiser.startNetwork(); - - ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - if (deviceInfo == null) { - logger.debug("Error getting device info"); - - return ZigBeeStatus.COMMUNICATION_ERROR; - } - nwkAddress = deviceInfo.getShortAddr(); - - ZstackUtilGetNvInfoSrsp nvDeviceInfo = ncp.getNvDeviceInfo(); - if (nvDeviceInfo == null) { - logger.debug("Error getting NV device info"); - - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - logger.debug("ZStack dongle startup: Waiting"); - - if (!netInitialiser.waitForNcpOnline(ncp)) { - logger.debug("ZStack dongle startup: Failed waiting for NCP to come online"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } + startNetwork(); logger.debug("ZStack dongle startup: Done"); initialised = true; @@ -404,14 +388,14 @@ public void run() { return; } // Don't wait for the response. This is running in a single thread scheduler - frameHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); + protocolHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); } }, pollRate, pollRate, TimeUnit.MILLISECONDS); } @Override public void shutdown() { - if (frameHandler == null) { + if (protocolHandler == null) { return; } @@ -423,10 +407,11 @@ public void shutdown() { executorService.shutdown(); } - frameHandler.setClosing(); + protocolHandler.setClosing(); serialPort.close(); - frameHandler.close(); - frameHandler = null; + protocolHandler.close(); + handleLinkStateChange(false); + protocolHandler = null; } /** @@ -435,7 +420,7 @@ public void shutdown() { * @return an instance of the {@link ZstackNcp} */ public ZstackNcp getZstackNcp() { - return new ZstackNcp(frameHandler); + return new ZstackNcp(protocolHandler); } @Override @@ -450,7 +435,7 @@ public Integer getNwkAddress() { @Override public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { - if (frameHandler == null) { + if (protocolHandler == null) { return; } @@ -463,31 +448,31 @@ public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { request.setDstAddr(apsFrame.getDestinationAddress()); request.setDestEndpoint(apsFrame.getDestinationEndpoint()); request.setSrcEndpoint(apsFrame.getSourceEndpoint()); - request.setTransID(apsFrame.getApsCounter()); + request.setTransID(msgTag); request.setRadius(apsFrame.getRadius()); request.setData(apsFrame.getPayload()); - request.addOptions(AfDataOptions.AF_ACK_REQUEST); request.addOptions(AfDataOptions.AF_DISCV_ROUTE); + if (apsFrame.getAckRequest()) { + // TODO: is this really necessary + request.addOptions(AfDataOptions.AF_ACK_REQUEST); + } if (apsFrame.getSecurityEnabled()) { request.addOptions(AfDataOptions.AF_EN_SECURITY); } // We need to correlate with the messageTag - executorService.execute(new Runnable() { - @Override - public void run() { - ZstackAfDataRequestSrsp response = frameHandler.sendTransaction(request, ZstackAfDataRequestSrsp.class); + executorService.execute(() -> { + ZstackAfDataRequestSrsp response = protocolHandler.sendTransaction(request, ZstackAfDataRequestSrsp.class); - ZigBeeTransportProgressState sentHandlerState; - if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { - sentHandlerState = ZigBeeTransportProgressState.TX_NAK; - } else { - sentHandlerState = ZigBeeTransportProgressState.TX_ACK; - } - - zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); + ZigBeeTransportProgressState sentHandlerState; + if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { + sentHandlerState = ZigBeeTransportProgressState.TX_NAK; + } else { + sentHandlerState = ZigBeeTransportProgressState.TX_ACK; } + + zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); }); } @@ -496,120 +481,6 @@ public void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportRece this.zigbeeTransportReceive = zigbeeTransportReceive; } - @Override - public void handlePacket(ZstackCommand response) { - if (response instanceof ZstackAfIncomingMsgAreq) { - ZstackAfIncomingMsgAreq incomingMsg = (ZstackAfIncomingMsgAreq) response; - ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); - apsFrame.setProfile(defaultProfile.getKey()); - apsFrame.setCluster(incomingMsg.getClusterId()); - apsFrame.setDestinationAddress(nwkAddress); - apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); - apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); - apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); - apsFrame.setPayload(incomingMsg.getData()); - - zigbeeTransportReceive.receiveCommand(apsFrame); - return; - } - - if (response instanceof ZstackZdoMsgCbIncomingAreq) { - // Ignore frames before we're initialised - if (nwkAddress == null) { - return; - } - - ZstackZdoMsgCbIncomingAreq incomingMsg = (ZstackZdoMsgCbIncomingAreq) response; - ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); - apsFrame.setProfile(0); - apsFrame.setCluster(incomingMsg.getClusterId()); - apsFrame.setDestinationAddress(incomingMsg.getDstAddr()); - apsFrame.setDestinationEndpoint(0); - apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); - apsFrame.setSourceEndpoint(0); - apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); - apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); - - int[] payload = new int[incomingMsg.getData().length + 1]; - payload[0] = incomingMsg.getSeqNumber(); - System.arraycopy(incomingMsg.getData(), 0, payload, 1, incomingMsg.getData().length); - apsFrame.setPayload(payload); - - zigbeeTransportReceive.receiveCommand(apsFrame); - return; - } - - if (response instanceof ZstackAfDataConfirmAreq) { - // Message has been completed by the NCP - executorService.execute(new Runnable() { - @Override - public void run() { - ZstackAfDataConfirmAreq dataConfirm = (ZstackAfDataConfirmAreq) response; - - ZigBeeTransportProgressState sentHandlerState; - if (dataConfirm.getStatus() == ZstackResponseCode.SUCCESS) { - sentHandlerState = ZigBeeTransportProgressState.RX_ACK; - } else { - sentHandlerState = ZigBeeTransportProgressState.RX_NAK; - } - zigbeeTransportReceive.receiveCommandState(dataConfirm.getTransId(), sentHandlerState); - } - }); - return; - } - - if (response instanceof ZstackZdoStateChangeIndAreq) { - switch (((ZstackZdoStateChangeIndAreq) response).getState()) { - case DEV_NWK_ORPHAN: - case DEV_ROUTER: - case DEV_ZB_COORD: - case DEV_END_DEVICE: - handleLinkStateChange(true); - break; - default: - handleLinkStateChange(false); - break; - } - - return; - } - - if (response instanceof ZstackZdoTcDevIndAreq) { - ZstackZdoTcDevIndAreq tcDeviceInd = (ZstackZdoTcDevIndAreq) response; - - zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, tcDeviceInd.getSrcAddr(), tcDeviceInd.getExtAddr()); - return; - } - } - - @Override - public void handleLinkStateChange(final boolean linkState) { - // Only act on changes to OFFLINE once we have completed initialisation - // changes to ONLINE have to work during init because they mark the end of the initialisation - if (!initialised || linkState == networkStateUp) { - logger.debug("ZStack dongle state change to {} ignored. initialised={}, networkStateUp={}", linkState, - initialised, networkStateUp); - return; - } - logger.debug("ZStack dongle state change to {}", linkState); - - networkStateUp = linkState; - - new Thread() { - @Override - public void run() { - if (linkState) { - ZstackNcp ncp = getZstackNcp(); - nwkAddress = ncp.getNwkAddress(); - } - // Handle link changes and notify framework - zigbeeTransportReceive - .setTransportState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); - } - }.start(); - } - @Override public ZigBeeChannel getZigBeeChannel() { return ZigBeeChannel.create(getZstackNcp().getNetworkInfo().getChannel()); @@ -680,7 +551,7 @@ public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { @Override public ZigBeeKey getTcLinkKey() { - return null; + return linkKey; } /** @@ -726,11 +597,6 @@ public void updateTransportConfig(TransportConfig configuration) { configuration.setResult(option, setTxPower(txPower)); break; - case DEVICE_TYPE: - deviceType = (DeviceType) configuration.getValue(option); - configuration.setResult(option, ZigBeeStatus.SUCCESS); - break; - case TRUST_CENTRE_LINK_KEY: setTcLinkKey((ZigBeeKey) configuration.getValue(option)); configuration.setResult(option, ZigBeeStatus.SUCCESS); @@ -752,6 +618,11 @@ public void updateTransportConfig(TransportConfig configuration) { } } + @Override + public String getVersionString() { + return versionString; + } + private ZigBeeStatus setTxPower(int txPower) { ZstackNcp ncp = getZstackNcp(); Integer powerResponse = ncp.setTxPower(txPower); @@ -768,8 +639,120 @@ private ZigBeeStatus setTxPower(int txPower) { return ZigBeeStatus.SUCCESS; } - @Override - public String getVersionString() { - return versionString; + private void handleLinkStateChange(final boolean linkState) { + // Only act on changes to OFFLINE once we have completed initialisation + // changes to ONLINE have to work during init because they mark the end of the + // initialisation + if (!initialised || linkState == networkStateUp) { + logger.debug("ZStack dongle state change to {} ignored. initialised={}, networkStateUp={}", linkState, + initialised, networkStateUp); + return; + } + logger.debug("ZStack dongle state change to {}", linkState); + + networkStateUp = linkState; + + executorService.execute(() -> { + if (linkState) { + // obtain network address after startup + ZstackNcp ncp = getZstackNcp(); + nwkAddress = ncp.getNwkAddress(); + } + // Handle link changes and notify framework + zigbeeTransportReceive + .setTransportState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); + }); + } + + /** + * Starts the NCP application, placing it on the network as previously + * configured. + * + * @return {@link ZigBeeStatus} defining the result + */ + private ZigBeeStatus startNetwork() { + logger.debug("ZStack starting network"); + ZstackNcp ncp = getZstackNcp(); + + // setup listeners + protocolHandler.listener(ZstackZdoStateChangeIndAreq.class, response -> { + logger.debug("Zstack dongle state changed"); + switch (response.getState()) { + case DEV_ROUTER: + case DEV_ZB_COORD: + case DEV_END_DEVICE: + handleLinkStateChange(true); + break; + default: + handleLinkStateChange(false); + break; + } + }); + + protocolHandler.listener(ZstackAfIncomingMsgAreq.class, response -> { + logger.debug("Zstack incoming message"); + ZstackAfIncomingMsgAreq incomingMsg = (ZstackAfIncomingMsgAreq) response; + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setProfile(defaultProfile.getKey()); + apsFrame.setDestinationAddress(nwkAddress); + apsFrame.setCluster(incomingMsg.getClusterId()); + apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); + apsFrame.setSourceEndpoint(incomingMsg.getSrcEndpoint()); + apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); + apsFrame.setReceivedLqi(incomingMsg.getLinkQuality()); + apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); + apsFrame.setApsCounter(-1); + apsFrame.setPayload(incomingMsg.getData()); + + zigbeeTransportReceive.receiveCommand(apsFrame); + }); + + protocolHandler.listener(ZstackAfDataConfirmAreq.class, response -> { + logger.debug("Zstack: APS confirmed {}", response.getEndpoint()); + ZigBeeTransportProgressState sentHandlerState; + if (response.getStatus() == ZstackResponseCode.SUCCESS) { + sentHandlerState = ZigBeeTransportProgressState.RX_ACK; + } else { + sentHandlerState = ZigBeeTransportProgressState.RX_NAK; + } + zigbeeTransportReceive.receiveCommandState(response.getTransId(), sentHandlerState); + }); + + protocolHandler.listener(ZstackZdoTcDevIndAreq.class, response -> { + logger.debug("Zstack: device joined"); + zigbeeTransportReceive.nodeStatusUpdate(ZigBeeNodeStatus.UNSECURED_JOIN, response.getSrcAddr(), + response.getExtAddr()); + }); + + protocolHandler.listener(ZstackZdoMsgCbIncomingAreq.class, response -> { + logger.debug("Zstack: Incoming ZDO message"); + + ZstackZdoMsgCbIncomingAreq incomingMsg = (ZstackZdoMsgCbIncomingAreq) response; + ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); + apsFrame.setProfile(0); + apsFrame.setCluster(incomingMsg.getClusterId()); + apsFrame.setDestinationAddress(incomingMsg.getDstAddr()); + apsFrame.setDestinationEndpoint(0); + apsFrame.setSourceAddress(incomingMsg.getSrcAddr()); + apsFrame.setSourceEndpoint(0); + apsFrame.setSecurityEnabled(incomingMsg.getSecurityUse()); + apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); + apsFrame.setApsCounter(-1); + + int[] payload = new int[incomingMsg.getData().length + 1]; + payload[0] = incomingMsg.getSeqNumber(); + System.arraycopy(incomingMsg.getData(), 0, payload, 1, incomingMsg.getData().length); + apsFrame.setPayload(payload); + + zigbeeTransportReceive.receiveCommand(apsFrame); + }); + + // Now start the NCP + if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + return ZigBeeStatus.SUCCESS; } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index 276fc82b44..f6b7062592 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -30,10 +30,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackInstallCodeFormat; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackDiagnosticAttribute; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; @@ -64,7 +60,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackFrameHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.DeviceType; @@ -82,11 +77,6 @@ public class ZstackNcp { */ private final Logger logger = LoggerFactory.getLogger(ZstackNcp.class); - /** - * Flag to use the old (deprecated) config functions - */ - private boolean useOldCfgCalls = false; - /* * Startup options bitmap */ @@ -101,7 +91,7 @@ public class ZstackNcp { /** * Create the NCP instance * - * @param protocolHandler the {@link ZstackFrameHandler} used for communicating with the NCP + * @param protocolHandler the {@link ZstackProtocolHandler} used for communicating with the NCP */ public ZstackNcp(ZstackProtocolHandler protocolHandler) { this.protocolHandler = protocolHandler; @@ -293,35 +283,19 @@ public ZstackResponseCode setStartupOptions(boolean clearConfig, boolean clearSt * @return a int[] with the value of the configuration data or null on error */ public int[] readConfiguration(ZstackConfigId configId) { - if (useOldCfgCalls) { - ZstackZbReadConfigurationSreq request = new ZstackZbReadConfigurationSreq(); - request.setConfigId(configId); - ZstackZbReadConfigurationSrsp response = protocolHandler.sendTransaction(request, ZstackZbReadConfigurationSrsp.class); - if (response == null) { - logger.debug("No response from ReadConfiguration command"); - return null; - } - logger.debug(response.toString()); - if (response.getStatus() != ZstackResponseCode.SUCCESS) { - logger.debug("No response from ReadConfiguration command: {}", response.getStatus()); - return null; - } - return response.getValue(); - } else { - ZstackSysOsalNvReadSreq request = new ZstackSysOsalNvReadSreq(); - request.setId(configId); - ZstackSysOsalNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvReadSrsp.class); - if (response == null) { - logger.debug("No response from ReadConfiguration command"); - return null; - } - if (response.getStatus() != ZstackResponseCode.SUCCESS) { - logger.debug("No response from ReadConfiguration command: {}", response.getStatus()); - return null; - } - logger.debug(response.toString()); - return response.getValue(); + ZstackSysOsalNvReadSreq request = new ZstackSysOsalNvReadSreq(); + request.setId(configId); + ZstackSysOsalNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvReadSrsp.class); + if (response == null) { + logger.debug("No response from ReadConfiguration command"); + return null; + } + if (response.getStatus() != ZstackResponseCode.SUCCESS) { + logger.debug("No response from ReadConfiguration command: {}", response.getStatus()); + return null; } + logger.debug(response.toString()); + return response.getValue(); } /** @@ -332,29 +306,16 @@ public int[] readConfiguration(ZstackConfigId configId) { * @return {@link ZstackResponseCode} returned from the NCP */ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] value) { - if (useOldCfgCalls) { - ZstackZbWriteConfigurationSreq request = new ZstackZbWriteConfigurationSreq(); - request.setConfigId(configId); - request.setValue(value); - ZstackZbWriteConfigurationSrsp response = protocolHandler.sendTransaction(request, ZstackZbWriteConfigurationSrsp.class); - if (response == null) { - logger.debug("No response from WriteConfiguration command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); - } else { - ZstackSysOsalNvWriteSreq request = new ZstackSysOsalNvWriteSreq(); - request.setId(configId); - request.setValue(value); - ZstackSysOsalNvWriteSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvWriteSrsp.class); - if (response == null) { - logger.debug("No response from WriteConfiguration command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + ZstackSysOsalNvWriteSreq request = new ZstackSysOsalNvWriteSreq(); + request.setId(configId); + request.setValue(value); + ZstackSysOsalNvWriteSrsp response = protocolHandler.sendTransaction(request, ZstackSysOsalNvWriteSrsp.class); + if (response == null) { + logger.debug("No response from WriteConfiguration command"); + return ZstackResponseCode.FAILURE; } + logger.debug(response.toString()); + return response.getStatus(); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java index d7f00b92fd..4d351cfb80 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java @@ -78,7 +78,12 @@ public enum ZstackResponseCode { /** * The scan request failed because a scan is already in progress */ - MAC_SCAN_IN_PROGRESS(0x00FC); + MAC_SCAN_IN_PROGRESS(0x00FC), + + /** + * The transaction has expired + */ + MAC_TRANSACTION_EXPIRED(0x00F0); /** * A mapping between the integer code and its corresponding type to diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java deleted file mode 100644 index 8a8b3a9e1b..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackFrameHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.internal; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; - -/** - * Interface to exchange asynchronous packets and link state changes from the low level protocol handlers - * to the dongle layer. - * - * @author Chris Jackson - * - */ -public interface ZstackFrameHandler { - /** - * Passes received asynchronous frames from the ZStack protocol handler to the dongle layer - * - * @param response incoming {@link ZstackCommand} response frame - */ - public void handlePacket(ZstackCommand response); - - /** - * Called when the ZStack handler link state changes - * - * @param state true if the link is UP, false if the link is DOWN - */ - public void handleLinkStateChange(boolean state); -} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java deleted file mode 100644 index eb95354ba0..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackNetworkInitialisation.java +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.internal; - -import com.zsmartsystems.zigbee.ZigBeeStatus; -import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; -import com.zsmartsystems.zigbee.transport.DeviceType; -import com.zsmartsystems.zigbee.transport.ZigBeePort; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -/** - * This class provides utility functions to establish a ZStack ZigBee network - * - * @author Chris Jackson - * - */ -public class ZstackNetworkInitialisation { - /** - * The {@link Logger}. - */ - private final Logger logger = LoggerFactory.getLogger(ZstackNetworkInitialisation.class); - - /** - * Number of milliseconds to wait for the bootloader to exit - */ - public static final int BOOTLOAD_TIMEOUT = 3000; - - /** - * Number of milliseconds to wait for the NCP to come online - */ - public static final int ONLINE_TIMEOUT = 5000; - - /** - * The default magic number used to make the dongle exit the bootloader - */ - public static final int MAGIC_NUMBER_DEFAULT = 0xEF; - - /** - * The frame handler used to send the ZStack frames to the NCP - */ - private ZstackProtocolHandler protocolHandler; - - /** - * @param protocolHandler the {@link ZstackProtocolHandler} used to communicate with the NCP - */ - public ZstackNetworkInitialisation(ZstackProtocolHandler protocolHandler) { - this.protocolHandler = protocolHandler; - } - - /** - * This method performs the initial initialisation of the dongle application firmware. This simply starts the - * dongle, ensuring that it enters the application (ie exiting the bootloader) and sets the configuration to use the - * defaults. From here we have a known configuration on which to start our session. - *

    - * The dongle is not reset completely, thus allowing it to be placed back into the previous network. - * - * @param initialize set to true to reset the dongle and erase all current network settings - * @param serialPort - */ - public ZigBeeStatus initializeNcp(boolean initialize, ZigBeePort serialPort) { - logger.debug("ZStack Initialisation: Initialise"); - ZstackNcp ncp = new ZstackNcp(protocolHandler); - - // The reset failed - assume we're in the bootloader and try and exit - if (exitBootloader(serialPort) == false) { - logger.debug("ZStack Initialisation: Failed to exit bootloader"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - if (initialize) { - return resetNcp(ncp, true); - } - return ZigBeeStatus.SUCCESS; - } - - /** - * Form a new network as the coordinator. - *

    - * This assumes that the network configuration parameters have been set prior to calling - * - * @return {@link ZigBeeStatus} defining the result - */ - public ZigBeeStatus formNetwork() { - logger.debug("ZStack forming new network"); - ZstackNcp ncp = new ZstackNcp(protocolHandler); - - if (ncp.setDeviceType(DeviceType.COORDINATOR) != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack forming network: Error setting NCP to coordinator"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - return ZigBeeStatus.SUCCESS; - } - - /** - * Join an existing network as a Router - *

    - * This assumes that the network configuration parameters have been set prior to calling - * - * @return {@link ZigBeeStatus} defining the result - */ - public ZigBeeStatus joinNetwork() { - logger.debug("ZStack joining new network"); - ZstackNcp ncp = new ZstackNcp(protocolHandler); - - if (ncp.setDeviceType(DeviceType.ROUTER) != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack forming network: Error setting NCP to router"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - return ZigBeeStatus.SUCCESS; - } - - /** - * Starts the NCP application, placing it on the network as previously configured. - * - * @return {@link ZigBeeStatus} defining the result - */ - public ZigBeeStatus startNetwork() { - logger.debug("ZStack starting network"); - ZstackNcp ncp = new ZstackNcp(protocolHandler); - - // ncp.setNetworkSecurity(true); - - ncp.zdoRegisterCallback(0x0006);// MatchDescriptorRequest - ncp.zdoRegisterCallback(0x0013);// DeviceAnnounce - ncp.zdoRegisterCallback(0x0036);// ManagementPermitJoiningRequest - ncp.zdoRegisterCallback(0x8000);// NetworkAddressResponse() { - ncp.zdoRegisterCallback(0x8001);// IeeeAddressResponse() { - ncp.zdoRegisterCallback(0x8002);// NodeDescriptorResponse.); - ncp.zdoRegisterCallback(0x8003);// PowerDescriptorResponse - ncp.zdoRegisterCallback(0x8004);// SimpleDescriptorResponse - ncp.zdoRegisterCallback(0x8005);// ActiveEndpointsResponse - ncp.zdoRegisterCallback(0x8006);// MatchDescriptorResponse - ncp.zdoRegisterCallback(0x8011);// UserDescriptorResponse - ncp.zdoRegisterCallback(0x8020);// EndDeviceBindResponse - ncp.zdoRegisterCallback(0x8021);// BindResponse - ncp.zdoRegisterCallback(0x8022);// UnbindResponse - ncp.zdoRegisterCallback(0x8031);// ManagementLqiResponse - ncp.zdoRegisterCallback(0x8032);// ManagementRoutingResponse - ncp.zdoRegisterCallback(0x8033);// ManagementBindResponse - ncp.zdoRegisterCallback(0x8034);// ManagementLeaveResponse - ncp.zdoRegisterCallback(0x8036);// ManagementPermitJoiningResponse - - // Now start the NCP - if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - return ZigBeeStatus.SUCCESS; - } - - /** - * Attempts to exit the bootloader by sending the "magic number" and waiting for the {@link ZstackSysResetIndAreq} - * to be received to confirm that the NCP application firmware has started. - * - * https://www.ti.com/lit/an/swra466d/swra466d.pdf - * https://www.ti.com/lit/ug/swcu185d/swcu185d.pdf - * - * @return true if the {@link ZstackSysResetIndAreq} was received, otherwise false - * @param serialPort Serial port - */ - private boolean exitBootloader(ZigBeePort serialPort) { - // FIXME this does not work in the OpenHAB binding, as it seems their write() implementation blocks - /* - protocolHandler.sendRaw(magicNumber); - if (waitForBoot("Magicnumber")) { - return true; - } - */ - - serialPort.setDtr(false); - - serialPort.setRts(false); - serialPort.setRts(true); - serialPort.setRts(false); - - return waitForBoot("Hardware reset"); - } - - private boolean waitForBoot(String resetMode) { - Future waiter = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class); - try { - ZstackFrameResponse response = waiter.get(BOOTLOAD_TIMEOUT, TimeUnit.MILLISECONDS); - logger.debug("ZStack Initialisation: Bootloader reset via {} response {}", resetMode, response); - return true; - } catch (InterruptedException | ExecutionException | TimeoutException e) { - logger.debug("ZStack Initialisation: Bootloader reset via {} failed", resetMode, e); - return false; - } - } - - /** - * Resets the NCP and optionally clears the existing network information. - * - * @param ncp the {@link ZstackNcp} - * @param initialise true to remove all current network information - * @return a {@link ZigBeeStatus} defining the success of reason for failure - */ - private ZigBeeStatus resetNcp(ZstackNcp ncp, boolean initialise) { - // Ensure the start options are set to reset the configuration to defaults so we start in a known config - if (ncp.setStartupOptions(true, initialise) != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack Initialisation: Failed to set startup options"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - return ZigBeeStatus.SUCCESS; - } - - /** - * Waits for the NCP to come online. - * - * @param ncp the {@link ZstackNcp} - * @return true if the NCP is online, false if the method times out while waiting - */ - public boolean waitForNcpOnline(ZstackNcp ncp) { - long waitTime = System.currentTimeMillis() + ONLINE_TIMEOUT; - while (waitTime > System.currentTimeMillis()) { - logger.debug("ZStack dongle waiting for NCP to come online"); - Future stateChangeFuture = protocolHandler.waitForEvent(ZstackZdoStateChangeIndAreq.class); - try { - ZstackZdoStateChangeIndAreq stateChange = stateChangeFuture.get(500, TimeUnit.MILLISECONDS); - if (isStackOnline(stateChange.getState())) { - return true; - } - } catch (InterruptedException | ExecutionException | TimeoutException e) { - // Eat this exception - } - } - - // It's possible to get here with the NCP being online if we miss the event while we weren't listening - // Do one last check - ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - return isStackOnline(deviceInfo.getDeviceState()); - } - - private boolean isStackOnline(ZstackZdoState state) { - switch (state) { - case DEV_NWK_ORPHAN: - case DEV_ROUTER: - case DEV_ZB_COORD: - case DEV_END_DEVICE: - // NCP is now on the network - return true; - default: - return false; - } - } -} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index b4c915666a..11e80a2285 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -15,15 +15,16 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.zsmartsystems.zigbee.ZigBeeExecutors; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackCommand; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameFactory; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; @@ -64,21 +65,11 @@ private enum ZstackState { */ private final Logger logger = LoggerFactory.getLogger(ZstackProtocolHandler.class); - /** - * The packet handler. - */ - private final ZstackFrameHandler frameHandler; - /** * The port. */ private ZigBeePort port; - /** - * The parser parserThread. - */ - private Thread parserThread = null; - /** * Flag reflecting that parser has been closed and parser parserThread should exit. */ @@ -89,17 +80,9 @@ private enum ZstackState { */ private final Queue sendQueue = new ConcurrentLinkedQueue<>(); - private ExecutorService executor = Executors.newCachedThreadPool(); - private final List transactionListeners = new ArrayList<>(); + private ExecutorService executor = ZigBeeExecutors.newCachedThreadPool("ZstackProtocolHandler"); - /** - * Construct the handler and provides the {@link ZstackFrameHandler} - * - * @param frameHandler the {@link ZstackFrameHandler} to receive incoming frames - */ - public ZstackProtocolHandler(final ZstackFrameHandler frameHandler) { - this.frameHandler = frameHandler; - } + private final List transactionListeners = new ArrayList<>(); /** * Starts the handler. Sets input stream where the packet is read from the and @@ -110,55 +93,50 @@ public ZstackProtocolHandler(final ZstackFrameHandler frameHandler) { public void start(final ZigBeePort port) { this.port = port; - parserThread = new Thread("ZstackFrameHandler") { - @Override - public void run() { - logger.debug("ZstackFrameHandler thread started"); + executor.execute(() -> { + logger.debug("ZstackFrameHandler thread started"); - int exceptionCnt = 0; + int exceptionCnt = 0; - while (!closeHandler) { - try { - final int[] frameData = getPacket(); - logger.debug("ZSTACK RX: FrameData [ data={}]", frameToString(frameData)); + while (!closeHandler) { + try { + final int[] frameData = getPacket(); + logger.debug("ZSTACK RX: FrameData [ data={}]", frameToString(frameData)); - if (waitingSrsp.compareAndSet(isSynchronous(frameData[0]), false)) { - logger.debug("ZSTACK synchronous frame received. waitingSrsp={}, isSynchronous={}", - waitingSrsp, isSynchronous(frameData[0])); - } + if (frameData == null) { + continue; + } - ZstackFrameResponse response = ZstackFrameFactory.createFrame(frameData); - if (response == null) { - logger.debug("RX ZSTACK: ZstackUnknownFrame [ data={}]", frameToString(frameData)); - continue; - } else { - logger.debug("RX ZSTACK: {}", response); - } + if (waitingSrsp.compareAndSet(isSynchronous(frameData[0]), false)) { + logger.debug("ZSTACK synchronous frame received. waitingSrsp={}, isSynchronous={}", + waitingSrsp, isSynchronous(frameData[0])); + } - // Send this into the stack - frameHandler.handlePacket(response); + ZstackFrameResponse response = ZstackFrameFactory.createFrame(frameData); + if (response == null) { + logger.debug("RX ZSTACK: ZstackUnknownFrame [ data={}]", frameToString(frameData)); + continue; + } else { + logger.debug("RX ZSTACK: {}", response); + } - // Also handle any ZStack level transactions (SREQ transactions or waiting events) - notifyResponseReceived(response); + // Also handle any ZStack level transactions (SREQ transactions or waiting events) + notifyResponseReceived(response); - sendNextFrame(); - } catch (final IOException e) { - logger.error("ZstackFrameHandler IOException: ", e); + sendNextFrame(); + } catch (final IOException e) { + logger.error("ZstackFrameHandler IOException: ", e); - if (exceptionCnt++ > 10) { - logger.error("ZstackFrameHandler exception count exceeded"); - closeHandler = true; - } - } catch (final Exception e) { - logger.error("ZstackFrameHandler Exception: ", e); + if (exceptionCnt++ > 10) { + logger.error("ZstackFrameHandler exception count exceeded"); + closeHandler = true; } + } catch (final Exception e) { + logger.error("ZstackFrameHandler Exception: ", e); } - logger.debug("ZstackFrameHandler exited."); } - }; - - parserThread.setDaemon(true); - parserThread.start(); + logger.debug("ZstackFrameHandler exited."); + }); } public int[] getPacket() throws IOException { @@ -169,7 +147,7 @@ public int[] getPacket() throws IOException { ZstackState state = ZstackState.SOF; while (!closeHandler) { - int val = port.read(); + int val = port.read(1000); logger.trace("ZSTACK RX Byte: {} [{}/{}]", String.format("%02X", val), bytesRead, length); if (val == -1) { continue; @@ -235,8 +213,8 @@ private boolean isSynchronous(int cmd0) { } public void setClosing() { - executor.shutdown(); closeHandler = true; + executor.shutdown(); } public void close() { @@ -247,21 +225,7 @@ public void close() { sendQueue.clear(); - frameHandler.handleLinkStateChange(false); - executor.shutdownNow(); - - try { - parserThread.interrupt(); - parserThread.join(); - logger.debug("ZstackFrameHandler close complete."); - } catch (InterruptedException e) { - logger.debug("ZstackFrameHandler interrupted in packet parser thread shutdown join."); - } - } - - public boolean isAlive() { - return parserThread != null && parserThread.isAlive(); } /** @@ -289,18 +253,12 @@ public void queueFrame(ZstackFrameRequest request) { * @param response the response {@link ZstackFrameResponse} received * @return true if the response was processed */ - private boolean notifyResponseReceived(final ZstackFrameResponse response) { - boolean processed = false; - + private void notifyResponseReceived(final ZstackFrameResponse response) { synchronized (transactionListeners) { for (ZstackListener listener : transactionListeners) { - if (listener.transactionEvent(response)) { - processed = true; - } + listener.transactionEvent(response); } } - - return processed; } private void addTransactionListener(ZstackListener listener) { @@ -410,18 +368,16 @@ public RES call() { } @Override - public boolean transactionEvent(ZstackFrameResponse response) { + public void transactionEvent(ZstackFrameResponse response) { // Check if this response completes our transaction if (responseType.isInstance(response)) { this.response = responseType.cast(response); } else if (ZstackRpcSreqErrorSrsp.class.isInstance(response) && request.matchSreqError((ZstackRpcSreqErrorSrsp) response)) { } else { - return false; + return; } transactionComplete(); - - return true; } @Override @@ -437,6 +393,26 @@ public void transactionComplete() { return executor.submit(worker); } + public ZstackListener listener(final Class requiredResponse, final Consumer delivery) { + final ZstackListener listener = new ZstackListener() { + @Override + public void transactionEvent(ZstackFrameResponse response) { + if (requiredResponse.isInstance(response)) { + executor.execute(() -> delivery.accept(requiredResponse.cast(response))); + } + } + + @Override + public void transactionComplete() { + executor.execute(() -> removeTransactionListener(this)); + } + }; + + addTransactionListener(listener); + + return listener; + } + /** * Waiting for a specific response from the NCP. * @@ -476,16 +452,14 @@ public RES call() { } @Override - public boolean transactionEvent(ZstackFrameResponse response) { + public void transactionEvent(ZstackFrameResponse response) { // Check if this response completes our transaction if (response.getClass() != requiredResponse) { - return true; + return; } transactionComplete(); this.response = requiredResponse.cast(response); - - return true; } @Override @@ -539,7 +513,7 @@ private String frameToString(int[] inputBuffer) { } interface ZstackListener { - boolean transactionEvent(ZstackFrameResponse response); + void transactionEvent(ZstackFrameResponse response); void transactionComplete(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index df65604905..0d547064ad 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -81,13 +81,11 @@ public ZstackNcp getZstackNcp() { response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ROUTER); - dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.ONLINE); assertEquals(Integer.valueOf(1243), dongle.getNwkAddress()); response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_INIT); - dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.OFFLINE); } @@ -118,14 +116,12 @@ public void testEzspMessageSentHandler() throws Exception { ZstackAfDataConfirmAreq response = Mockito.mock(ZstackAfDataConfirmAreq.class); Mockito.when(response.getTransId()).thenReturn(231); Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.SUCCESS); - dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, ZigBeeTransportProgressState.RX_ACK); response = Mockito.mock(ZstackAfDataConfirmAreq.class); Mockito.when(response.getTransId()).thenReturn(231); Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.FAILURE); - dongle.handlePacket(response); Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, ZigBeeTransportProgressState.RX_NAK); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index 88286dde25..bccb6516fb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -33,10 +33,8 @@ * */ public class ZstackProtocolHandlerTest { - private static int TIMEOUT = 5000; - private int[] getPacket(int[] data) { - ZstackProtocolHandler handler = new ZstackProtocolHandler(null); + ZstackProtocolHandler handler = new ZstackProtocolHandler(); byte[] bytedata = new byte[data.length]; int cnt = 0; for (int value : data) { @@ -78,7 +76,7 @@ public void testReceivePacketLeadingRubbish() { @Test public void isSynchronous() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - ZstackProtocolHandler handler = new ZstackProtocolHandler(null); + ZstackProtocolHandler handler = new ZstackProtocolHandler(); assertTrue((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", int.class, 0x61)); From 8e040ae12947b5de244d9603ece780dea1e466e9 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Tue, 27 Sep 2022 22:51:10 +0200 Subject: [PATCH 18/33] Fixing some basic warnings --- .../ZstackConsoleNcpSecurityCommand.java | 2 - .../zstack/autocode/ClassGenerator.java | 4 -- .../zstack/autocode/ZstackAutocoder.java | 39 ++++++++++--------- .../build.gradle | 7 ---- .../dongle/zstack/ZigBeeDongleZstack.java | 2 - .../zigbee/dongle/zstack/ZstackNcp.java | 1 - .../zstack/api/ZstackFrameRequestTest.java | 1 - settings.gradle | 6 +++ 8 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 com.zsmartsystems.zigbee.dongle.zstack/build.gradle diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java index ad93996463..493e4f60d1 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -23,8 +23,6 @@ * */ public class ZstackConsoleNcpSecurityCommand extends ZstackConsoleAbstractCommand { - private static int INVALID_NODE_ADDR = 0xFFFE; - @Override public String getCommand() { return "ncpsecurity"; diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index d2f8efc43f..2be4dcfcc1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -156,11 +156,7 @@ protected void outputCopywrite(PrintWriter out) { } out.println(" */"); br.close(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java index 483aba9732..2251c6214e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java @@ -47,7 +47,7 @@ public static void main(final String[] args) { doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("protocol"); - protocol = (Protocol) processNode(nList.item(0)); + protocol = processNode(nList.item(0)); } catch (Exception e) { e.printStackTrace(); @@ -63,7 +63,8 @@ public static void main(final String[] args) { } } - private static Object processNode(Node node) { + @SuppressWarnings("unchecked") + private static T processNode(Node node) { System.out.println("\nCurrent Element :" + node.getNodeName()); NodeList nodes = node.getChildNodes(); @@ -77,16 +78,16 @@ private static Object processNode(Node node) { for (int temp = 0; temp < nodes.getLength(); temp++) { if (nodes.item(temp).getNodeName().equals("command")) { - protocol.commands.add((Command) processNode(nodes.item(temp))); + protocol.commands.add(processNode(nodes.item(temp))); } if (nodes.item(temp).getNodeName().equals("structure")) { - protocol.structures.add((Structure) processNode(nodes.item(temp))); + protocol.structures.add(processNode(nodes.item(temp))); } if (nodes.item(temp).getNodeName().equals("enum")) { - protocol.enumerations.add((Enumeration) processNode(nodes.item(temp))); + protocol.enumerations.add(processNode(nodes.item(temp))); } } - return protocol; + return (T) protocol; case "command": Command command = new Command(); @@ -116,17 +117,17 @@ private static Object processNode(Node node) { if (command.request_parameters == null) { command.request_parameters = new ArrayList<>(); } - command.request_parameters = (List) processNode(nodes.item(temp)); + command.request_parameters = processNode(nodes.item(temp)); } if (nodes.item(temp).getNodeName().equals("response")) { if (command.response_parameters == null) { command.response_parameters = new ArrayList<>(); } - command.response_parameters = (List) processNode(nodes.item(temp)); + command.response_parameters = processNode(nodes.item(temp)); } } System.out.println("Done: Command - " + command.name); - return command; + return (T) command; case "request": case "response": case "parameters": @@ -134,10 +135,10 @@ private static Object processNode(Node node) { for (int temp = 0; temp < nodes.getLength(); temp++) { if (nodes.item(temp).getNodeName().equals("parameter")) { - parameters.add((Parameter) processNode(nodes.item(temp))); + parameters.add(processNode(nodes.item(temp))); } } - return parameters; + return (T) parameters; case "parameter": Parameter parameter = new Parameter(); for (int temp = 0; temp < nodes.getLength(); temp++) { @@ -165,7 +166,7 @@ private static Object processNode(Node node) { } } System.out.println("Done: Parameter - " + parameter.name); - return parameter; + return (T) parameter; case "structure": Structure structure = new Structure(); structure.parameters = new ArrayList<>(); @@ -182,11 +183,11 @@ private static Object processNode(Node node) { } if (nodes.item(temp).getNodeName().equals("parameters")) { - structure.parameters = (List) processNode(nodes.item(temp)); + structure.parameters = processNode(nodes.item(temp)); } } System.out.println("Done: Structure - " + structure.name); - return structure; + return (T) structure; case "enum": Enumeration enumeration = new Enumeration(); enumeration.values = new ArrayList(); @@ -205,7 +206,7 @@ private static Object processNode(Node node) { Element dataTypeElement = (Element) nodes.item(temp); enumeration.fullyDefined = "true" .equalsIgnoreCase(dataTypeElement.getAttribute("fully_defined")); - enumeration.values = (List) processNode(nodes.item(temp)); + enumeration.values = processNode(nodes.item(temp)); } if (nodes.item(temp).getNodeName().equals("format")) { enumeration.format = nodes.item(temp).getTextContent().trim(); @@ -215,16 +216,16 @@ private static Object processNode(Node node) { } } System.out.println("Done: Enum - " + enumeration.name); - return enumeration; + return (T) enumeration; case "values": List values = new ArrayList<>(); for (int temp = 0; temp < nodes.getLength(); temp++) { if (nodes.item(temp).getNodeName().equals("value")) { - values.add((Value) processNode(nodes.item(temp))); + values.add(processNode(nodes.item(temp))); } } - return values; + return (T) values; case "value": Value value = new Value(); for (int temp = 0; temp < nodes.getLength(); temp++) { @@ -244,7 +245,7 @@ private static Object processNode(Node node) { } } System.out.println("Done: Value - " + value.name); - return value; + return (T) value; default: System.out.println("Uknown node " + node.getNodeName()); break; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/build.gradle b/com.zsmartsystems.zigbee.dongle.zstack/build.gradle deleted file mode 100644 index e612c6c044..0000000000 --- a/com.zsmartsystems.zigbee.dongle.zstack/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group = 'com.zsmartsystems.zigbee' -description = '' -dependencies { - compile project(':com.zsmartsystems.zigbee') - - testCompile project(':com.zsmartsystems.zigbee').sourceSets.test.output -} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index cdfd91e29d..a849ac82cf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -442,7 +442,6 @@ public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { // Remember the time to reduce unnecessary polling lastSendCommandTime = System.currentTimeMillis(); - // TODO: How to differentiate group and device addressing????? ZstackAfDataRequestSreq request = new ZstackAfDataRequestSreq(); request.setClusterID(apsFrame.getCluster()); request.setDstAddr(apsFrame.getDestinationAddress()); @@ -454,7 +453,6 @@ public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { request.addOptions(AfDataOptions.AF_DISCV_ROUTE); if (apsFrame.getAckRequest()) { - // TODO: is this really necessary request.addOptions(AfDataOptions.AF_ACK_REQUEST); } if (apsFrame.getSecurityEnabled()) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index f6b7062592..b929a07f29 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -424,7 +424,6 @@ public Integer setTxPower(int txPower) { * @return {@link ZstackResponseCode} returned from the NCP */ public ZstackResponseCode setChannelMask(ZigBeeChannelMask channelMask) { - // TODO: ZCD_NV_CHANLIST ZstackUtilSetChannelsSreq request = new ZstackUtilSetChannelsSreq(); request.setChannels(channelMask.getChannelMask()); ZstackUtilSetChannelsSrsp response = protocolHandler.sendTransaction(request, ZstackUtilSetChannelsSrsp.class); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java index 834e35e14b..17477a7f78 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameRequestTest.java @@ -66,7 +66,6 @@ public void serializeBoolean() { class Request extends ZstackFrameRequest { @Override public int[] serialize() { - // TODO Auto-generated method stub return null; } } diff --git a/settings.gradle b/settings.gradle index eabf951394..ea80b5e1f6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,10 +8,13 @@ include ':com.zsmartsystems.zigbee.dongle.ember' include ':com.zsmartsystems.zigbee.dongle.conbee' include ':com.zsmartsystems.zigbee.dongle.telegesis' include ':com.zsmartsystems.zigbee.dongle.telegesis.autocode' +include ':com.zsmartsystems.zigbee.dongle.zstack' +include ':com.zsmartsystems.zigbee.dongle.zstack.autocode' include ':com.zsmartsystems.zigbee.console' include ':com.zsmartsystems.zigbee.console.ember' include ':com.zsmartsystems.zigbee.console.main' include ':com.zsmartsystems.zigbee.console.telegesis' +include ':com.zsmartsystems.zigbee.console.zstack' include ':com.zsmartsystems.zigbee.serial' include ':com.zsmartsystems.zigbee.test' include ':com.zsmartsystems.zigbee.p2repo' @@ -25,10 +28,13 @@ project(':com.zsmartsystems.zigbee.dongle.ember').projectDir = "$rootDir/com.zsm project(':com.zsmartsystems.zigbee.dongle.conbee').projectDir = "$rootDir/com.zsmartsystems.zigbee.dongle.conbee" as File project(':com.zsmartsystems.zigbee.dongle.telegesis').projectDir = "$rootDir/com.zsmartsystems.zigbee.dongle.telegesis" as File project(':com.zsmartsystems.zigbee.dongle.telegesis.autocode').projectDir = "$rootDir/com.zsmartsystems.zigbee.dongle.telegesis.autocode" as File +project(':com.zsmartsystems.zigbee.dongle.zstack').projectDir = "$rootDir/com.zsmartsystems.zigbee.dongle.zstack" as File +project(':com.zsmartsystems.zigbee.dongle.zstack.autocode').projectDir = "$rootDir/com.zsmartsystems.zigbee.dongle.zstack.autocode" as File project(':com.zsmartsystems.zigbee.console').projectDir = "$rootDir/com.zsmartsystems.zigbee.console" as File project(':com.zsmartsystems.zigbee.console.ember').projectDir = "$rootDir/com.zsmartsystems.zigbee.console.ember" as File project(':com.zsmartsystems.zigbee.console.main').projectDir = "$rootDir/com.zsmartsystems.zigbee.console.main" as File project(':com.zsmartsystems.zigbee.console.telegesis').projectDir = "$rootDir/com.zsmartsystems.zigbee.console.telegesis" as File +project(':com.zsmartsystems.zigbee.console.zstack').projectDir = "$rootDir/com.zsmartsystems.zigbee.console.zstack" as File project(':com.zsmartsystems.zigbee.serial').projectDir = "$rootDir/com.zsmartsystems.zigbee.serial" as File project(':com.zsmartsystems.zigbee.test').projectDir = "$rootDir/com.zsmartsystems.zigbee.test" as File project(':com.zsmartsystems.zigbee.p2repo').projectDir = "$rootDir/releng/p2repo" as File \ No newline at end of file From d22fb76748d3ca01ec1314c47b77c7cecd856ee3 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 28 Sep 2022 09:12:27 +0200 Subject: [PATCH 19/33] Cleaning up TransactionWaiter and fixes stacktrace --- .../dongle/zstack/ZigBeeDongleZstack.java | 37 +++++-- .../internal/ZstackProtocolHandler.java | 102 +++--------------- 2 files changed, 43 insertions(+), 96 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index a849ac82cf..612ffa8fac 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -14,6 +14,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -178,7 +179,7 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { /** * The rate at which we will do a status poll if we've not sent any other messages within this period */ - private int pollRate = 1000; + private int pollRate = 100000; /** * The time the last command was sent from the {@link ZigBeeNetworkManager}. This is used by the dongle polling task @@ -186,6 +187,8 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { */ private long lastSendCommandTime; + private ResetListener resetListener; + /** * Create a {@link ZigBeeDongleZstack} * @@ -211,12 +214,22 @@ public ZigBeeStatus initialize() { return ZigBeeStatus.COMMUNICATION_ERROR; } + resetListener = new ResetListener(); + protocolHandler = new ZstackProtocolHandler(); + protocolHandler.listener(ZstackSysResetIndAreq.class, resetListener); protocolHandler.start(serialPort); ZstackNcp ncp = getZstackNcp(); Set capabilities = ncp.pingNcp(); + if (capabilities.isEmpty()) { + if (ncp.resetNcp(ZstackResetType.TARGET_DEVICE) == null) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } else { + capabilities = ncp.pingNcp(); + } + } logger.debug("ZStack subsystem capabilities: {}", capabilities); ZstackSysVersionSrsp version = ncp.getVersion(); @@ -650,16 +663,15 @@ private void handleLinkStateChange(final boolean linkState) { networkStateUp = linkState; - executorService.execute(() -> { - if (linkState) { - // obtain network address after startup + if (linkState) { + executorService.execute(() -> { ZstackNcp ncp = getZstackNcp(); nwkAddress = ncp.getNwkAddress(); - } - // Handle link changes and notify framework - zigbeeTransportReceive - .setTransportState(linkState ? ZigBeeTransportState.ONLINE : ZigBeeTransportState.OFFLINE); - }); + zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); + }); + } else { + zigbeeTransportReceive.setTransportState(ZigBeeTransportState.OFFLINE); + } } /** @@ -753,4 +765,11 @@ private ZigBeeStatus startNetwork() { return ZigBeeStatus.SUCCESS; } + + private class ResetListener implements Consumer { + @Override + public synchronized void accept(final ZstackSysResetIndAreq t) { + logger.warn("Unexpected reset occured"); + } + } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index 11e80a2285..958700c12f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -16,8 +16,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; @@ -139,7 +137,7 @@ public void start(final ZigBeePort port) { }); } - public int[] getPacket() throws IOException { + private int[] getPacket() throws IOException { int length = 0; int bytesRead = 0; int[] frameData = null; @@ -282,7 +280,7 @@ private void removeTransactionListener(ZstackListener listener) { */ private void clearTransactionQueue() { synchronized (transactionListeners) { - for (ZstackListener listener : transactionListeners) { + for (ZstackListener listener : new ArrayList<>(transactionListeners)) { listener.transactionComplete(); } } @@ -326,20 +324,13 @@ public void sendRaw(int rawByte) { port.write(rawByte); } - /** - * Sends a ZStack request to the NCP without waiting for the response. - * - * @param transaction Request {@link ZstackTransaction} - * @return response {@link Future} {@link ZstackFrameResponse} - */ - public Future sendZstackRequestAsync(final REQ request, final Class responseType) { + private Future sendZstackRequestAsync(final REQ request, final Class responseType) { if (closeHandler) { logger.debug("ZSTACK: Handler is closed"); return null; } class TransactionWaiter implements Callable, ZstackListener { - private boolean complete = false; private RES response = null; @Override @@ -352,18 +343,14 @@ public RES call() { // Wait for the transaction to complete synchronized (this) { - while (!complete) { - try { - wait(); - } catch (InterruptedException e) { - complete = true; - } + try { + wait(TIMEOUT); + } catch (InterruptedException e) { + } finally { + removeTransactionListener(this); } } - // Remove the listener - removeTransactionListener(this); - return response; } @@ -383,7 +370,6 @@ public void transactionEvent(ZstackFrameResponse response) { @Override public void transactionComplete() { synchronized (this) { - complete = true; notify(); } } @@ -394,6 +380,10 @@ public void transactionComplete() { } public ZstackListener listener(final Class requiredResponse, final Consumer delivery) { + if (closeHandler) { + return null; + } + final ZstackListener listener = new ZstackListener() { @Override public void transactionEvent(ZstackFrameResponse response) { @@ -404,7 +394,7 @@ public void transactionEvent(ZstackFrameResponse response) { @Override public void transactionComplete() { - executor.execute(() -> removeTransactionListener(this)); + removeTransactionListener(this); } }; @@ -413,68 +403,6 @@ public void transactionComplete() { return listener; } - /** - * Waiting for a specific response from the NCP. - * - * @param transaction Request {@link ZstackTransaction} - * @return response {@link Future} {@link ZstackFrameResponse} - */ - public Future waitForEvent(final Class requiredResponse) { - if (closeHandler) { - logger.debug("ZSTACK: Handler is closed"); - return null; - } - - class TransactionWaiter implements Callable, ZstackListener { - private boolean complete = false; - private RES response; - - @Override - public RES call() { - // Register a listener - addTransactionListener(this); - - // Wait for the event to be received - synchronized (this) { - while (!complete) { - try { - wait(); - } catch (InterruptedException e) { - complete = true; - } - } - } - - // Remove the listener - removeTransactionListener(this); - - return response; - } - - @Override - public void transactionEvent(ZstackFrameResponse response) { - // Check if this response completes our transaction - if (response.getClass() != requiredResponse) { - return; - } - - transactionComplete(); - this.response = requiredResponse.cast(response); - } - - @Override - public void transactionComplete() { - synchronized (this) { - complete = true; - notify(); - } - } - } - - Callable worker = new TransactionWaiter(); - return executor.submit(worker); - } - /** * Sends a ZStack request to the NCP and waits for the response. The response is correlated with the request and the * returned {@link ZstackTransaction} contains the request and response data. @@ -492,8 +420,8 @@ public RES sen } try { - return futureResponse.get(TIMEOUT, TimeUnit.MILLISECONDS); - } catch (InterruptedException | TimeoutException | ExecutionException e) { + return futureResponse.get(); + } catch (InterruptedException | ExecutionException e) { futureResponse.cancel(true); logger.debug("ZSTACK interrupted in sendTransaction for {}", request, e); } From b56de4049ab32142275a8782d0c33efca4e2aea6 Mon Sep 17 00:00:00 2001 From: Hedda Date: Wed, 28 Sep 2022 12:44:46 +0200 Subject: [PATCH 20/33] Update README.md for Z-Stack 3 ZNP Update README.md for Z-Stack 3 ZNP --- README.md | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f0941837e5..69277c9602 100644 --- a/README.md +++ b/README.md @@ -79,23 +79,26 @@ The following clusters are currently supported -: The framework implements a package structure that allows efficient use of re-usable components in a number of different applications. -| Package | Description | -| -------------------------------------------------- | ------------------------------------------------------ | -| com.zsmartsystems.zigbee | The main framework and cluster library implementation | -| com.zsmartsystems.zigbee.autocode | Code generator for the ZigBee cluster library classes | -| com.zsmartsystems.zigbee.dongle.cc2531 | Dongle driver for the Texas Instruments ZNP CC2531 | -| com.zsmartsystems.zigbee.dongle.conbee | Dongle driver for the Dresden Electronics Conbee | -| com.zsmartsystems.zigbee.dongle.ember | Dongle driver for the Silabs EZSP Network Co-Processor | -| com.zsmartsystems.zigbee.dongle.ember.autocode | Code generator for the Ember NCP dongle commands | -| com.zsmartsystems.zigbee.dongle.telegesis | Dongle driver for the Telegesis dongle | -| com.zsmartsystems.zigbee.dongle.telegesis.autocode | Code generator for the Telegesis dongle commands | -| com.zsmartsystems.zigbee.dongle.xbee | Dongle driver for the Digi XBee dongle | -| com.zsmartsystems.zigbee.dongle.xbee.autocode | Code generator for the XBee dongle commands | -| com.zsmartsystems.zigbee.console | Console commands for the general framework | -| com.zsmartsystems.zigbee.console.ember | Console commands for the Silabs Ember NCP | -| com.zsmartsystems.zigbee.console.main | Main CLI console application | -| com.zsmartsystems.zigbee.serial | Serial driver implementation | -| com.zsmartsystems.zigbee.test | Overall tests and code coverage | +| Package | Description | +| -------------------------------------------------- | ------------------------------------------------------- | +| com.zsmartsystems.zigbee | The main framework and cluster library implementation | +| com.zsmartsystems.zigbee.autocode | Code generator for the ZigBee cluster library classes | +| com.zsmartsystems.zigbee.dongle.cc2531 | Dongle driver for the Texas Instruments ZNP CC2531 | +| com.zsmartsystems.zigbee.dongle.conbee | Dongle driver for the Dresden Electronics Conbee | +| com.zsmartsystems.zigbee.dongle.ember | Dongle driver for the Silabs EZSP Network Co-Processor | +| com.zsmartsystems.zigbee.dongle.ember.autocode | Code generator for the Ember NCP dongle commands | +| com.zsmartsystems.zigbee.dongle.telegesis | Dongle driver for the Telegesis dongle | +| com.zsmartsystems.zigbee.dongle.telegesis.autocode | Code generator for the Telegesis dongle commands | +| com.zsmartsystems.zigbee.dongle.xbee | Dongle driver for the Digi XBee dongle | +| com.zsmartsystems.zigbee.dongle.xbee.autocode | Code generator for the XBee dongle commands | +| com.zsmartsystems.zigbee.dongle.zstack | Dongle driver for Texas Instruments Z-Stack 3 dongles | +| com.zsmartsystems.zigbee.dongle.zstack.autocode | Code generator for the TI Z-Stack 3 dongle commands | +| com.zsmartsystems.zigbee.console | Console commands for the general framework | +| com.zsmartsystems.zigbee.console.ember | Console commands for the Silabs Ember NCP | +| com.zsmartsystems.zigbee.console.main | Main CLI console application | +| com.zsmartsystems.zigbee.console.zstack | Console commands for Texas Instruments ZNP of Z-Stack 3 | +| com.zsmartsystems.zigbee.serial | Serial driver implementation | +| com.zsmartsystems.zigbee.test | Overall tests and code coverage | ## Testing @@ -145,7 +148,11 @@ The [com.zsmartsystems.zigbee.sniffer](https://github.com/zsmartsystems/com.zsma ### Texas Instruments CC2531 -The library supports the Texas Instruments ZNP protocol over a serial interface. +The library supports the Texas Instruments Z-Stack Home 1.2 ZNP protocol over a serial interface as used by Zigbee Coordinator NCP firmware on TI CC2530 and CC2531 series based dongles. + +### Texas Instruments Z-Stack + +The library supports the Texas Instruments Z-Stack 3.x ZNP protocol over a serial interface as used by Zigbee Coordinator NCP firmware on TI CC2652 and CC1352 series based dongles. ### Telegesis ETRX3 @@ -180,12 +187,17 @@ The following table provides a summary of some of the dongles / chipsets that ar | EFR32 | Yes (EZSP) | | | | | **EM358LR** | Yes (EZSP) | -103dBm | **+20.0dBm** | Internal | | MGM111 | Yes (EZSP) | -99dBm | +10.0dBm | Internal | -| RaspBee | Yes (CONBEE) | **-105dBm** | +8.7dBm | Internal | -| ConBee | Yes (CONBEE) | **-105dBm** | +8.7dBm | Internal | +| RaspBee | Yes (CONBEE) | -105dBm | +8.7dBm | Internal | +| ConBee | Yes (CONBEE) | -105dBm | +8.7dBm | Internal | | CC2530 | Yes (ZNP) | -97dBm | +4.5dBm | | | CC2531 | Yes (ZNP) | -97dBm | +4.5dBm | | | CC2538 | Yes (ZNP) | -97dBm | +7.0dBm | | | CC2650 | Yes (ZNP) | -100dBm | +5.0dBm | | +| CC2652P | Yes (Z-Stack) | -105dBm | **+20.0dBm** | | +| CC2652R | Yes (Z-Stack) | -105dBm | +5.0dBm | | +| CC2652RB | Yes (Z-Stack) | -102dBm | +5.0dBm | | +| CC1352P | Yes (Z-Stack) | **-121dBm** | **+20.0dBm** | | +| CC1352R | Yes (Z-Stack) | **-121dBm** | +5.0dBm | | | ATSAMR21 | No | -99dBm | +4.0dBm | | | JN5169 | No | -96dBm | +10.0dBm | | | HUSBZB-1 | Yes (EZSP) | | | Internal | From 5afeb823d898d5685b1c2c503a88f72c73d71058 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sat, 15 Oct 2022 08:28:00 +0200 Subject: [PATCH 21/33] New configuration system --- .../console/main/ZigBeeConsoleMain.java | 10 +- .../dongle/zstack/ZigBeeDongleZstack.java | 512 +++++++++--------- 2 files changed, 265 insertions(+), 257 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java index a0be005629..82c35cc3db 100644 --- a/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java +++ b/com.zsmartsystems.zigbee.console.main/src/main/java/com/zsmartsystems/zigbee/console/main/ZigBeeConsoleMain.java @@ -52,7 +52,6 @@ import com.zsmartsystems.zigbee.console.ember.EmberConsoleSecurityStateCommand; import com.zsmartsystems.zigbee.console.ember.EmberConsoleTransientKeyCommand; import com.zsmartsystems.zigbee.console.telegesis.TelegesisConsoleSecurityStateCommand; -import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpDiagnosticsCommand; import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpSecurityCommand; import com.zsmartsystems.zigbee.console.zstack.ZstackConsoleNcpStateCommand; import com.zsmartsystems.zigbee.database.ZigBeeNetworkDataStore; @@ -261,7 +260,6 @@ public static void main(final String[] args) { commands.add(ZstackConsoleNcpStateCommand.class); commands.add(ZstackConsoleNcpSecurityCommand.class); - commands.add(ZstackConsoleNcpDiagnosticsCommand.class); } else if (dongleName.toUpperCase().equals("EMBER")) { ZigBeeDongleEzsp emberDongle = new ZigBeeDongleEzsp(serialPort); dongle = emberDongle; @@ -396,7 +394,7 @@ public static void main(final String[] args) { System.out.println(" * PAN ID = " + pan); System.out.println(" * Extended PAN ID = " + extendedPan); System.out.println(" * Link Key = " + linkKey); - if (nwkKey.hasOutgoingFrameCounter()) { + if (linkKey.hasOutgoingFrameCounter()) { System.out.println(" * Link Key Frame Cnt = " + linkKey.getOutgoingFrameCounter()); } System.out.println(" * Network Key = " + nwkKey); @@ -451,12 +449,6 @@ public static void main(final String[] args) { tiDongle.setLedMode(2, false); } - if (dongleName.equalsIgnoreCase("ZSTACK")) { - // Required to allow HA1.2 devices to join the ZB3.0 compatible coordinator - ZigBeeDongleZstack zstackDongle = (ZigBeeDongleZstack) dongle; - zstackDongle.requireKeyExchange(false); - } - console.start(); System.out.println("Console closed."); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 612ffa8fac..d27da4ddb5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -7,14 +7,19 @@ */ package com.zsmartsystems.zigbee.dongle.zstack; +import java.util.Arrays; +import java.util.EnumSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,6 +103,11 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { */ private final Logger logger = LoggerFactory.getLogger(ZigBeeDongleZstack.class); + /** + * The default link key + */ + private static final ZigBeeKey DEFAULT_TCLK = new ZigBeeKey(new int[] { 0x5A, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, 0x6C, 0x6C, 0x69, 0x61, 0x6E, 0x63, 0x65, 0x30, 0x39 }); + /** * The serial port used to connect to the dongle */ @@ -118,16 +128,6 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { */ private ZigBeeTransportReceive zigbeeTransportReceive; - /** - * The current link key as {@link ZigBeeKey} - */ - private ZigBeeKey linkKey = new ZigBeeKey(); - - /** - * The current network key as {@link ZigBeeKey} - */ - private ZigBeeKey networkKey = new ZigBeeKey(); - /** * The IeeeAddress of the NCP */ @@ -139,34 +139,39 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { private Integer nwkAddress; /** - * The PAN ID + * The linkkey in use by the NCP */ - private Integer panId; + private ZigBeeKey linkKey; /** - * Requested TX power + * The ZStack version used in this system. Set during initialisation and save in case the client is interested. */ - private int txPower = 0; + private String versionString = "Unknown"; /** - * The extended PAN ID + * Boolean that is true when the network is UP */ - private ExtendedPanId extendedPanId; + private boolean networkStateUp = false; /** - * The ZStack version used in this system. Set during initialisation and save in case the client is interested. + * Default profile to use for the main endpoint */ - private String versionString = "Unknown"; + int defaultProfileId = ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey(); /** - * Boolean that is true when the network is UP + * Default device id to use for the main endpoint */ - private boolean networkStateUp = false; + int defaultDeviceId = ZigBeeDeviceType.HOME_GATEWAY.getKey(); /** - * Default profile to use for the main endpoint + * Default local endpoint id to use for the main endpoint + */ + int defaultLocalEndpointId = 1; + + /** + * Device was on a network */ - ZigBeeProfileType defaultProfile = ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION; + boolean isOnANetwork = false; /** * Boolean to hold initialisation state. Set to true after {@link #startup()} completes. @@ -187,6 +192,9 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { */ private long lastSendCommandTime; + /** + * The reset listener listenes for expected and unexpected resets. And handles the events. + */ private ResetListener resetListener; /** @@ -201,13 +209,35 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { stackConfiguration = new LinkedHashMap<>(); stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] { 0x00 }); + stackConfiguration.put(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, new int[] { 0x01 }); + } - networkKey = new ZigBeeKey(); + @Override + public void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportReceive) { + this.zigbeeTransportReceive = zigbeeTransportReceive; + } + + @Override + public void setDefaultProfileId(final int defaultProfileId) { + this.defaultProfileId = defaultProfileId; + } + + @Override + public void setDefaultDeviceId(final int defaultDeviceId) { + this.defaultDeviceId = defaultDeviceId; + } + + @Override + public void setDefaultLocalEndpointId(final int defaultLocalEndpointId) { + this.defaultLocalEndpointId = defaultLocalEndpointId; } @Override public ZigBeeStatus initialize() { logger.debug("ZStack dongle initialize: Starting"); + zigbeeTransportReceive.setTransportState(ZigBeeTransportState.INITIALISING); + + executorService = ZigBeeExecutors.newScheduledThreadPool(1, "ZstackTransport"); if (!serialPort.open()) { logger.error("Unable to open ZStack serial port"); @@ -249,14 +279,23 @@ public ZigBeeStatus initialize() { builder.append(version.getTransportRev()); versionString = builder.toString(); - ieeeAddress = ncp.getIeeeAddress(); + ieeeAddress = ncp.getDeviceInfo().getIeeeAddress(); logger.debug("ZStack local IeeeAddress: {}", ieeeAddress); - /* - * Create the scheduler with a single thread. This ensures that commands sent to the dongle, and the processing - * of responses is performed in order - */ - executorService = ZigBeeExecutors.newScheduledThreadPool(1, "ZstackTransport"); + final int[] configurationIsOnANetwork = ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); + isOnANetwork = configurationIsOnANetwork != null && configurationIsOnANetwork[0] != 0; + if (isOnANetwork) { + logger.debug("ZStack device is currently on a network. Read parameters from the device"); + final ZstackStackConfiguration config = new ZstackStackConfiguration(ncp); + Map readConfiguration = config.getConfiguration(EnumSet.of( + ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, + ZstackConfigId.ZCD_NV_PANID, + ZstackConfigId.ZCD_NV_PRECFGKEY, + ZstackConfigId.ZCD_NV_CHANLIST + )); + + stackConfiguration.putAll(readConfiguration); + } logger.debug("ZStack dongle initialize: Done"); @@ -288,58 +327,37 @@ public ZigBeeStatus startup(boolean reinitialize) { return ZigBeeStatus.COMMUNICATION_ERROR; } - // configure non-volatile - ZstackResponseCode ncpResponse = ncp.setNetworkKey(networkKey); - if (ncpResponse != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack error setting network key: {}", ncpResponse); - return ZigBeeStatus.COMMUNICATION_ERROR; - } + // Perform any stack configuration + ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); - ncpResponse = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, linkKey.getValue()); - if (ncpResponse != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack error setting link key: {}", ncpResponse); - return ZigBeeStatus.COMMUNICATION_ERROR; + Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); } - if (panId == null) { - // Allow the NCP to create a random PAN ID - panId = 0xFFFF; - } - ncpResponse = ncp.setPanId(panId); - if (ncpResponse != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack error setting PAN ID: {}", ncpResponse); - return ZigBeeStatus.COMMUNICATION_ERROR; + stackConfigurer.setConfiguration(stackConfiguration); + configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); } - if (extendedPanId == null) { - // Allow the NCP to create a random extended PAN ID - extendedPanId = new ExtendedPanId("FFFFFFFFFFFFFFFF"); - } - ncpResponse = ncp.setExtendedPanId(extendedPanId); - if (ncpResponse != ZstackResponseCode.SUCCESS) { - logger.debug("ZStack error setting extended PAN ID: {}", ncpResponse); - return ZigBeeStatus.COMMUNICATION_ERROR; + // reset the device + // reload non-volatile memory + ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); + } else { + // Perform stack configuration check + ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); + Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); + for (Entry config : configuration.entrySet()) { + logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); + if (Arrays.equals(config.getValue(), stackConfiguration.get(config.getKey()))) { + logger.debug("Config {} as configured", config.getKey()); + } else { + return ZigBeeStatus.INVALID_STATE; + } } } - // Perform any stack configuration - ZstackStackConfiguration stackConfigurer = new ZstackStackConfiguration(ncp); - - Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); - for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); - } - - stackConfigurer.setConfiguration(stackConfiguration); - configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); - for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), config.getValue()); - } - - // reset the device - // reload non-volatile memory - ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - // volatile configuration // setup callbacks ncp.zdoRegisterCallback(MatchDescriptorRequest.CLUSTER_ID); @@ -363,16 +381,15 @@ public ZigBeeStatus startup(boolean reinitialize) { ncp.zdoRegisterCallback(ManagementPermitJoiningResponse.CLUSTER_ID); // Add the endpoint - ncp.addEndpoint(1, ZigBeeDeviceType.HOME_GATEWAY.getKey(), defaultProfile.getKey(), - new int[] { 0 }, new int[] { 0 }); + ncp.addEndpoint(defaultLocalEndpointId, defaultDeviceId, defaultProfileId, + new int[] {}, new int[] {} + ); - if (setTxPower(txPower) != ZigBeeStatus.SUCCESS) { - logger.error("ZStack error setting transmit power"); - // return ZigBeeStatus.COMMUNICATION_ERROR; + final ZigBeeStatus responseCode = startNetwork(); + if (responseCode != ZigBeeStatus.SUCCESS) { + return responseCode; } - startNetwork(); - logger.debug("ZStack dongle startup: Done"); initialised = true; handleLinkStateChange(true); @@ -381,31 +398,6 @@ public ZigBeeStatus startup(boolean reinitialize) { return ZigBeeStatus.SUCCESS; } - /** - * This method schedules sending a status request frame on the interval specified by pollRate. If the frameHandler - * does not receive a response after a certain amount of retries, the state will be set to OFFLINE. - * The poll will not be sent if other commands have been sent to the dongle within the pollRate period so as to - * eliminate any unnecessary traffic with the dongle. - */ - private void scheduleNetworkStatePolling() { - if (pollingTimer != null) { - pollingTimer.cancel(true); - } - - pollingTimer = executorService.scheduleWithFixedDelay(new Runnable() { - @Override - public void run() { - // Don't poll the state if the network is down - // or we've sent a command to the dongle within the pollRate - if (!networkStateUp || (lastSendCommandTime + pollRate > System.currentTimeMillis())) { - return; - } - // Don't wait for the response. This is running in a single thread scheduler - protocolHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); - } - }, pollRate, pollRate, TimeUnit.MILLISECONDS); - } - @Override public void shutdown() { if (protocolHandler == null) { @@ -435,7 +427,7 @@ public void shutdown() { public ZstackNcp getZstackNcp() { return new ZstackNcp(protocolHandler); } - + @Override public IeeeAddress getIeeeAddress() { return ieeeAddress; @@ -446,70 +438,35 @@ public Integer getNwkAddress() { return nwkAddress; } - @Override - public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { - if (protocolHandler == null) { - return; - } - - // Remember the time to reduce unnecessary polling - lastSendCommandTime = System.currentTimeMillis(); - - ZstackAfDataRequestSreq request = new ZstackAfDataRequestSreq(); - request.setClusterID(apsFrame.getCluster()); - request.setDstAddr(apsFrame.getDestinationAddress()); - request.setDestEndpoint(apsFrame.getDestinationEndpoint()); - request.setSrcEndpoint(apsFrame.getSourceEndpoint()); - request.setTransID(msgTag); - request.setRadius(apsFrame.getRadius()); - request.setData(apsFrame.getPayload()); - - request.addOptions(AfDataOptions.AF_DISCV_ROUTE); - if (apsFrame.getAckRequest()) { - request.addOptions(AfDataOptions.AF_ACK_REQUEST); - } - if (apsFrame.getSecurityEnabled()) { - request.addOptions(AfDataOptions.AF_EN_SECURITY); - } - - // We need to correlate with the messageTag - executorService.execute(() -> { - ZstackAfDataRequestSrsp response = protocolHandler.sendTransaction(request, ZstackAfDataRequestSrsp.class); - - ZigBeeTransportProgressState sentHandlerState; - if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { - sentHandlerState = ZigBeeTransportProgressState.TX_NAK; - } else { - sentHandlerState = ZigBeeTransportProgressState.TX_ACK; - } - - zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); - }); - } - - @Override - public void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportReceive) { - this.zigbeeTransportReceive = zigbeeTransportReceive; - } - @Override public ZigBeeChannel getZigBeeChannel() { - return ZigBeeChannel.create(getZstackNcp().getNetworkInfo().getChannel()); + int chan = getZstackNcp().readChannel(); + return ZigBeeChannel.create(chan); } @Override public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { - if ((ZigBeeChannelMask.CHANNEL_MASK_2GHZ & channel.getMask()) == 0) { - logger.debug("Unable to set channel outside of 2.4GHz channels: {}", channel); - return ZigBeeStatus.INVALID_ARGUMENTS; + final int channelMask; + if (ZigBeeChannel.UNKNOWN == channel) { + // use scan over all masks + channelMask = ZigBeeChannelMask.CHANNEL_MASK_2GHZ; + } else { + channelMask = channel.getMask(); } - // networkParameters.setRadioChannel(channel.getChannel()); + + ZstackNcp ncp = getZstackNcp(); + + stackConfiguration.put(ZstackConfigId.ZCD_NV_CHANLIST, ncp.valueFromUInt32(channelMask)); + + // setup zigbee channel return ZigBeeStatus.SUCCESS; } @Override public int getZigBeePanId() { - return getZstackNcp().getNetworkInfo().getPanId(); + final int[] panIdValue = stackConfiguration.get(ZstackConfigId.ZCD_NV_PANID); + + return panIdValue == null ? -1 : (panIdValue[1] << 8) + (panIdValue[0]); } @Override @@ -518,13 +475,13 @@ public ZigBeeStatus setZigBeePanId(int panId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } - this.panId = panId; + stackConfiguration.put(ZstackConfigId.ZCD_NV_PANID, getZstackNcp().valueFromUInt16(panId)); return ZigBeeStatus.SUCCESS; } @Override public ExtendedPanId getZigBeeExtendedPanId() { - return new ExtendedPanId(getZstackNcp().getNetworkInfo().getExtendedPanId()); + return new ExtendedPanId(stackConfiguration.get(ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID)); } @Override @@ -533,7 +490,7 @@ public ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } - this.extendedPanId = extendedPanId; + stackConfiguration.put(ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, extendedPanId.getValue()); return ZigBeeStatus.SUCCESS; } @@ -542,43 +499,90 @@ public ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } - networkKey = key; + stackConfiguration.put(ZstackConfigId.ZCD_NV_PRECFGKEY, key.getValue()); return ZigBeeStatus.SUCCESS; } @Override public ZigBeeKey getZigBeeNetworkKey() { - return getZstackNcp().getNetworkKey(); + return new ZigBeeKey(stackConfiguration.get(ZstackConfigId.ZCD_NV_PRECFGKEY)); } @Override public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { - linkKey = key; ZstackNcp ncp = getZstackNcp(); - return ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, - key.getValue()) == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE; + if (DEFAULT_TCLK.equals(key)) { + // use default key + stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] {1}); + return ZigBeeStatus.SUCCESS; + } else { + ZstackResponseCode response = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, key.getValue()); + if (response == ZstackResponseCode.SUCCESS) { + linkKey = key; + return ZigBeeStatus.SUCCESS; + } else { + return ZigBeeStatus.FAILURE; + } + } } @Override public ZigBeeKey getTcLinkKey() { - return linkKey; + final int[] useDefault = stackConfiguration.get(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK); + if (useDefault != null && useDefault[0] != 0) { + return DEFAULT_TCLK; + } else if (linkKey != null) { + return linkKey; + } else { + return new ZigBeeKey(); + } } - /** - * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. - *

    - * Note that for ZB3, this should be set to true, however for backward compatability with HA1.2, this needs to be - * set to false or devices will not be able to join the network. - * - * @param required true if the TCLK exchange procedure is required. - * @return {@link ZigBeeStatus} - */ - public ZigBeeStatus requireKeyExchange(boolean required) { - ZstackNcp ncp = getZstackNcp(); + @Override + public String getVersionString() { + return versionString; + } + + @Override + public void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame) { + if (protocolHandler == null) { + return; + } + + // Remember the time to reduce unnecessary polling + lastSendCommandTime = System.currentTimeMillis(); + + ZstackAfDataRequestSreq request = new ZstackAfDataRequestSreq(); + request.setClusterID(apsFrame.getCluster()); + request.setDstAddr(apsFrame.getDestinationAddress()); + request.setDestEndpoint(apsFrame.getDestinationEndpoint()); + request.setSrcEndpoint(apsFrame.getSourceEndpoint()); + request.setTransID(msgTag); + request.setRadius(apsFrame.getRadius()); + request.setData(apsFrame.getPayload()); - return ncp.requireKeyExchange(required) == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS - : ZigBeeStatus.FAILURE; + request.addOptions(AfDataOptions.AF_DISCV_ROUTE); + if (apsFrame.getAckRequest()) { + request.addOptions(AfDataOptions.AF_ACK_REQUEST); + } + if (apsFrame.getSecurityEnabled()) { + request.addOptions(AfDataOptions.AF_EN_SECURITY); + } + + // We need to correlate with the messageTag + executorService.execute(() -> { + ZstackAfDataRequestSrsp response = protocolHandler.sendTransaction(request, ZstackAfDataRequestSrsp.class); + + ZigBeeTransportProgressState sentHandlerState; + if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS) { + sentHandlerState = ZigBeeTransportProgressState.TX_NAK; + } else { + sentHandlerState = ZigBeeTransportProgressState.TX_ACK; + } + + zigbeeTransportReceive.receiveCommandState(msgTag, sentHandlerState); + }); } @Override @@ -586,37 +590,29 @@ public void updateTransportConfig(TransportConfig configuration) { for (TransportConfigOption option : configuration.getOptions()) { try { switch (option) { - case CONCENTRATOR_CONFIG: - break; - - case INSTALL_KEY: - ZstackNcp ncp = getZstackNcp(); - ZigBeeKey nodeKey = (ZigBeeKey) configuration.getValue(option); - if (!nodeKey.hasAddress()) { - logger.debug("Attempt to set INSTALL_KEY without setting address"); - configuration.setResult(option, ZigBeeStatus.FAILURE); - break; - } - ZstackResponseCode result = ncp.addInstallCode(nodeKey.getAddress(), nodeKey); - - configuration.setResult(option, - result == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE); - break; - - case RADIO_TX_POWER: - txPower = (int) configuration.getValue(option); - configuration.setResult(option, setTxPower(txPower)); - break; - - case TRUST_CENTRE_LINK_KEY: - setTcLinkKey((ZigBeeKey) configuration.getValue(option)); - configuration.setResult(option, ZigBeeStatus.SUCCESS); - break; - - case TRUST_CENTRE_JOIN_MODE: - // configuration.setResult(option, - // setTcJoinMode((TrustCentreJoinMode) configuration.getValue(option))); - break; + // TODO: Configure an online network + // case INSTALL_KEY: + // ZstackNcp ncp = getZstackNcp(); + // ZigBeeKey nodeKey = (ZigBeeKey) configuration.getValue(option); + // if (!nodeKey.hasAddress()) { + // logger.debug("Attempt to set INSTALL_KEY without setting address"); + // configuration.setResult(option, ZigBeeStatus.FAILURE); + // break; + // } + // ZstackResponseCode result = ncp.addInstallCode(nodeKey.getAddress(), nodeKey); + + // configuration.setResult(option, + // result == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE); + // break; + + // case RADIO_TX_POWER: + // txPower = (int) configuration.getValue(option); + // configuration.setResult(option, setTxPower(txPower)); + // break; + + // case TRUST_CENTRE_LINK_KEY: + // configuration.setResult(option, setTcLinkKey((ZigBeeKey) configuration.getValue(option))); + // break; default: configuration.setResult(option, ZigBeeStatus.UNSUPPORTED); @@ -629,25 +625,29 @@ public void updateTransportConfig(TransportConfig configuration) { } } - @Override - public String getVersionString() { - return versionString; - } - - private ZigBeeStatus setTxPower(int txPower) { - ZstackNcp ncp = getZstackNcp(); - Integer powerResponse = ncp.setTxPower(txPower); - if (powerResponse == null) { - logger.debug("ZStack error setting transmit power"); - return ZigBeeStatus.COMMUNICATION_ERROR; - } - - if (txPower != powerResponse) { - logger.debug("ZStack error setting transmit power. Requested {}dBm, but set to {}dBm", txPower, - powerResponse); + /** + * This method schedules sending a status request frame on the interval specified by pollRate. If the frameHandler + * does not receive a response after a certain amount of retries, the state will be set to OFFLINE. + * The poll will not be sent if other commands have been sent to the dongle within the pollRate period so as to + * eliminate any unnecessary traffic with the dongle. + */ + private void scheduleNetworkStatePolling() { + if (pollingTimer != null) { + pollingTimer.cancel(true); } - return ZigBeeStatus.SUCCESS; + pollingTimer = executorService.scheduleWithFixedDelay(new Runnable() { + @Override + public void run() { + // Don't poll the state if the network is down + // or we've sent a command to the dongle within the pollRate + if (!networkStateUp || (lastSendCommandTime + pollRate > System.currentTimeMillis())) { + return; + } + // Don't wait for the response. This is running in a single thread scheduler + protocolHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); + } + }, pollRate, pollRate, TimeUnit.MILLISECONDS); } private void handleLinkStateChange(final boolean linkState) { @@ -664,11 +664,9 @@ private void handleLinkStateChange(final boolean linkState) { networkStateUp = linkState; if (linkState) { - executorService.execute(() -> { - ZstackNcp ncp = getZstackNcp(); - nwkAddress = ncp.getNwkAddress(); - zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); - }); + ZstackNcp ncp = getZstackNcp(); + nwkAddress = ncp.getNwkAddress(); + zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); } else { zigbeeTransportReceive.setTransportState(ZigBeeTransportState.OFFLINE); } @@ -685,25 +683,11 @@ private ZigBeeStatus startNetwork() { ZstackNcp ncp = getZstackNcp(); // setup listeners - protocolHandler.listener(ZstackZdoStateChangeIndAreq.class, response -> { - logger.debug("Zstack dongle state changed"); - switch (response.getState()) { - case DEV_ROUTER: - case DEV_ZB_COORD: - case DEV_END_DEVICE: - handleLinkStateChange(true); - break; - default: - handleLinkStateChange(false); - break; - } - }); - protocolHandler.listener(ZstackAfIncomingMsgAreq.class, response -> { logger.debug("Zstack incoming message"); ZstackAfIncomingMsgAreq incomingMsg = (ZstackAfIncomingMsgAreq) response; ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); - apsFrame.setProfile(defaultProfile.getKey()); + apsFrame.setProfile(defaultProfileId); apsFrame.setDestinationAddress(nwkAddress); apsFrame.setCluster(incomingMsg.getClusterId()); apsFrame.setDestinationEndpoint(incomingMsg.getDestEndpoint()); @@ -758,11 +742,43 @@ private ZigBeeStatus startNetwork() { zigbeeTransportReceive.receiveCommand(apsFrame); }); + final Future networkUpFuture = protocolHandler.waitForEvent(ZstackZdoStateChangeIndAreq.class, response -> { + switch (response.getState()) { + case DEV_ROUTER: + case DEV_END_DEVICE: + case DEV_ZB_COORD: + return true; + default: + return false; + } + }); + // Now start the NCP if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { return ZigBeeStatus.COMMUNICATION_ERROR; } + try { + networkUpFuture.get(); + } catch (InterruptedException | ExecutionException e) { + return ZigBeeStatus.FAILURE; + } + + // setup dongle state listener + protocolHandler.listener(ZstackZdoStateChangeIndAreq.class, response -> { + logger.debug("Zstack dongle state changed"); + switch (response.getState()) { + case DEV_ROUTER: + case DEV_ZB_COORD: + case DEV_END_DEVICE: + handleLinkStateChange(true); + break; + default: + handleLinkStateChange(false); + break; + } + }); + return ZigBeeStatus.SUCCESS; } From 32fb3caefe67ccd1e8f6d68c6cbb721d488b0731 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sat, 15 Oct 2022 08:28:11 +0200 Subject: [PATCH 22/33] New configuration system --- com.zsmartsystems.zigbee.autocode/.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../zstack/ZstackConsoleAbstractCommand.java | 13 +- .../ZstackConsoleNcpDiagnosticsCommand.java | 69 ---- .../zstack/ZstackConsoleNcpStateCommand.java | 2 +- com.zsmartsystems.zigbee.console/.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- .../.project | 4 +- com.zsmartsystems.zigbee.dongle.xbee/.project | 4 +- .../.project | 4 +- .../zstack/autocode/ClassGenerator.java | 4 +- .../zstack/autocode/CommandGenerator.java | 6 +- .../src/main/resources/zstack_protocol.xml | 60 +++ .../.project | 4 +- .../zigbee/dongle/zstack/ZstackNcp.java | 223 ++-------- .../zstack/api/sys/ZstackSysNvReadSreq.java | 106 +++++ .../zstack/api/sys/ZstackSysNvReadSrsp.java | 101 +++++ .../internal/ZstackProtocolHandler.java | 381 ++++++++++-------- .../internal/ZstackStackConfiguration.java | 5 +- .../zigbee/dongle/zstack/ZStackNcpTest.java | 2 +- com.zsmartsystems.zigbee.serial/.project | 4 +- com.zsmartsystems.zigbee/.project | 4 +- .../transport/TransportConfigOption.java | 2 +- 31 files changed, 575 insertions(+), 471 deletions(-) delete mode 100644 com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java diff --git a/com.zsmartsystems.zigbee.autocode/.project b/com.zsmartsystems.zigbee.autocode/.project index 7a38cc08e1..faafd57e9b 100644 --- a/com.zsmartsystems.zigbee.autocode/.project +++ b/com.zsmartsystems.zigbee.autocode/.project @@ -22,12 +22,12 @@ - 1659338237406 + 1664488665689 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.console.ember/.project b/com.zsmartsystems.zigbee.console.ember/.project index 266c4ad69d..eaca68a0a2 100644 --- a/com.zsmartsystems.zigbee.console.ember/.project +++ b/com.zsmartsystems.zigbee.console.ember/.project @@ -22,12 +22,12 @@ - 1659338237418 + 1664488665734 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.console.main/.project b/com.zsmartsystems.zigbee.console.main/.project index 0dd0e6471f..fd71f05f66 100644 --- a/com.zsmartsystems.zigbee.console.main/.project +++ b/com.zsmartsystems.zigbee.console.main/.project @@ -22,12 +22,12 @@ - 1659338237426 + 1664488665757 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.console.telegesis/.project b/com.zsmartsystems.zigbee.console.telegesis/.project index 6751d3e2b0..38ecd34122 100644 --- a/com.zsmartsystems.zigbee.console.telegesis/.project +++ b/com.zsmartsystems.zigbee.console.telegesis/.project @@ -22,12 +22,12 @@ - 1659338237433 + 1664488665778 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.console.zstack/.project b/com.zsmartsystems.zigbee.console.zstack/.project index 8204721de1..6b067e034d 100644 --- a/com.zsmartsystems.zigbee.console.zstack/.project +++ b/com.zsmartsystems.zigbee.console.zstack/.project @@ -22,12 +22,12 @@ - 1659338237440 + 1664488665801 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java index 0003041930..a512104db2 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java @@ -23,16 +23,15 @@ public abstract class ZstackConsoleAbstractCommand implements ZigBeeConsoleCommand { private static String CFG_UNSUPPORTED = "Not Supported"; - protected ZstackNcp getZstackNcp(ZigBeeNetworkManager networkManager) - throws IllegalArgumentException, IllegalStateException { + protected ZstackNcp getZstackNcp(ZigBeeNetworkManager networkManager) throws IllegalArgumentException, IllegalStateException { + return getDongle(networkManager).getZstackNcp(); + } + + protected ZigBeeDongleZstack getDongle(ZigBeeNetworkManager networkManager) { if (!(networkManager.getZigBeeTransport() instanceof ZigBeeDongleZstack)) { throw new IllegalArgumentException("Dongle is not an ZStack NCP."); } - ZigBeeDongleZstack dongle = (ZigBeeDongleZstack) networkManager.getZigBeeTransport(); - if (dongle == null) { - throw new IllegalStateException("Dongle is not an ZStack NCP."); - } - return dongle.getZstackNcp(); + return (ZigBeeDongleZstack) networkManager.getZigBeeTransport(); } protected String hex2Boolean(int[] bytes) { diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java deleted file mode 100644 index c1771c7d90..0000000000 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpDiagnosticsCommand.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.console.zstack; - -import java.io.PrintStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import com.zsmartsystems.zigbee.ZigBeeNetworkManager; -import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackDiagnosticAttribute; - -/** - * - * @author Chris Jackson - * - */ -public class ZstackConsoleNcpDiagnosticsCommand extends ZstackConsoleAbstractCommand { - @Override - public String getCommand() { - return "ncpdiags"; - } - - @Override - public String getDescription() { - return "Gets the NCP diagnostics counters."; - } - - @Override - public String getSyntax() { - return ""; - } - - @Override - public String getHelp() { - return ""; - } - - @Override - public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) - throws IllegalArgumentException { - ZstackNcp ncp = getZstackNcp(networkManager); - Map diagnostics = new HashMap<>(); - - for (ZstackDiagnosticAttribute attribute : ZstackDiagnosticAttribute.values()) { - if (attribute == ZstackDiagnosticAttribute.UNKNOWN) { - continue; - } - - Long value = ncp.getDiagnosticsAttribute(attribute); - - if (value == null) { - continue; - } - diagnostics.put(attribute, value); - } - - for (Entry diagnosticsEntry : diagnostics.entrySet()) { - out.println(String.format("%-40s %d", diagnosticsEntry.getKey(), diagnosticsEntry.getValue())); - } - } - -} diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index bed0251a8b..a8ae244340 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -56,7 +56,7 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - ZstackSysVersionSrsp ncpVersion = ncp.getVersion(); + ZstackSysVersionSrsp ncpVersion = getDongle(networkManager).getZstackNcp().getVersion(); Set ncpCapabilities = ncp.pingNcp(); int[] userDesc = ncp.readConfiguration(ZstackConfigId.ZCD_NV_USERDESC); diff --git a/com.zsmartsystems.zigbee.console/.project b/com.zsmartsystems.zigbee.console/.project index 60f6f90e66..d299dd702c 100644 --- a/com.zsmartsystems.zigbee.console/.project +++ b/com.zsmartsystems.zigbee.console/.project @@ -22,12 +22,12 @@ - 1659338237413 + 1664488665712 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/.project b/com.zsmartsystems.zigbee.dongle.cc2531/.project index bf3309027d..6d018f435f 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/.project +++ b/com.zsmartsystems.zigbee.dongle.cc2531/.project @@ -22,12 +22,12 @@ - 1659338237446 + 1664488665826 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.conbee/.project b/com.zsmartsystems.zigbee.dongle.conbee/.project index 72f3f6d3c1..bf208d0b2e 100644 --- a/com.zsmartsystems.zigbee.dongle.conbee/.project +++ b/com.zsmartsystems.zigbee.dongle.conbee/.project @@ -22,12 +22,12 @@ - 1659338237452 + 1664488665849 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/.project b/com.zsmartsystems.zigbee.dongle.ember.autocode/.project index 8ce2c7d771..60bd6f3a5f 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/.project @@ -22,12 +22,12 @@ - 1659338237467 + 1664488665898 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.ember/.project b/com.zsmartsystems.zigbee.dongle.ember/.project index 1fd8bf8cad..3cb6670db2 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/.project +++ b/com.zsmartsystems.zigbee.dongle.ember/.project @@ -22,12 +22,12 @@ - 1659338237460 + 1664488665874 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project index cdacbcd20a..adb17dd557 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.telegesis.autocode/.project @@ -22,12 +22,12 @@ - 1659338237480 + 1664488665945 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/.project b/com.zsmartsystems.zigbee.dongle.telegesis/.project index 4e169a714e..4bcea038fd 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/.project +++ b/com.zsmartsystems.zigbee.dongle.telegesis/.project @@ -22,12 +22,12 @@ - 1659338237474 + 1664488665922 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project b/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project index e824b875eb..91dc8e23d0 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.xbee.autocode/.project @@ -22,12 +22,12 @@ - 1659338237497 + 1664488665996 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.xbee/.project b/com.zsmartsystems.zigbee.dongle.xbee/.project index 4e096af033..fd3bdc077f 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee/.project +++ b/com.zsmartsystems.zigbee.dongle.xbee/.project @@ -22,12 +22,12 @@ - 1659338237490 + 1664488665972 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project index b4dba4c0d6..8729969a38 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/.project @@ -22,12 +22,12 @@ - 1659338237511 + 1664488666046 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index 2be4dcfcc1..c089b55fdf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -193,9 +193,7 @@ protected void outputWithLinebreak(PrintWriter out, String indent, String line) len += word.length(); } - if (len != 0) { - out.println(); - } + out.println(); } protected String formatParameterString(Parameter parameter) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 0c7263e337..dff261a28a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -7,6 +7,8 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.autocode; +import static java.util.Objects.requireNonNull; + import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; @@ -102,7 +104,7 @@ private void createCommandClass(String className, Command command, List + + SYS_NV_READ + SYS + 0x33 + This command is used to read a single memory item from the target non-volatile memory. The command returns + the item requested + + SYNC + + + uint8 + sysId + The system id (1 for zstack) + + + uint16 + itemId + The sub id (0 for legacy) + + + uint16 + subId + The Id of the NV item. + + + uint16 + offset + Number of bytes offset from the beginning or the NV value. + + + uint8 + length + Number of bytes to read + + + + + ZstackResponseCode + status + Status is either Success (0) or Failure (1). + + + uint8 + length + value + Length of the NV value. + + + uint8[] + value + value of the NV item. + + + + @@ -1843,6 +1898,11 @@ 0x0004 + + ZCD_NV_NIB + 0x0021 + This item holds all kinds of network information. + ZCD_NV_POLL_RATE_OLD16 0x0035 diff --git a/com.zsmartsystems.zigbee.dongle.zstack/.project b/com.zsmartsystems.zigbee.dongle.zstack/.project index 2ce6b16a85..e48e8e19fa 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/.project +++ b/com.zsmartsystems.zigbee.dongle.zstack/.project @@ -22,12 +22,12 @@ - 1659338237505 + 1664488666021 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index b929a07f29..70e852cd06 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -14,7 +14,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.zsmartsystems.zigbee.ExtendedPanId; import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; @@ -31,8 +30,9 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackInstallCodeFormat; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackDiagnosticAttribute; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSreq; @@ -45,8 +45,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; @@ -62,7 +60,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.security.ZigBeeKey; -import com.zsmartsystems.zigbee.transport.DeviceType; /** * This class provides utility methods for accessing the ZStack NCP and returning specific data for use in the @@ -150,16 +147,13 @@ public Set pingNcp() { * @return the {@link ZstackSysVersionSrsp} */ public ZstackSysVersionSrsp getVersion() { - ZstackSysVersionSrsp response = protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); - if (response == null) { - logger.debug("No response from Version command"); - return null; - } - logger.debug(response.toString()); - - return response; + return protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); } + /** + * This command reads the network info from the device + * @return the {@link ZstackZdoExtNwkInfoSrsp} + */ public ZstackZdoExtNwkInfoSrsp getNetworkInfo() { return protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); } @@ -170,14 +164,7 @@ public ZstackZdoExtNwkInfoSrsp getNetworkInfo() { * @return the {@link ZstackUtilGetDeviceInfoSrsp} */ public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { - ZstackUtilGetDeviceInfoSrsp response = protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); - if (response == null) { - logger.debug("No response from DeviceInfo command"); - return null; - } - logger.debug(response.toString()); - - return response; + return protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); } /** @@ -186,28 +173,7 @@ public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { * @return the {@link ZstackUtilGetDeviceInfoSrsp} */ public ZstackUtilGetNvInfoSrsp getNvDeviceInfo() { - ZstackUtilGetNvInfoSreq request = new ZstackUtilGetNvInfoSreq(); - ZstackUtilGetNvInfoSrsp response = protocolHandler.sendTransaction(request, ZstackUtilGetNvInfoSrsp.class); - if (response == null) { - logger.debug("No response from NvInfo command"); - return null; - } - logger.debug(response.toString()); - - return response; - } - - /** - * Gets the {@link IeeeAddress} from the NCP - * - * @return the {@link IeeeAddress} local address of the NCP - */ - public IeeeAddress getIeeeAddress() { - ZstackUtilGetDeviceInfoSrsp info = getDeviceInfo(); - if (info == null) { - return null; - } - return info.getIeeeAddress(); + return protocolHandler.sendTransaction(new ZstackUtilGetNvInfoSreq(), ZstackUtilGetNvInfoSrsp.class); } /** @@ -217,29 +183,8 @@ public IeeeAddress getIeeeAddress() { */ public int getNwkAddress() { ZstackUtilGetDeviceInfoSrsp info = getDeviceInfo(); - if (info == null) { - return -1; - } - return info.getShortAddr(); - } - /** - * Gets a diagnostics counter from the NCP - * - * @param attributeId {@ link ZstackDiagnosticAttribute} to request - * @return the 32 bit counter, or null on error - */ - public Long getDiagnosticsAttribute(ZstackDiagnosticAttribute attributeId) { - ZstackSysZdiagsGetStatsSreq request = new ZstackSysZdiagsGetStatsSreq(); - request.setAttributeID(attributeId); - ZstackSysZdiagsGetStatsSrsp response = protocolHandler.sendTransaction(request, ZstackSysZdiagsGetStatsSrsp.class); - if (response == null) { - logger.debug("No response from GetDiagnostics command"); - return null; - } - logger.debug(response.toString()); - - return (long) response.getAttributeValue(); + return info == null ? -1 : info.getShortAddr(); } /** @@ -318,61 +263,17 @@ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] valu return response.getStatus(); } - /** - * Sets the ZStack device type - * - * @param deviceType the {@link DeviceType} to use - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setDeviceType(DeviceType deviceType) { - int value; - switch (deviceType) { - case COORDINATOR: - value = 0; - break; - case ROUTER: - value = 1; - break; - default: - logger.debug("Unknown device type {}", deviceType); - return ZstackResponseCode.FAILURE; - } - return writeConfiguration(ZstackConfigId.ZCD_NV_LOGICAL_TYPE, valueFromUInt8(value)); - } - - /** - * Sets the PAN ID - * - * @param panId the 16 bit PAN ID - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setPanId(int panId) { - return writeConfiguration(ZstackConfigId.ZCD_NV_PANID, valueFromUInt16(panId)); - } - - /** - * Sets the extended PAN ID - * - * @param panId the {@link ExtendedPanId} extended PAN ID - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setExtendedPanId(ExtendedPanId epanId) { - return writeConfiguration(ZstackConfigId.ZCD_NV_EXTPANID, epanId.getValue()); - } - - /** - * Sets the network key, and enables its use. - * - * @param key the {@link ZigBeeKey} to use for the network key - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setNetworkKey(ZigBeeKey key) { - ZstackResponseCode responseCode = writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY, key.getValue()); - if (responseCode != ZstackResponseCode.SUCCESS) { - return responseCode; + public int readChannel() { + ZstackSysNvReadSreq request = new ZstackSysNvReadSreq(); + request.setId(1, 0, 0x21); + request.setOffset(24); + request.setLength(1); + ZstackSysNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysNvReadSrsp.class); + if (response == null || response.getValue() == null || response.getValue().length == 0) { + return -1; + } else { + return response.getValue()[0]; } - // Enable the network key - return writeConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, valueFromUInt8(1)); } /** @@ -389,16 +290,6 @@ public ZigBeeKey getNetworkKey() { return new ZigBeeKey(response); } - /** - * Enables network security - * - * @param enableSecurity true to enable network security - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setNetworkSecurity(boolean enableSecurity) { - return writeConfiguration(ZstackConfigId.ZCD_NV_SECURITY_MODE, valueFromBoolean(enableSecurity)); - } - /** * Sets the transmit power to be used in the NCP * @@ -409,12 +300,8 @@ public Integer setTxPower(int txPower) { ZstackSysSetTxPowerSreq request = new ZstackSysSetTxPowerSreq(); request.setTxPower(txPower); ZstackSysSetTxPowerSrsp response = protocolHandler.sendTransaction(request, ZstackSysSetTxPowerSrsp.class); - if (response == null) { - logger.debug("No response from SetTxPower command"); - return null; - } - logger.debug(response.toString()); - return response.getTxPower(); + + return response == null ? null : response.getTxPower(); } /** @@ -444,12 +331,8 @@ public ZstackResponseCode startupApplication() { ZstackZdoStartupFromAppSreq request = new ZstackZdoStartupFromAppSreq(); request.setStartDelay(100); ZstackZdoStartupFromAppSrsp response = protocolHandler.sendTransaction(request, ZstackZdoStartupFromAppSrsp.class); - if (response == null) { - logger.debug("No response from startupApplication command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -464,12 +347,8 @@ public ZstackResponseCode requireKeyExchange(boolean required) { ZstackAppCnfBdbSetTcRequireKeyExchangeSreq request = new ZstackAppCnfBdbSetTcRequireKeyExchangeSreq(); request.setTrustCenterRequireKeyExchange(required); ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); - if (response == null) { - logger.debug("No response from requireKeyExchange command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -486,12 +365,8 @@ public ZstackResponseCode setCentralisedKey(ZstackCentralizedLinkKeyMode mode, i request.setCentralizedLinkKeyMode(mode); request.setInstallCode(installCode); ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); - if (response == null) { - logger.debug("No response from setCentralisedKey command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -506,12 +381,8 @@ public ZstackResponseCode allowRejoin(boolean allow) { ZstackAppCnfSetAllowrejoinTcPolicySreq request = new ZstackAppCnfSetAllowrejoinTcPolicySreq(); request.setAllowRejoin(allow); ZstackAppCnfSetAllowrejoinTcPolicySrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); - if (response == null) { - logger.debug("No response from allowRejoin command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -523,12 +394,8 @@ public ZstackResponseCode zdoRegisterCallback(int clusterId) { ZstackZdoMsgCbRegisterSreq request = new ZstackZdoMsgCbRegisterSreq(); request.setClusterId(clusterId); ZstackZdoMsgCbRegisterSrsp response = protocolHandler.sendTransaction(request, ZstackZdoMsgCbRegisterSrsp.class); - if (response == null) { - logger.debug("No response from RegisterZdoCallback command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -552,12 +419,8 @@ public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileI request.setAppDevVer(0); ZstackAfRegisterSrsp response = protocolHandler.sendTransaction(request, ZstackAfRegisterSrsp.class); - if (response == null) { - logger.debug("No response from RegisterEndpoint command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } /** @@ -574,23 +437,23 @@ public ZstackResponseCode addInstallCode(IeeeAddress ieeeAddress, ZigBeeKey key) request.setInstallCode(key); ZstackAppCnfBdbAddInstallcodeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbAddInstallcodeSrsp.class); - if (response == null) { - logger.debug("No response from AddInstallCode command"); - return ZstackResponseCode.FAILURE; - } - logger.debug(response.toString()); - return response.getStatus(); + + return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } - private int[] valueFromBoolean(boolean value) { + public int[] valueFromBoolean(boolean value) { return new int[] { value ? 1 : 0 }; } - private int[] valueFromUInt8(int value) { + public int[] valueFromUInt8(int value) { return new int[] { value }; } - private int[] valueFromUInt16(int value) { + public int[] valueFromUInt16(int value) { return new int[] { value & 0xFF, (value >> 8) & 0xFF }; } + + public int[] valueFromUInt32(int value) { + return new int[] { value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF }; + } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java new file mode 100644 index 0000000000..31a53bd499 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysNvReadSreq extends ZstackFrameRequest { + + /** + * The Id of the NV item. + */ + private int systemId; + + private int itemId; + + private int subId; + + private int offset; + + private int length; + + /** + * Request constructor + */ + public ZstackSysNvReadSreq() { + synchronousCommand = true; + } + + /** + * The Id of the NV item. + * + * @param id the id to set as {@link ZstackConfigId} + */ + public void setId(int systemId, int itemId, int subId) { + this.systemId = systemId; + this.itemId = itemId; + this.subId = subId; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the Offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + public void setLength(int length) { + this.length = length; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x33)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x33); + + // Serialize the fields + serializer.serializeUInt8(systemId); + serializer.serializeUInt16(itemId); + serializer.serializeUInt16(subId); + serializer.serializeUInt16(offset); + serializer.serializeUInt8(length); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(76); + builder.append("ZstackSysOsalNvReadSreq [id="); + builder.append(", offset="); + builder.append(offset); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java new file mode 100644 index 0000000000..fb61f568bb --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSysNvReadSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Value of the NV item. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackSysNvReadSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + int len = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(len); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Value of the NV item. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackSysOsalNvReadSrsp [status="); + builder.append(status); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index 958700c12f..7a20b12e7a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -7,6 +7,8 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.internal; +import static java.util.Objects.requireNonNull; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -18,6 +20,7 @@ import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; +import java.util.function.Predicate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -137,79 +140,6 @@ public void start(final ZigBeePort port) { }); } - private int[] getPacket() throws IOException { - int length = 0; - int bytesRead = 0; - int[] frameData = null; - - ZstackState state = ZstackState.SOF; - - while (!closeHandler) { - int val = port.read(1000); - logger.trace("ZSTACK RX Byte: {} [{}/{}]", String.format("%02X", val), bytesRead, length); - if (val == -1) { - continue; - } - - switch (state) { - case SOF: - if (val == ZSTACK_SOF) { - state = ZstackState.LENGTH; - } - break; - case LENGTH: - if (val > ZSTACK_MAX_LENGTH) { - logger.debug("ZSTACK Length greater than allowed: {}", val); - state = ZstackState.SOF; - continue; - } - length = val + 2; - frameData = new int[length]; - state = ZstackState.DATA; - bytesRead = 0; - break; - case DATA: - frameData[bytesRead++] = val; - if (bytesRead >= length) { - state = ZstackState.FCS; - } - break; - case FCS: - int checksum = getChecksum(frameData); - if (val != checksum) { - logger.debug("ZSTACK Checksum error: {} <> {}", val, checksum); - state = ZstackState.SOF; - continue; - } - return frameData; - default: - logger.debug("ZSTACK Unknown decoder state: {}", state); - break; - } - } - - return null; - } - - private int getChecksum(int[] data) { - int checksum = (data.length - 2); - for (int value : data) { - checksum ^= value; - } - return checksum & 0xFF; - } - - /** - * Checks the frame type to see if it is a synchronous request or response. - * - * @param cmd0 the first command byte of the request or response frame - * @return true if this is a synchronous frame - */ - private boolean isSynchronous(int cmd0) { - int frameType = cmd0 & 0xE0; - return (frameType == 0x20 || frameType == 0x60); - } - public void setClosing() { closeHandler = true; executor.shutdown(); @@ -246,11 +176,83 @@ public void queueFrame(ZstackFrameRequest request) { } /** - * Notify any transaction listeners when we receive a response. + * Wait for some specific event + * @param The type of response to wait for + * @param requiredResponse The class of response to wait for + * @param predicate The predicate to determine if the event was this + * @return A Future that is completed upon receiving the specific event requested + */ + public Future waitForEvent(final Class requiredResponse, final Predicate predicate) { + if (closeHandler) { + return null; + } + + final TransactionWaiter transactionWaiter = new TransactionWaiter<>(null, 100000, requiredResponse, predicate); + + // Register a listener + addTransactionListener(transactionWaiter); + + return executor.submit(transactionWaiter); + } + + /** + * Register a listener for certain classes. + * @param The type which this listener listens to + * @param requiredResponse The class of events the listener responds to + * @param delivery The callback method which is fed the events of type {@link ZstackFrameReponse} + * @return a registered listener. To unregister execute {@link ZstackListener#transactionComplete()}. + */ + public ZstackListener listener(final Class requiredResponse, final Consumer delivery) { + if (closeHandler) { + return null; + } + + final ZstackListener listener = new ZstackListener() { + @Override + public void transactionEvent(ZstackFrameResponse response) { + if (requiredResponse.isInstance(response)) { + executor.execute(() -> delivery.accept(requiredResponse.cast(response))); + } + } + + @Override + public void transactionComplete() { + removeTransactionListener(this); + } + }; + + addTransactionListener(listener); + + return listener; + } + + /** + * Sends a ZStack request to the NCP and waits for the response. The response is correlated with the request and the + * returned {@link ZstackTransaction} contains the request and response data. * - * @param response the response {@link ZstackFrameResponse} received - * @return true if the response was processed + * @param request The message to send {@link ZstackFrameRequest} + * @param responseType The expected returntype {@link ZstackFrameResponse} + * @return response {@link ZstackCommand} */ + public RES sendTransaction(REQ request, Class responseType) { + logger.debug("QUEUE ZSTACK: {}", request); + + Future futureResponse = sendZstackRequestAsync(request, responseType); + if (futureResponse == null) { + logger.debug("ZSTACK: Error sending transaction: Future is null"); + return null; + } + + try { + return futureResponse.get(); + } catch (InterruptedException | ExecutionException e) { + futureResponse.cancel(true); + logger.debug("ZSTACK interrupted in sendTransaction for {}", request, e); + } + + return null; + } + private void notifyResponseReceived(final ZstackFrameResponse response) { synchronized (transactionListeners) { for (ZstackListener listener : transactionListeners) { @@ -260,6 +262,7 @@ private void notifyResponseReceived(final ZstackFrameResponse response) { } private void addTransactionListener(ZstackListener listener) { + logger.debug("Adding Zstack Transaction listener"); synchronized (transactionListeners) { if (transactionListeners.contains(listener)) { return; @@ -319,130 +322,168 @@ private synchronized void sendFrame(ZstackFrameRequest request) { logger.debug(builder.toString()); } - public void sendRaw(int rawByte) { - logger.trace("ZSTACK TX Byte: {}", String.format("%02X", rawByte)); - port.write(rawByte); - } - private Future sendZstackRequestAsync(final REQ request, final Class responseType) { if (closeHandler) { logger.debug("ZSTACK: Handler is closed"); return null; } - class TransactionWaiter implements Callable, ZstackListener { - private RES response = null; + final TransactionWaiter waiter = new TransactionWaiter<>(request, TIMEOUT, responseType, null); - @Override - public RES call() { - // Register a listener - addTransactionListener(this); + addTransactionListener(waiter); - // Send the transaction - queueFrame(request); + return executor.submit(waiter); + } - // Wait for the transaction to complete - synchronized (this) { - try { - wait(TIMEOUT); - } catch (InterruptedException e) { - } finally { - removeTransactionListener(this); - } - } + private String frameToString(int[] inputBuffer) { + if (inputBuffer == null) { + return ""; + } + StringBuilder result = new StringBuilder(); + for (int data : inputBuffer) { + result.append(String.format("%02X ", data)); + } + return result.toString(); + } - return response; - } + /** + * Checks the frame type to see if it is a synchronous request or response. + * + * @param cmd0 the first command byte of the request or response frame + * @return true if this is a synchronous frame + */ + private boolean isSynchronous(int cmd0) { + int frameType = cmd0 & 0xE0; + return (frameType == 0x20 || frameType == 0x60); + } - @Override - public void transactionEvent(ZstackFrameResponse response) { - // Check if this response completes our transaction - if (responseType.isInstance(response)) { - this.response = responseType.cast(response); - } else if (ZstackRpcSreqErrorSrsp.class.isInstance(response) && request.matchSreqError((ZstackRpcSreqErrorSrsp) response)) { - } else { - return; - } + private int[] getPacket() throws IOException { + int length = 0; + int bytesRead = 0; + int[] frameData = null; + + ZstackState state = ZstackState.SOF; - transactionComplete(); + while (!closeHandler) { + int val = port.read(1000); + logger.trace("ZSTACK RX Byte: {} [{}/{}]", String.format("%02X", val), bytesRead, length); + if (val == -1) { + continue; } - @Override - public void transactionComplete() { - synchronized (this) { - notify(); - } + switch (state) { + case SOF: + if (val == ZSTACK_SOF) { + state = ZstackState.LENGTH; + } + break; + case LENGTH: + if (val > ZSTACK_MAX_LENGTH) { + logger.debug("ZSTACK Length greater than allowed: {}", val); + state = ZstackState.SOF; + continue; + } + length = val + 2; + frameData = new int[length]; + state = ZstackState.DATA; + bytesRead = 0; + break; + case DATA: + requireNonNull(frameData, "FrameData should have been set earlier on")[bytesRead++] = val; + if (bytesRead >= length) { + state = ZstackState.FCS; + } + break; + case FCS: + int checksum = getChecksum(frameData); + if (val != checksum) { + logger.debug("ZSTACK Checksum error: {} <> {}", val, checksum); + state = ZstackState.SOF; + continue; + } + return frameData; + default: + logger.debug("ZSTACK Unknown decoder state: {}", state); + break; } } - Callable worker = new TransactionWaiter(); - return executor.submit(worker); + return null; } - public ZstackListener listener(final Class requiredResponse, final Consumer delivery) { - if (closeHandler) { - return null; + private int getChecksum(int[] data) { + int checksum = (data.length - 2); + for (int value : data) { + checksum ^= value; } + return checksum & 0xFF; + } - final ZstackListener listener = new ZstackListener() { - @Override - public void transactionEvent(ZstackFrameResponse response) { - if (requiredResponse.isInstance(response)) { - executor.execute(() -> delivery.accept(requiredResponse.cast(response))); - } - } - - @Override - public void transactionComplete() { - removeTransactionListener(this); - } - }; - - addTransactionListener(listener); + public interface ZstackListener { + void transactionEvent(ZstackFrameResponse response); - return listener; + void transactionComplete(); } - /** - * Sends a ZStack request to the NCP and waits for the response. The response is correlated with the request and the - * returned {@link ZstackTransaction} contains the request and response data. - * - * @param transaction Request {@link ZstackTransaction} - * @return response {@link ZstackCommand} - */ - public RES sendTransaction(REQ request, Class responseType) { - logger.debug("QUEUE ZSTACK: {}", request); - - Future futureResponse = sendZstackRequestAsync(request, responseType); - if (futureResponse == null) { - logger.debug("ZSTACK: Error sending transaction: Future is null"); - return null; + private class TransactionWaiter implements Callable, ZstackListener { + private final ZstackFrameRequest request; + private final Class requiredResponse; + private final Predicate responsePredicate; + private final int timeout; + private RES response = null; + + private TransactionWaiter(final ZstackFrameRequest request, final int timeout, final Class requiredResponse, final Predicate responsePredicate) { + this.request = request; + this.timeout = timeout; + this.requiredResponse = requiredResponse; + this.responsePredicate = responsePredicate; } - try { - return futureResponse.get(); - } catch (InterruptedException | ExecutionException e) { - futureResponse.cancel(true); - logger.debug("ZSTACK interrupted in sendTransaction for {}", request, e); - } + @Override + public RES call() { + // Send the transaction + if (request != null) { + queueFrame(request); + } - return null; - } + // Wait for the transaction to complete + synchronized (this) { + try { + wait(timeout); + } catch (InterruptedException e) { + } finally { + removeTransactionListener(this); + } + } - private String frameToString(int[] inputBuffer) { - if (inputBuffer == null) { - return ""; + return response; } - StringBuilder result = new StringBuilder(); - for (int data : inputBuffer) { - result.append(String.format("%02X ", data)); - } - return result.toString(); - } - interface ZstackListener { - void transactionEvent(ZstackFrameResponse response); + @Override + public void transactionEvent(ZstackFrameResponse response) { + // Check if this response completes our transaction + if (requiredResponse.isInstance(response)) { + if (responsePredicate == null) { + this.response = requiredResponse.cast(response); + } else if (responsePredicate.test(requiredResponse.cast(response))) { + this.response = requiredResponse.cast(response); + } else { + return; + } + } else if (response instanceof ZstackRpcSreqErrorSrsp && request != null && request.matchSreqError((ZstackRpcSreqErrorSrsp) response)) { + // no response. Error code ? + } else { + return; + } - void transactionComplete(); + transactionComplete(); + } + + @Override + public void transactionComplete() { + synchronized (this) { + notify(); + } + } } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java index aec816fc1a..973e30eb9a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackStackConfiguration.java @@ -68,7 +68,10 @@ public Map getConfiguration(Set configura Map response = new HashMap<>(); for (ZstackConfigId configId : configuration) { - response.put(configId, ncp.readConfiguration(configId)); + int[] value = ncp.readConfiguration(configId); + if (value != null) { + response.put(configId, value); + } } return response; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java index 5f87d7a345..300d278a92 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -116,7 +116,7 @@ public void getDeviceInfo() { assertTrue(request instanceof ZstackUtilGetDeviceInfoSreq); assertEquals(0x1234, ncp.getNwkAddress()); - assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getIeeeAddress()); + assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getDeviceInfo().getIeeeAddress()); } @Test diff --git a/com.zsmartsystems.zigbee.serial/.project b/com.zsmartsystems.zigbee.serial/.project index b11f0ee946..9f4180e23b 100644 --- a/com.zsmartsystems.zigbee.serial/.project +++ b/com.zsmartsystems.zigbee.serial/.project @@ -22,12 +22,12 @@ - 1659338237516 + 1664488666099 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee/.project b/com.zsmartsystems.zigbee/.project index 09b4641ddb..a4bba85651 100644 --- a/com.zsmartsystems.zigbee/.project +++ b/com.zsmartsystems.zigbee/.project @@ -22,12 +22,12 @@ - 1659338237398 + 1664488665666 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/TransportConfigOption.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/TransportConfigOption.java index f3d10e62dc..4b6591e0ea 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/TransportConfigOption.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/TransportConfigOption.java @@ -31,7 +31,7 @@ public enum TransportConfigOption { /** * Defines the concentrator type. *

    - * Value must be one of {@link ConcentratorConfigs}. + * Value must be one of {@link ConcentratorConfig}. */ CONCENTRATOR_CONFIG, From f487d9888f2f49ec7302550670bd0c5f1ef78f2d Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Thu, 27 Oct 2022 21:55:48 +0200 Subject: [PATCH 23/33] Regenerated commands for Zstack --- .../zstack/ZstackConsoleNcpStateCommand.java | 5 +- .../zstack/autocode/ClassGenerator.java | 7 +- .../zstack/autocode/CommandGenerator.java | 3 + .../zstack/autocode/ZstackAutocoder.java | 4 +- .../src/main/resources/zstack_protocol.xml | 35 ++- .../dongle/zstack/ZigBeeDongleZstack.java | 218 ++++++++++-------- .../zigbee/dongle/zstack/ZstackNcp.java | 39 ++-- .../dongle/zstack/api/ZstackFrameFactory.java | 9 +- .../dongle/zstack/api/ZstackResponseCode.java | 2 +- .../dongle/zstack/api/af/AfDataOptions.java | 2 +- .../api/af/ZstackAfDataConfirmAreq.java | 4 +- .../zstack/api/af/ZstackAfRegisterSreq.java | 2 +- .../zstack/api/af/ZstackAfRegisterSrsp.java | 2 +- .../appcnf/ZstackAppCnfBdbSetChannelSreq.java | 103 +++++++++ .../appcnf/ZstackAppCnfBdbSetChannelSrsp.java | 68 ++++++ .../sapi/ZstackZbReadConfigurationSreq.java | 2 +- .../sapi/ZstackZbReadConfigurationSrsp.java | 2 +- .../sapi/ZstackZbWriteConfigurationSreq.java | 2 +- .../api/sbl/ZstackSbHandshakeCmdSrsp.java | 6 +- .../dongle/zstack/api/sys/ZstackConfigId.java | 15 +- .../api/sys/ZstackSysGetExtAddrSrsp.java | 6 +- .../zstack/api/sys/ZstackSysNvReadSreq.java | 101 ++++++-- .../zstack/api/sys/ZstackSysNvReadSrsp.java | 21 +- .../api/sys/ZstackSysOsalNvReadSreq.java | 2 +- .../api/sys/ZstackSysSetExtAddrSreq.java | 6 +- .../api/sys/ZstackSysSetTxPowerSreq.java | 2 +- .../api/sys/ZstackSysSetTxPowerSrsp.java | 29 +-- .../sys/ZstackSysZdiagsClearStatsSreq.java | 6 +- .../api/zdo/ZstackZdoExtNwkInfoSreq.java | 10 +- .../api/zdo/ZstackZdoExtNwkInfoSrsp.java | 155 ++++++++++--- .../api/zdo/ZstackZdoGetLinkKeySrsp.java | 6 +- .../api/zdo/ZstackZdoMsgCbIncomingAreq.java | 6 +- .../api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 6 +- .../api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 6 +- .../api/zdo/ZstackZdoSetLinkKeySrsp.java | 6 +- .../internal/ZstackProtocolHandler.java | 65 ++---- .../serializer/ZstackDeserializer.java | 5 + 37 files changed, 691 insertions(+), 277 deletions(-) create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java create mode 100644 com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index a8ae244340..ad292b519f 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -10,6 +10,7 @@ import java.io.PrintStream; import java.util.Set; +import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; @@ -58,6 +59,7 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); ZstackSysVersionSrsp ncpVersion = getDongle(networkManager).getZstackNcp().getVersion(); Set ncpCapabilities = ncp.pingNcp(); + int currentChannel = ncp.readChannel(); int[] userDesc = ncp.readConfiguration(ZstackConfigId.ZCD_NV_USERDESC); int[] bdbDeviceOnNwk = ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); @@ -112,7 +114,8 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { } else { out.println("NCP API Capabilities : " + ncpCapabilities); } + + out.println("Current logical channel : " + ZigBeeChannel.create(currentChannel)); out.println("User Description : " + hex2String(userDesc)); } - } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index c089b55fdf..dd10a4f263 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -14,6 +14,7 @@ import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -27,7 +28,7 @@ */ public abstract class ClassGenerator { protected int lineLen = 110; - protected String sourceRootPath = "../com.zsmartsystems.zigbee.dongle.zstack/src/main/java/"; + protected String sourceRootPath = "com.zsmartsystems.zigbee.dongle.zstack/src/main/java/"; protected List importList = new ArrayList(); protected String stringToConstant(String value) { @@ -134,7 +135,7 @@ protected void outputCopywrite(PrintWriter out) { BufferedReader br; try { - br = new BufferedReader(new FileReader("../pom.xml")); + br = new BufferedReader(new FileReader("pom.xml")); String line = br.readLine(); while (line != null) { if (line.contains("") && line.contains("")) { @@ -146,7 +147,7 @@ protected void outputCopywrite(PrintWriter out) { br.close(); - br = new BufferedReader(new FileReader("../src/etc/header.txt")); + br = new BufferedReader(new FileReader("src/etc/header.txt", Charset.forName("UTF-8"))); line = br.readLine(); out.println("/**"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index dff261a28a..89c1e61ecf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -878,6 +878,9 @@ protected String getTypeClass(String subsystem, String dataType) { case "IeeeAddress": addImport(zssPackage + "." + dataTypeLocal); return dataTypeLocal; + case "ExtendedPanId": + addImport(zssPackage + "." + dataTypeLocal); + return dataTypeLocal; case "ZigBeeKey": addImport(zssPackage + ".security." + dataTypeLocal); return dataTypeLocal; diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java index 2251c6214e..2a1f29aa0d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ZstackAutocoder.java @@ -36,11 +36,11 @@ */ public class ZstackAutocoder { public static void main(final String[] args) { - + Protocol protocol; try { // Load the class definitions - File fXmlFile = new File("src/main/resources/zstack_protocol.xml"); + File fXmlFile = new File("com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index 65602fbd18..a020f349ac 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -328,9 +328,9 @@ - int8 - TxPower - Requested TX power setting, in dBm. + ZstackResponseCode + Status + Staus is either Success (0) or Failure (1). @@ -928,7 +928,7 @@ Extended pan id - IeeeAddr + IeeeAddress ExtendedParentAddress Extended parent address @@ -1718,6 +1718,33 @@ + + APP_CNF_BDB_SET_CHANNEL + APP_CNF + 0x08 + This command is used to store a channel select bit-mask to be used in commissioning. + SYNC + + + boolean + IsPrimary + Mask is used for primary channel selection. + + + uint32 + Channels + A bit-mask representing the channel(s) to scan the next time the target device resets. + + + + + ZstackResponseCode + Status + Status is either Success (0) or Failure (1). + + + + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE APP_CNF diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index d27da4ddb5..5dbcff4d8f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -18,7 +18,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; import java.util.stream.Collectors; import org.slf4j.Logger; @@ -54,6 +53,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackStackConfiguration; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.TransportConfig; import com.zsmartsystems.zigbee.transport.TransportConfigOption; @@ -87,11 +87,16 @@ *

    * Usage notes... *

      - *
    • To be compatible with older devices (ie pre-ZigBee 3.0), MT_APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE should be set - * to FALSE. Failing to set this to FALSE will require the R21 join procedure to exchange keys following the initial - * association, which older devices will not perform, and the coordinator will then remove them from the network. This - * can be achieved with the {@link ZigBeeDongleZstack#requireKeyExchange(boolean)} method. - *
    • There is a bug in the TI ZStack 3.0.2 which always return 00 as the SeqNum in the ZstackZdoMsgCbIncomingAreq + *
    • To be compatible with older devices (ie pre-ZigBee 3.0), + * MT_APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE should be set + * to FALSE. Failing to set this to FALSE will require the R21 join procedure to + * exchange keys following the initial + * association, which older devices will not perform, and the coordinator will + * then remove them from the network. This + * can be achieved with the + * {@link ZigBeeDongleZstack#requireKeyExchange(boolean)} method. + *
    • There is a bug in the TI ZStack 3.0.2 which always return 00 as the + * SeqNum in the ZstackZdoMsgCbIncomingAreq *
    * * @author Chris Jackson @@ -106,7 +111,8 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { /** * The default link key */ - private static final ZigBeeKey DEFAULT_TCLK = new ZigBeeKey(new int[] { 0x5A, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, 0x6C, 0x6C, 0x69, 0x61, 0x6E, 0x63, 0x65, 0x30, 0x39 }); + private static final ZigBeeKey DEFAULT_TCLK = new ZigBeeKey(new int[] { 0x5A, 0x69, 0x67, 0x42, 0x65, 0x65, 0x41, + 0x6C, 0x6C, 0x69, 0x61, 0x6E, 0x63, 0x65, 0x30, 0x39 }); /** * The serial port used to connect to the dongle @@ -144,7 +150,13 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { private ZigBeeKey linkKey; /** - * The ZStack version used in this system. Set during initialisation and save in case the client is interested. + * The logical channel in use by the NCP + */ + private ZigBeeChannel logicalChannel = ZigBeeChannel.UNKNOWN; + + /** + * The ZStack version used in this system. Set during initialisation and save in + * case the client is interested. */ private String versionString = "Unknown"; @@ -174,7 +186,8 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { boolean isOnANetwork = false; /** - * Boolean to hold initialisation state. Set to true after {@link #startup()} completes. + * Boolean to hold initialisation state. Set to true after {@link #startup()} + * completes. */ private boolean initialised = false; @@ -182,21 +195,19 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { private ScheduledFuture pollingTimer = null; /** - * The rate at which we will do a status poll if we've not sent any other messages within this period + * The rate at which we will do a status poll if we've not sent any other + * messages within this period */ private int pollRate = 100000; /** - * The time the last command was sent from the {@link ZigBeeNetworkManager}. This is used by the dongle polling task - * to not poll if commands are otherwise being sent so as to reduce unnecessary communications with the dongle. + * The time the last command was sent from the {@link ZigBeeNetworkManager}. + * This is used by the dongle polling task + * to not poll if commands are otherwise being sent so as to reduce unnecessary + * communications with the dongle. */ private long lastSendCommandTime; - /** - * The reset listener listenes for expected and unexpected resets. And handles the events. - */ - private ResetListener resetListener; - /** * Create a {@link ZigBeeDongleZstack} * @@ -210,6 +221,7 @@ public ZigBeeDongleZstack(final ZigBeePort serialPort) { stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] { 0x00 }); stackConfiguration.put(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, new int[] { 0x01 }); + stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] { 0x01 }); } @Override @@ -244,10 +256,7 @@ public ZigBeeStatus initialize() { return ZigBeeStatus.COMMUNICATION_ERROR; } - resetListener = new ResetListener(); - protocolHandler = new ZstackProtocolHandler(); - protocolHandler.listener(ZstackSysResetIndAreq.class, resetListener); protocolHandler.start(serialPort); ZstackNcp ncp = getZstackNcp(); @@ -288,11 +297,12 @@ public ZigBeeStatus initialize() { logger.debug("ZStack device is currently on a network. Read parameters from the device"); final ZstackStackConfiguration config = new ZstackStackConfiguration(ncp); Map readConfiguration = config.getConfiguration(EnumSet.of( - ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, - ZstackConfigId.ZCD_NV_PANID, - ZstackConfigId.ZCD_NV_PRECFGKEY, - ZstackConfigId.ZCD_NV_CHANLIST - )); + ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, + ZstackConfigId.ZCD_NV_PANID, + ZstackConfigId.ZCD_NV_PRECFGKEY, + ZstackConfigId.ZCD_NV_CHANLIST)); + logicalChannel = ZigBeeChannel.create(ncp.readChannel()); + logger.debug("Current selected channel is configured as {}", logicalChannel); stackConfiguration.putAll(readConfiguration); } @@ -332,13 +342,15 @@ public ZigBeeStatus startup(boolean reinitialize) { Map configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); + logger.debug("Configuration state {} = {}", config.getKey(), + Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); } stackConfigurer.setConfiguration(stackConfiguration); configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); + logger.debug("Configuration state {} = {}", config.getKey(), + Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); } // reset the device @@ -381,9 +393,24 @@ public ZigBeeStatus startup(boolean reinitialize) { ncp.zdoRegisterCallback(ManagementPermitJoiningResponse.CLUSTER_ID); // Add the endpoint - ncp.addEndpoint(defaultLocalEndpointId, defaultDeviceId, defaultProfileId, - new int[] {}, new int[] {} - ); + ncp.addEndpoint(defaultLocalEndpointId, defaultDeviceId, defaultProfileId, + new int[] {}, new int[] {}); + + if (!initialised) { + if (!configureListeners()) { + return ZigBeeStatus.FAILURE; + } + } + + // Configure channel + int[] channelList = stackConfiguration.get(ZstackConfigId.ZCD_NV_CHANLIST); + if (channelList != null && channelList.length == 4) { + final ZstackDeserializer deserializer = new ZstackDeserializer(channelList); + int channelMask = deserializer.deserializeUInt32(); + ncp.setChannelMask(new ZigBeeChannelMask(channelMask)); + } else { + ncp.setChannelMask(new ZigBeeChannelMask(ZigBeeChannelMask.CHANNEL_MASK_2GHZ)); + } final ZigBeeStatus responseCode = startNetwork(); if (responseCode != ZigBeeStatus.SUCCESS) { @@ -427,7 +454,7 @@ public void shutdown() { public ZstackNcp getZstackNcp() { return new ZstackNcp(protocolHandler); } - + @Override public IeeeAddress getIeeeAddress() { return ieeeAddress; @@ -440,8 +467,7 @@ public Integer getNwkAddress() { @Override public ZigBeeChannel getZigBeeChannel() { - int chan = getZstackNcp().readChannel(); - return ZigBeeChannel.create(chan); + return logicalChannel; } @Override @@ -456,6 +482,7 @@ public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { ZstackNcp ncp = getZstackNcp(); + logicalChannel = channel; stackConfiguration.put(ZstackConfigId.ZCD_NV_CHANLIST, ncp.valueFromUInt32(channelMask)); // setup zigbee channel @@ -514,10 +541,11 @@ public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { if (DEFAULT_TCLK.equals(key)) { // use default key - stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] {1}); + stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] { 1 }); return ZigBeeStatus.SUCCESS; } else { - ZstackResponseCode response = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, key.getValue()); + ZstackResponseCode response = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, + key.getValue()); if (response == ZstackResponseCode.SUCCESS) { linkKey = key; return ZigBeeStatus.SUCCESS; @@ -592,27 +620,30 @@ public void updateTransportConfig(TransportConfig configuration) { switch (option) { // TODO: Configure an online network // case INSTALL_KEY: - // ZstackNcp ncp = getZstackNcp(); - // ZigBeeKey nodeKey = (ZigBeeKey) configuration.getValue(option); - // if (!nodeKey.hasAddress()) { - // logger.debug("Attempt to set INSTALL_KEY without setting address"); - // configuration.setResult(option, ZigBeeStatus.FAILURE); - // break; - // } - // ZstackResponseCode result = ncp.addInstallCode(nodeKey.getAddress(), nodeKey); - - // configuration.setResult(option, - // result == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : ZigBeeStatus.FAILURE); - // break; + // ZstackNcp ncp = getZstackNcp(); + // ZigBeeKey nodeKey = (ZigBeeKey) configuration.getValue(option); + // if (!nodeKey.hasAddress()) { + // logger.debug("Attempt to set INSTALL_KEY without setting address"); + // configuration.setResult(option, ZigBeeStatus.FAILURE); + // break; + // } + // ZstackResponseCode result = ncp.addInstallCode(nodeKey.getAddress(), + // nodeKey); + + // configuration.setResult(option, + // result == ZstackResponseCode.SUCCESS ? ZigBeeStatus.SUCCESS : + // ZigBeeStatus.FAILURE); + // break; // case RADIO_TX_POWER: - // txPower = (int) configuration.getValue(option); - // configuration.setResult(option, setTxPower(txPower)); - // break; + // txPower = (int) configuration.getValue(option); + // configuration.setResult(option, setTxPower(txPower)); + // break; // case TRUST_CENTRE_LINK_KEY: - // configuration.setResult(option, setTcLinkKey((ZigBeeKey) configuration.getValue(option))); - // break; + // configuration.setResult(option, setTcLinkKey((ZigBeeKey) + // configuration.getValue(option))); + // break; default: configuration.setResult(option, ZigBeeStatus.UNSUPPORTED); @@ -626,9 +657,12 @@ public void updateTransportConfig(TransportConfig configuration) { } /** - * This method schedules sending a status request frame on the interval specified by pollRate. If the frameHandler - * does not receive a response after a certain amount of retries, the state will be set to OFFLINE. - * The poll will not be sent if other commands have been sent to the dongle within the pollRate period so as to + * This method schedules sending a status request frame on the interval + * specified by pollRate. If the frameHandler + * does not receive a response after a certain amount of retries, the state will + * be set to OFFLINE. + * The poll will not be sent if other commands have been sent to the dongle + * within the pollRate period so as to * eliminate any unnecessary traffic with the dongle. */ private void scheduleNetworkStatePolling() { @@ -666,22 +700,16 @@ private void handleLinkStateChange(final boolean linkState) { if (linkState) { ZstackNcp ncp = getZstackNcp(); nwkAddress = ncp.getNwkAddress(); + logicalChannel = ZigBeeChannel.create(ncp.readChannel()); + ieeeAddress = ncp.getDeviceInfo().getIeeeAddress(); + // TODO: read back stuff nv? zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); } else { zigbeeTransportReceive.setTransportState(ZigBeeTransportState.OFFLINE); } } - /** - * Starts the NCP application, placing it on the network as previously - * configured. - * - * @return {@link ZigBeeStatus} defining the result - */ - private ZigBeeStatus startNetwork() { - logger.debug("ZStack starting network"); - ZstackNcp ncp = getZstackNcp(); - + private boolean configureListeners() { // setup listeners protocolHandler.listener(ZstackAfIncomingMsgAreq.class, response -> { logger.debug("Zstack incoming message"); @@ -742,17 +770,37 @@ private ZigBeeStatus startNetwork() { zigbeeTransportReceive.receiveCommand(apsFrame); }); - final Future networkUpFuture = protocolHandler.waitForEvent(ZstackZdoStateChangeIndAreq.class, response -> { - switch (response.getState()) { - case DEV_ROUTER: - case DEV_END_DEVICE: - case DEV_ZB_COORD: - return true; - default: - return false; - } + protocolHandler.listener(ZstackSysResetIndAreq.class, reset -> { + logger.warn("Unexpected reset occured: Restarting network"); + handleLinkStateChange(false); + startup(false); }); + return true; + } + + /** + * Starts the NCP application, placing it on the network as previously + * configured. + * + * @return {@link ZigBeeStatus} defining the result + */ + private ZigBeeStatus startNetwork() { + logger.debug("ZStack starting network"); + ZstackNcp ncp = getZstackNcp(); + + final Future networkUpFuture = protocolHandler + .waitForEvent(ZstackZdoStateChangeIndAreq.class, response -> { + switch (response.getState()) { + case DEV_ROUTER: + case DEV_END_DEVICE: + case DEV_ZB_COORD: + return true; + default: + return false; + } + }); + // Now start the NCP if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { return ZigBeeStatus.COMMUNICATION_ERROR; @@ -764,28 +812,6 @@ private ZigBeeStatus startNetwork() { return ZigBeeStatus.FAILURE; } - // setup dongle state listener - protocolHandler.listener(ZstackZdoStateChangeIndAreq.class, response -> { - logger.debug("Zstack dongle state changed"); - switch (response.getState()) { - case DEV_ROUTER: - case DEV_ZB_COORD: - case DEV_END_DEVICE: - handleLinkStateChange(true); - break; - default: - handleLinkStateChange(false); - break; - } - }); - return ZigBeeStatus.SUCCESS; } - - private class ResetListener implements Consumer { - @Override - public synchronized void accept(final ZstackSysResetIndAreq t) { - logger.warn("Unexpected reset occured"); - } - } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index 70e852cd06..5d1c5d12a4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -10,6 +10,8 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +25,8 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySreq; @@ -50,8 +54,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; @@ -101,16 +103,24 @@ public ZstackNcp(ZstackProtocolHandler protocolHandler) { * @return the {@link ZstackSysResetIndAreq} from the NCP or null if there was an error */ public ZstackSysResetIndAreq resetNcp(ZstackResetType resetType) { + final Future resetListener = protocolHandler.waitForEvent(ZstackSysResetIndAreq.class, response -> true); + ZstackSysResetReqAcmd request = new ZstackSysResetReqAcmd(); request.setType(resetType); - ZstackSysResetIndAreq response = protocolHandler.sendTransaction(request, ZstackSysResetIndAreq.class); - if (response == null) { - logger.debug("No response from Reset command"); + protocolHandler.queueFrame(request); + + try { + ZstackSysResetIndAreq response = resetListener.get(); + if (response == null) { + logger.debug("No response from Reset command"); + return null; + } else { + logger.debug(response.toString()); + return response; + } + } catch (InterruptedException | ExecutionException e) { return null; } - logger.debug(response.toString()); - - return response; } /** @@ -265,7 +275,9 @@ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] valu public int readChannel() { ZstackSysNvReadSreq request = new ZstackSysNvReadSreq(); - request.setId(1, 0, 0x21); + request.setSysId(1); + request.setItemId(0); + request.setSubId(0x21); request.setOffset(24); request.setLength(1); ZstackSysNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysNvReadSrsp.class); @@ -296,12 +308,12 @@ public ZigBeeKey getNetworkKey() { * @param txPower the TX power in dBm * @return the power returned from the NCP on success or null on error */ - public Integer setTxPower(int txPower) { + public ZstackResponseCode setTxPower(int txPower) { ZstackSysSetTxPowerSreq request = new ZstackSysSetTxPowerSreq(); request.setTxPower(txPower); ZstackSysSetTxPowerSrsp response = protocolHandler.sendTransaction(request, ZstackSysSetTxPowerSrsp.class); - return response == null ? null : response.getTxPower(); + return response == null ? null : response.getStatus(); } /** @@ -311,9 +323,10 @@ public Integer setTxPower(int txPower) { * @return {@link ZstackResponseCode} returned from the NCP */ public ZstackResponseCode setChannelMask(ZigBeeChannelMask channelMask) { - ZstackUtilSetChannelsSreq request = new ZstackUtilSetChannelsSreq(); + final ZstackAppCnfBdbSetChannelSreq request = new ZstackAppCnfBdbSetChannelSreq(); + request.setIsPrimary(true); request.setChannels(channelMask.getChannelMask()); - ZstackUtilSetChannelsSrsp response = protocolHandler.sendTransaction(request, ZstackUtilSetChannelsSrsp.class); + ZstackAppCnfBdbSetChannelSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetChannelSrsp.class); if (response == null) { logger.debug("No response from SetChannels command"); return ZstackResponseCode.FAILURE; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java index 448c2b42cf..1e0833ed51 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -14,6 +14,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbCommissioningNotificationAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; @@ -25,6 +26,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbHandshakeCmdSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbWriteCmdSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysGetExtAddrSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; @@ -103,6 +105,7 @@ public class ZstackFrameFactory { private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x04; private static final int APP_CNF_BDB_COMMISSIONING_NOTIFICATION = 0x80; private static final int APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY = 0x07; + private static final int APP_CNF_BDB_SET_CHANNEL = 0x08; private static final int APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY = 0x06; private static final int APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE = 0x09; private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x03; @@ -111,6 +114,7 @@ public class ZstackFrameFactory { private static final int SB_HANDSHAKE_CMD = 0x04; private static final int SB_WRITE_CMD = 0x00; private static final int SYS_GET_EXT_ADDR = 0x04; + private static final int SYS_NV_READ = 0x33; private static final int SYS_OSAL_NV_READ = 0x08; private static final int SYS_OSAL_NV_WRITE = 0x09; private static final int SYS_PING = 0x01; @@ -135,6 +139,7 @@ public class ZstackFrameFactory { private static final int ZB_GET_DEVICE_INFO = 0x06; private static final int ZB_READ_CONFIGURATION = 0x04; private static final int ZB_WRITE_CONFIGURATION = 0x05; + private static final int ZDO_EXT_NWK_INFO = 0x50; private static final int ZDO_GET_LINK_KEY = 0x25; private static final int ZDO_LEAVE_IND = 0xC9; private static final int ZDO_MSG_CB_INCOMING = 0xFF; @@ -156,6 +161,7 @@ public class ZstackFrameFactory { zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_ADD_INSTALLCODE, ZstackAppCnfBdbAddInstallcodeSrsp.class); zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_COMMISSIONING_NOTIFICATION, ZstackAppCnfBdbCommissioningNotificationAreq.class); zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_CHANNEL, ZstackAppCnfBdbSetChannelSrsp.class); zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY, ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.class); zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_SET_ALLOWREJOIN_TC_POLICY, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); @@ -164,6 +170,7 @@ public class ZstackFrameFactory { zstackFrameMap.put(ZSTACK_SBL + SB_HANDSHAKE_CMD, ZstackSbHandshakeCmdSrsp.class); zstackFrameMap.put(ZSTACK_SBL + SB_WRITE_CMD, ZstackSbWriteCmdSrsp.class); zstackFrameMap.put(ZSTACK_SYS + SYS_GET_EXT_ADDR, ZstackSysGetExtAddrSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_NV_READ, ZstackSysNvReadSrsp.class); zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_READ, ZstackSysOsalNvReadSrsp.class); zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_WRITE, ZstackSysOsalNvWriteSrsp.class); zstackFrameMap.put(ZSTACK_SYS + SYS_PING, ZstackSysPingSrsp.class); @@ -188,6 +195,7 @@ public class ZstackFrameFactory { zstackFrameMap.put(ZSTACK_SAPI + ZB_GET_DEVICE_INFO, ZstackZbGetDeviceInfoSrsp.class); zstackFrameMap.put(ZSTACK_SAPI + ZB_READ_CONFIGURATION, ZstackZbReadConfigurationSrsp.class); zstackFrameMap.put(ZSTACK_SAPI + ZB_WRITE_CONFIGURATION, ZstackZbWriteConfigurationSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_EXT_NWK_INFO, ZstackZdoExtNwkInfoSrsp.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_GET_LINK_KEY, ZstackZdoGetLinkKeySrsp.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_LEAVE_IND, ZstackZdoLeaveIndAreq.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_INCOMING, ZstackZdoMsgCbIncomingAreq.class); @@ -198,7 +206,6 @@ public class ZstackFrameFactory { zstackFrameMap.put(ZSTACK_ZDO + ZDO_STARTUP_FROM_APP, ZstackZdoStartupFromAppSrsp.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_STATE_CHANGE_IND, ZstackZdoStateChangeIndAreq.class); zstackFrameMap.put(ZSTACK_ZDO + ZDO_TC_DEV_IND, ZstackZdoTcDevIndAreq.class); - zstackFrameMap.put(ZSTACK_ZDO + 0x50, ZstackZdoExtNwkInfoSrsp.class); } /** diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java index 4d351cfb80..7ff62ee6ea 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java @@ -81,7 +81,7 @@ public enum ZstackResponseCode { MAC_SCAN_IN_PROGRESS(0x00FC), /** - * The transaction has expired + * The outstanding transaction has expired */ MAC_TRANSACTION_EXPIRED(0x00F0); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index d53716698e..998a0f0c13 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -27,7 +27,7 @@ public enum AfDataOptions { AF_ACK_REQUEST(0x0010), /** - * Set this bit to force route discovery if a routing table entry doesn’t exist + * Set this bit to force route discovery if a routing table entry doesnt exist */ AF_DISCV_ROUTE(0x0020), diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java index e0680b3c9c..47c14c45b5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -15,8 +15,8 @@ *

    * This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a * AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status - * of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm - * carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This + * of whether the APS acknowledgement was received or not (ZApsNoAck 0xb7). If APS acknowledgement was not used, then the confirm + * carries the status of whether the MAC acknowledgement (next hop acknowledgment) was received or not (ZMacNoACK 0xe9). This * also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of * the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS * acknowledgement is received. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index f9941b60b4..6e715774a3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -13,7 +13,7 @@ /** * Class to implement the Z-Stack command AF_REGISTER. *

    - * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * This command enables the host processor to register an applications endpoint description (and its simple descriptor). * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint * description per application profile. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java index 4d9a261d27..c714969bf3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -13,7 +13,7 @@ /** * Class to implement the Z-Stack command AF_REGISTER. *

    - * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * This command enables the host processor to register an applications endpoint description (and its simple descriptor). * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint * description per application profile. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java new file mode 100644 index 0000000000..31106ec45e --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. + *

    + * This command is used to store a channel select bit-mask to be used in commissioning. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetChannelSreq extends ZstackFrameRequest { + + /** + * Mask is used for primary channel selection. + */ + private boolean isPrimary; + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + */ + private int channels; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetChannelSreq() { + synchronousCommand = true; + } + + /** + * Mask is used for primary channel selection. + * + * @return the current isPrimary as {@link boolean} + */ + public boolean getIsPrimary() { + return isPrimary; + } + + /** + * Mask is used for primary channel selection. + * + * @param isPrimary the IsPrimary to set as {@link boolean} + */ + public void setIsPrimary(boolean isPrimary) { + this.isPrimary = isPrimary; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @return the current channels as {@link int} + */ + public int getChannels() { + return channels; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @param channels the Channels to set as {@link int} + */ + public void setChannels(int channels) { + this.channels = channels; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x08)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x08); + + // Serialize the fields + serializer.serializeBoolean(isPrimary); + serializer.serializeUInt32(channels); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(82); + builder.append("ZstackAppCnfBdbSetChannelSreq [isPrimary="); + builder.append(isPrimary); + builder.append(", channels="); + builder.append(channels); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java new file mode 100644 index 0000000000..e94a18a7f0 --- /dev/null +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. + *

    + * This command is used to store a channel select bit-mask to be used in commissioning. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackAppCnfBdbSetChannelSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetChannelSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackAppCnfBdbSetChannelSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java index e74f8f30b6..e46404313e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java @@ -63,7 +63,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x04); // Serialize the fields - serializer.serializeUInt8(configId.getKey()); + serializer.serializeUInt16(configId.getKey()); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java index b8435ac73c..f82e1bd7d1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java @@ -48,7 +48,7 @@ public ZstackZbReadConfigurationSrsp(int[] inputBuffer) { // Deserialize the fields status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - configId = ZstackConfigId.valueOf(deserializer.deserializeUInt8()); + configId = ZstackConfigId.valueOf(deserializer.deserializeUInt16()); int len = deserializer.deserializeUInt8(); value = deserializer.deserializeUInt8Array(len); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java index ee1f31d93f..b70e631f44 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java @@ -86,7 +86,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x05); // Serialize the fields - serializer.serializeUInt8(configId.getKey()); + serializer.serializeUInt16(configId.getKey()); serializer.serializeUInt8(value.length); serializer.serializeUInt8Array(value); return getPayload(); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java index 664318705a..be1c7a72c8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -38,7 +38,7 @@ public class ZstackSbHandshakeCmdSrsp extends ZstackFrameResponse { private int bufferLength; /** - * 0x800 – CC2538 flash page size + * 0x800 CC2538 flash page size */ private int pageSize; @@ -132,7 +132,7 @@ public void setBufferLength(int bufferLength) { } /** - * 0x800 – CC2538 flash page size + * 0x800 CC2538 flash page size * * @return the current pageSize as {@link int} */ @@ -141,7 +141,7 @@ public int getPageSize() { } /** - * 0x800 – CC2538 flash page size + * 0x800 CC2538 flash page size * * @param pageSize the PageSize to set as {@link int} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index 62cfd90ee0..1296209220 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -45,6 +45,11 @@ public enum ZstackConfigId { */ ZCD_NV_START_DELAY(0x0004), + /** + * This item holds all kinds of network information. + */ + ZCD_NV_NIB(0x0021), + /** * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. @@ -340,8 +345,8 @@ public enum ZstackConfigId { * If security functionality is enabled, there are two options to distribute the security key to all devices in the network. If this * parameter is true, the same security key is assumed to be pre-configured in all devices in the network.If it is set to false, then * the key only needs to be configured on the coordinator device. In this case, the key is distributed to each device upon joining by - * the coordinator. This key distribution will happen in the “clear” on the last hop of the packet transmission and this - * constitutes a brief “period of vulnerability” during which a malicious device can capture the key. Hence it is not recommended + * the coordinator. This key distribution will happen in the clear on the last hop of the packet transmission and this + * constitutes a brief period of vulnerability during which a malicious device can capture the key. Hence it is not recommended * unless it can be ensured that there are no malicious devices in the vicinity at the time of network formation. *

    * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 1 byte; @@ -449,7 +454,7 @@ public enum ZstackConfigId { /** * An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it can easily identified or * described later. The first byte is the length of the user descriptor data and must not be greater than 16. Size: 17 bytes; Default - * value: “CC2530-ZNP x......” (dots represent the device IEEE address) + * value: CC2530-ZNP x...... (dots represent the device IEEE address) */ ZCD_NV_USERDESC(0x0081), @@ -460,7 +465,7 @@ public enum ZstackConfigId { /** * This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. Networks that exist in the same - * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate “don’t care”. Size: + * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate dont care. Size: * 2 bytes; Default value: 0xFFFF */ ZCD_NV_PANID(0x0083), @@ -504,7 +509,7 @@ public enum ZstackConfigId { * This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the host processor. By * default, this item is set to FALSE, which means that the host processor must use the ZDO_MSG_CB_REGISTER command to subscribe to * a specific ZDO callback in order to receive it. The ZDO callback is then conveyed as part of the ZDO_MSG_CB_INCOMING command. If - * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the “verbose” response. For example, the host + * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the verbose response. For example, the host * processor would receive the ZDO_IEEE_ADDR_RSP command in response to ZDO_IEEE_ADDR_REQ. Size: 1 byte; Default value: FALSE */ ZCD_NV_ZDO_DIRECT_CB(0x008F), diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java index 2faec3ff5d..d9f9b1928f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -22,7 +22,7 @@ public class ZstackSysGetExtAddrSrsp extends ZstackFrameResponse { /** - * The device’s extended address. + * The devices extended address. */ private IeeeAddress extAddress; @@ -40,7 +40,7 @@ public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { } /** - * The device’s extended address. + * The devices extended address. * * @return the current extAddress as {@link IeeeAddress} */ @@ -49,7 +49,7 @@ public IeeeAddress getExtAddress() { } /** - * The device’s extended address. + * The devices extended address. * * @param extAddress the ExtAddress to set as {@link IeeeAddress} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java index 31a53bd499..1d2f49602d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java @@ -11,10 +11,9 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; /** - * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + * Class to implement the Z-Stack command SYS_NV_READ. *

    - * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value - * and data offset and returns the memory value present in the target for the specified attribute Id. + * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested *

    * Note that this code is autogenerated. Manual changes may be overwritten. * @@ -23,16 +22,28 @@ public class ZstackSysNvReadSreq extends ZstackFrameRequest { /** - * The Id of the NV item. + * The system id (1 for zstack) */ - private int systemId; + private int sysId; + /** + * The sub id (0 for legacy) + */ private int itemId; + /** + * The Id of the NV item. + */ private int subId; + /** + * Number of bytes offset from the beginning or the NV value. + */ private int offset; + /** + * Number of bytes to read + */ private int length; /** @@ -43,13 +54,56 @@ public ZstackSysNvReadSreq() { } /** - * The Id of the NV item. + * The system id (1 for zstack) * - * @param id the id to set as {@link ZstackConfigId} + * @return the current sysId as {@link int} */ - public void setId(int systemId, int itemId, int subId) { - this.systemId = systemId; + public int getSysId() { + return sysId; + } + + /** + * The system id (1 for zstack) + * + * @param sysId the sysId to set as {@link int} + */ + public void setSysId(int sysId) { + this.sysId = sysId; + } + + /** + * The sub id (0 for legacy) + * + * @return the current itemId as {@link int} + */ + public int getItemId() { + return itemId; + } + + /** + * The sub id (0 for legacy) + * + * @param itemId the itemId to set as {@link int} + */ + public void setItemId(int itemId) { this.itemId = itemId; + } + + /** + * The Id of the NV item. + * + * @return the current subId as {@link int} + */ + public int getSubId() { + return subId; + } + + /** + * The Id of the NV item. + * + * @param subId the subId to set as {@link int} + */ + public void setSubId(int subId) { this.subId = subId; } @@ -65,12 +119,26 @@ public int getOffset() { /** * Number of bytes offset from the beginning or the NV value. * - * @param offset the Offset to set as {@link int} + * @param offset the offset to set as {@link int} */ public void setOffset(int offset) { this.offset = offset; } + /** + * Number of bytes to read + * + * @return the current length as {@link int} + */ + public int getLength() { + return length; + } + + /** + * Number of bytes to read + * + * @param length the length to set as {@link int} + */ public void setLength(int length) { this.length = length; } @@ -86,7 +154,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x33); // Serialize the fields - serializer.serializeUInt8(systemId); + serializer.serializeUInt8(sysId); serializer.serializeUInt16(itemId); serializer.serializeUInt16(subId); serializer.serializeUInt16(offset); @@ -96,10 +164,17 @@ public int[] serialize() { @Override public String toString() { - final StringBuilder builder = new StringBuilder(76); - builder.append("ZstackSysOsalNvReadSreq [id="); + final StringBuilder builder = new StringBuilder(147); + builder.append("ZstackSysNvReadSreq [sysId="); + builder.append(sysId); + builder.append(", itemId="); + builder.append(itemId); + builder.append(", subId="); + builder.append(subId); builder.append(", offset="); builder.append(offset); + builder.append(", length="); + builder.append(length); builder.append(']'); return builder.toString(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java index fb61f568bb..eb146c302b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java @@ -11,10 +11,9 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; /** - * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + * Class to implement the Z-Stack command SYS_NV_READ. *

    - * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value - * and data offset and returns the memory value present in the target for the specified attribute Id. + * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested *

    * Note that this code is autogenerated. Manual changes may be overwritten. * @@ -28,7 +27,7 @@ public class ZstackSysNvReadSrsp extends ZstackFrameResponse { private ZstackResponseCode status; /** - * Value of the NV item. + * value of the NV item. */ private int[] value; @@ -43,8 +42,8 @@ public ZstackSysNvReadSrsp(int[] inputBuffer) { // Deserialize the fields status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - int len = deserializer.deserializeUInt8(); - value = deserializer.deserializeUInt8Array(len); + int length = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(length); } /** @@ -66,7 +65,7 @@ public void setStatus(ZstackResponseCode status) { } /** - * Value of the NV item. + * value of the NV item. * * @return the current value as {@link int[]} */ @@ -75,9 +74,9 @@ public int[] getValue() { } /** - * Value of the NV item. + * value of the NV item. * - * @param value the Value to set as {@link int[]} + * @param value the value to set as {@link int[]} */ public void setValue(int[] value) { this.value = value; @@ -85,8 +84,8 @@ public void setValue(int[] value) { @Override public String toString() { - final StringBuilder builder = new StringBuilder(101); - builder.append("ZstackSysOsalNvReadSrsp [status="); + final StringBuilder builder = new StringBuilder(97); + builder.append("ZstackSysNvReadSrsp [status="); builder.append(status); builder.append(", value="); for (int c = 0; c < value.length; c++) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java index 026c714940..a59842becd 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java @@ -86,7 +86,7 @@ public int[] serialize() { serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x08); // Serialize the fields - serializer.serializeUInt8(id.getKey()); + serializer.serializeUInt16(id.getKey()); serializer.serializeUInt8(offset); return getPayload(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java index ff18f9a06a..a4a993ab57 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -23,7 +23,7 @@ public class ZstackSysSetExtAddrSreq extends ZstackFrameRequest { /** - * The device’s extended address. + * The devices extended address. */ private IeeeAddress extAddress; @@ -35,7 +35,7 @@ public ZstackSysSetExtAddrSreq() { } /** - * The device’s extended address. + * The devices extended address. * * @return the current extAddress as {@link IeeeAddress} */ @@ -44,7 +44,7 @@ public IeeeAddress getExtAddress() { } /** - * The device’s extended address. + * The devices extended address. * * @param extAddress the ExtAddress to set as {@link IeeeAddress} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java index 0c9f880305..6422ea226f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -14,7 +14,7 @@ * Class to implement the Z-Stack command SYS_SET_TX_POWER. *

    * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio – nearest characterized value for the specific radio. + * applied to the radio nearest characterized value for the specific radio. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java index 456b8da6aa..bd54a60678 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -8,12 +8,13 @@ package com.zsmartsystems.zigbee.dongle.zstack.api.sys; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; /** * Class to implement the Z-Stack command SYS_SET_TX_POWER. *

    * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio – nearest characterized value for the specific radio. + * applied to the radio nearest characterized value for the specific radio. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * @@ -22,9 +23,9 @@ public class ZstackSysSetTxPowerSrsp extends ZstackFrameResponse { /** - * Requested TX power setting, in dBm. + * Staus is either Success (0) or Failure (1). */ - private int txPower; + private ZstackResponseCode status; /** * Response and Handler constructor @@ -36,32 +37,32 @@ public ZstackSysSetTxPowerSrsp(int[] inputBuffer) { synchronousCommand = true; // Deserialize the fields - txPower = deserializer.deserializeUInt8(); + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); } /** - * Requested TX power setting, in dBm. + * Staus is either Success (0) or Failure (1). * - * @return the current txPower as {@link int} + * @return the current status as {@link ZstackResponseCode} */ - public int getTxPower() { - return txPower; + public ZstackResponseCode getStatus() { + return status; } /** - * Requested TX power setting, in dBm. + * Staus is either Success (0) or Failure (1). * - * @param txPower the TxPower to set as {@link int} + * @param status the Status to set as {@link ZstackResponseCode} */ - public void setTxPower(int txPower) { - this.txPower = txPower; + public void setStatus(ZstackResponseCode status) { + this.status = status; } @Override public String toString() { final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysSetTxPowerSrsp [txPower="); - builder.append(txPower); + builder.append("ZstackSysSetTxPowerSrsp [status="); + builder.append(status); builder.append(']'); return builder.toString(); } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java index 2cf9f4dc11..a779a2847c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -23,7 +23,7 @@ public class ZstackSysZdiagsClearStatsSreq extends ZstackFrameRequest { /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. */ private boolean clearNv; @@ -35,7 +35,7 @@ public ZstackSysZdiagsClearStatsSreq() { } /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. * * @return the current clearNv as {@link boolean} */ @@ -44,7 +44,7 @@ public boolean getClearNV() { } /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. * * @param clearNv the clearNV to set as {@link boolean} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java index 7710581e60..4061540332 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java @@ -11,9 +11,7 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; /** - * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. - *

    - * This command retrieves the application link key of a given device. + * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * @@ -38,14 +36,12 @@ public int[] serialize() { // Serialize the header serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x50); + // Serialize the fields return getPayload(); } @Override public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackZdoExtNwkInfoSreq [ieeeAddr="); - builder.append(']'); - return builder.toString(); + return "ZstackZdoExtNwkInfoSreq []"; } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java index 5453875198..c7940a258d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java @@ -7,13 +7,12 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; +import com.zsmartsystems.zigbee.ExtendedPanId; import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; /** - * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. - *

    - * This command retrieves the application link key of a given device. + * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * @@ -21,76 +20,178 @@ */ public class ZstackZdoExtNwkInfoSrsp extends ZstackFrameResponse { + /** + * Short address + */ private int shortAddress; + + /** + * Pan id + */ + private int panId; + + /** + * Parent address + */ + private int parentAddress; + + /** + * Extended pan id + */ + private ExtendedPanId extendedPanId; + + /** + * Extended parent address + */ + private IeeeAddress extendedParentAddress; + + /** + * Channel + */ + private int channel; + + /** + * Response and Handler constructor + */ + public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + shortAddress = deserializer.deserializeUInt16(); + panId = deserializer.deserializeUInt16(); + parentAddress = deserializer.deserializeUInt16(); + extendedPanId = deserializer.deserializeExtendedPanId(); + extendedParentAddress = deserializer.deserializeIeeeAddress(); + channel = deserializer.deserializeUInt8(); + } + + /** + * Short address + * + * @return the current shortAddress as {@link int} + */ public int getShortAddress() { return shortAddress; } + /** + * Short address + * + * @param shortAddress the ShortAddress to set as {@link int} + */ public void setShortAddress(int shortAddress) { this.shortAddress = shortAddress; } - private int panId; + /** + * Pan id + * + * @return the current panId as {@link int} + */ public int getPanId() { return panId; } + /** + * Pan id + * + * @param panId the PanId to set as {@link int} + */ public void setPanId(int panId) { this.panId = panId; } - private int parentAddress; + /** + * Parent address + * + * @return the current parentAddress as {@link int} + */ public int getParentAddress() { return parentAddress; } + /** + * Parent address + * + * @param parentAddress the ParentAddress to set as {@link int} + */ public void setParentAddress(int parentAddress) { this.parentAddress = parentAddress; } - private int[] extendedPanId; - public int[] getExtendedPanId() { + /** + * Extended pan id + * + * @return the current extendedPanId as {@link ExtendedPanId} + */ + public ExtendedPanId getExtendedPanId() { return extendedPanId; } - public void setExtendedPanId(int[] extendedPanId) { + /** + * Extended pan id + * + * @param extendedPanId the ExtendedPanId to set as {@link ExtendedPanId} + */ + public void setExtendedPanId(ExtendedPanId extendedPanId) { this.extendedPanId = extendedPanId; } - private IeeeAddress extendedParentAddress; + /** + * Extended parent address + * + * @return the current extendedParentAddress as {@link IeeeAddress} + */ public IeeeAddress getExtendedParentAddress() { return extendedParentAddress; } + /** + * Extended parent address + * + * @param extendedParentAddress the ExtendedParentAddress to set as {@link IeeeAddress} + */ public void setExtendedParentAddress(IeeeAddress extendedParentAddress) { this.extendedParentAddress = extendedParentAddress; } - private int channel; - + /** + * Channel + * + * @return the current channel as {@link int} + */ public int getChannel() { return channel; } + /** + * Channel + * + * @param channel the Channel to set as {@link int} + */ public void setChannel(int channel) { this.channel = channel; } - /** - * Response and Handler constructor - */ - public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - shortAddress = deserializer.deserializeUInt16(); - panId = deserializer.deserializeUInt16(); - parentAddress = deserializer.deserializeUInt16(); - extendedPanId = deserializer.deserializeUInt8Array(8); - extendedParentAddress = deserializer.deserializeIeeeAddress(); - channel = deserializer.deserializeUInt8(); + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(176); + builder.append("ZstackZdoExtNwkInfoSrsp [shortAddress="); + builder.append(String.format("%02X", shortAddress)); + builder.append(", panId="); + builder.append(String.format("%02X", panId)); + builder.append(", parentAddress="); + builder.append(String.format("%02X", parentAddress)); + builder.append(", extendedPanId="); + builder.append(extendedPanId); + builder.append(", extendedParentAddress="); + builder.append(extendedParentAddress); + builder.append(", channel="); + builder.append(channel); + builder.append(']'); + return builder.toString(); } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java index 8110706066..7b29691e6c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -24,7 +24,7 @@ public class ZstackZdoGetLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. */ private ZstackResponseCode status; @@ -54,7 +54,7 @@ public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. * * @return the current status as {@link ZstackResponseCode} */ @@ -63,7 +63,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java index b3363d9819..29593a4e96 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -36,7 +36,7 @@ public class ZstackZdoMsgCbIncomingAreq extends ZstackFrameResponse { private int clusterId; /** - * N/A – not used. + * N/A not used. */ private boolean securityUse; @@ -127,7 +127,7 @@ public void setClusterId(int clusterId) { } /** - * N/A – not used. + * N/A not used. * * @return the current securityUse as {@link boolean} */ @@ -136,7 +136,7 @@ public boolean getSecurityUse() { } /** - * N/A – not used. + * N/A not used. * * @param securityUse the SecurityUse to set as {@link boolean} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java index 33d473fe16..63d6c49ad5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoMsgCbRegisterSrsp extends ZstackFrameResponse { /** - * 0x00 – Success. + * 0x00 Success. */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { } /** - * 0x00 – Success. + * 0x00 Success. * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 – Success. + * 0x00 Success. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java index dba377b8c8..1a9852ed8e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoRemoveLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 – Success. 0xC8 – Unknown device. + * 0x00 Success. 0xC8 Unknown device. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java index 53f9591fd1..cfcbaf1287 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoSetLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index 7a20b12e7a..f7d95522c4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -12,13 +12,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Queue; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Predicate; @@ -56,11 +56,6 @@ private enum ZstackState { FCS } - /** - * Flag to note if we are waiting for a SRSP to ensure that only one synchronous request is outstanding at any time - */ - private AtomicBoolean waitingSrsp = new AtomicBoolean(); - /** * The logger. */ @@ -79,7 +74,7 @@ private enum ZstackState { /** * The queue of {@link ZstackFrameRequest} frames waiting to be sent */ - private final Queue sendQueue = new ConcurrentLinkedQueue<>(); + private final BlockingQueue sendQueue = new LinkedBlockingQueue<>(); private ExecutorService executor = ZigBeeExecutors.newCachedThreadPool("ZstackProtocolHandler"); @@ -94,6 +89,20 @@ private enum ZstackState { public void start(final ZigBeePort port) { this.port = port; + executor.execute(() -> { + logger.debug("ZstackFrameHandler sender started."); + while (!closeHandler) { + try { + sendNextFrame(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (Exception e) { + logger.error("ZstackFrameHandler sending Exception: ", e); + } + } + logger.debug("ZstackFrameHandler sender exited."); + }); + executor.execute(() -> { logger.debug("ZstackFrameHandler thread started"); @@ -108,11 +117,6 @@ public void start(final ZigBeePort port) { continue; } - if (waitingSrsp.compareAndSet(isSynchronous(frameData[0]), false)) { - logger.debug("ZSTACK synchronous frame received. waitingSrsp={}, isSynchronous={}", - waitingSrsp, isSynchronous(frameData[0])); - } - ZstackFrameResponse response = ZstackFrameFactory.createFrame(frameData); if (response == null) { logger.debug("RX ZSTACK: ZstackUnknownFrame [ data={}]", frameToString(frameData)); @@ -123,8 +127,6 @@ public void start(final ZigBeePort port) { // Also handle any ZStack level transactions (SREQ transactions or waiting events) notifyResponseReceived(response); - - sendNextFrame(); } catch (final IOException e) { logger.error("ZstackFrameHandler IOException: ", e); @@ -170,9 +172,7 @@ public void queueFrame(ZstackFrameRequest request) { } sendQueue.add(request); - logger.debug("ZSTACK TX Queue length={}, waitingSync={}", sendQueue.size(), waitingSrsp); - - sendNextFrame(); + logger.debug("ZSTACK TX Queue length={}", sendQueue.size()); } /** @@ -289,22 +289,14 @@ private void clearTransactionQueue() { } } - private synchronized boolean sendNextFrame() { - if (sendQueue.isEmpty()) { + private synchronized boolean sendNextFrame() throws InterruptedException { + final ZstackFrameRequest request = sendQueue.poll(1000L, TimeUnit.MILLISECONDS); + if (request == null) { return false; } - if (waitingSrsp.get() && sendQueue.peek().isSynchronous()) { - // We are waiting for an SRSP and the next frame is an SREQ, so we need to wait - return false; - } + sendFrame(request); - ZstackFrameRequest nextFrame = sendQueue.poll(); - if (waitingSrsp.compareAndSet(false, nextFrame.isSynchronous())) { - logger.debug("ZSTACK synchronous frame sent. waitingSrsp={}", waitingSrsp); - } - - sendFrame(nextFrame); return true; } @@ -346,17 +338,6 @@ private String frameToString(int[] inputBuffer) { return result.toString(); } - /** - * Checks the frame type to see if it is a synchronous request or response. - * - * @param cmd0 the first command byte of the request or response frame - * @return true if this is a synchronous frame - */ - private boolean isSynchronous(int cmd0) { - int frameType = cmd0 & 0xE0; - return (frameType == 0x20 || frameType == 0x60); - } - private int[] getPacket() throws IOException { int length = 0; int bytesRead = 0; diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java index 2cc4aee38b..d20563031d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/serializer/ZstackDeserializer.java @@ -7,6 +7,7 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.internal.serializer; +import com.zsmartsystems.zigbee.ExtendedPanId; import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.security.ZigBeeKey; @@ -75,4 +76,8 @@ public int[] deserializeUInt16Array(int len) { public ZigBeeKey deserializeZigBeeKey() { return new ZigBeeKey(deserializeUInt8Array(16)); } + + public ExtendedPanId deserializeExtendedPanId() { + return new ExtendedPanId(deserializeUInt8Array(8)); + } } From b2130756f292719214e4f14622867d1e414c9c04 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Fri, 28 Oct 2022 22:37:59 +0200 Subject: [PATCH 24/33] When network comes online: read current channel using command --- .../src/main/resources/zstack_protocol.xml | 8 ++++- .../dongle/zstack/ZigBeeDongleZstack.java | 18 ++++++----- .../zigbee/dongle/zstack/ZstackNcp.java | 6 ++++ .../api/zdo/ZstackZdoExtNwkInfoSreq.java | 2 ++ .../api/zdo/ZstackZdoExtNwkInfoSrsp.java | 30 ++++++++++++++++++- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml index a020f349ac..b7e0c9607d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/resources/zstack_protocol.xml @@ -899,7 +899,7 @@ ZDO_EXT_NWK_INFO ZDO 0x50 - + Get the network info from the device SYNC @@ -910,6 +910,12 @@ hex[2] Short address + + uint8 + Padding + hex[1] + Unknown field + uint16 PanId diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 5dbcff4d8f..5f74fe96de 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -297,7 +297,7 @@ public ZigBeeStatus initialize() { logger.debug("ZStack device is currently on a network. Read parameters from the device"); final ZstackStackConfiguration config = new ZstackStackConfiguration(ncp); Map readConfiguration = config.getConfiguration(EnumSet.of( - ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, + ZstackConfigId.ZCD_NV_EXTPANID, ZstackConfigId.ZCD_NV_PANID, ZstackConfigId.ZCD_NV_PRECFGKEY, ZstackConfigId.ZCD_NV_CHANLIST)); @@ -508,7 +508,7 @@ public ZigBeeStatus setZigBeePanId(int panId) { @Override public ExtendedPanId getZigBeeExtendedPanId() { - return new ExtendedPanId(stackConfiguration.get(ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID)); + return new ExtendedPanId(stackConfiguration.get(ZstackConfigId.ZCD_NV_EXTPANID)); } @Override @@ -517,7 +517,7 @@ public ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } - stackConfiguration.put(ZstackConfigId.ZCD_NV_APS_USE_EXT_PANID, extendedPanId.getValue()); + stackConfiguration.put(ZstackConfigId.ZCD_NV_EXTPANID, extendedPanId.getValue()); return ZigBeeStatus.SUCCESS; } @@ -700,7 +700,7 @@ private void handleLinkStateChange(final boolean linkState) { if (linkState) { ZstackNcp ncp = getZstackNcp(); nwkAddress = ncp.getNwkAddress(); - logicalChannel = ZigBeeChannel.create(ncp.readChannel()); + logicalChannel = ZigBeeChannel.create(ncp.readChannelCmd()); ieeeAddress = ncp.getDeviceInfo().getIeeeAddress(); // TODO: read back stuff nv? zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); @@ -802,13 +802,15 @@ private ZigBeeStatus startNetwork() { }); // Now start the NCP - if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { - return ZigBeeStatus.COMMUNICATION_ERROR; - } - try { + if (ncp.startupApplication() != ZstackResponseCode.SUCCESS) { + networkUpFuture.cancel(true); + return ZigBeeStatus.COMMUNICATION_ERROR; + } + networkUpFuture.get(); } catch (InterruptedException | ExecutionException e) { + networkUpFuture.cancel(true); return ZigBeeStatus.FAILURE; } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index 5d1c5d12a4..a9c35f0e56 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -288,6 +288,12 @@ public int readChannel() { } } + public int readChannelCmd() { + ZstackZdoExtNwkInfoSrsp networkInfo = getNetworkInfo(); + + return networkInfo == null ? -1 : networkInfo.getChannel(); + } + /** * Gets the network key. * diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java index 4061540332..67d3214c20 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java @@ -13,6 +13,8 @@ /** * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. *

    + * Get the network info from the device + *

    * Note that this code is autogenerated. Manual changes may be overwritten. * * @author Chris Jackson diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java index c7940a258d..b7d3cc1e93 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java @@ -14,6 +14,8 @@ /** * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. *

    + * Get the network info from the device + *

    * Note that this code is autogenerated. Manual changes may be overwritten. * * @author Chris Jackson @@ -25,6 +27,11 @@ public class ZstackZdoExtNwkInfoSrsp extends ZstackFrameResponse { */ private int shortAddress; + /** + * Unknown field + */ + private int padding; + /** * Pan id */ @@ -61,6 +68,7 @@ public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { // Deserialize the fields shortAddress = deserializer.deserializeUInt16(); + padding = deserializer.deserializeUInt8(); panId = deserializer.deserializeUInt16(); parentAddress = deserializer.deserializeUInt16(); extendedPanId = deserializer.deserializeExtendedPanId(); @@ -86,6 +94,24 @@ public void setShortAddress(int shortAddress) { this.shortAddress = shortAddress; } + /** + * Unknown field + * + * @return the current padding as {@link int} + */ + public int getPadding() { + return padding; + } + + /** + * Unknown field + * + * @param padding the Padding to set as {@link int} + */ + public void setPadding(int padding) { + this.padding = padding; + } + /** * Pan id * @@ -178,9 +204,11 @@ public void setChannel(int channel) { @Override public String toString() { - final StringBuilder builder = new StringBuilder(176); + final StringBuilder builder = new StringBuilder(201); builder.append("ZstackZdoExtNwkInfoSrsp [shortAddress="); builder.append(String.format("%02X", shortAddress)); + builder.append(", padding="); + builder.append(String.format("%01X", padding)); builder.append(", panId="); builder.append(String.format("%02X", panId)); builder.append(", parentAddress="); From c7fe4c8a27302be36c86fe469c290bab99801607 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sat, 29 Oct 2022 09:27:48 +0200 Subject: [PATCH 25/33] Using UTF-8 as charset --- .../zstack/ZstackConsoleAbstractCommand.java | 9 +- .../ZstackConsoleNcpSecurityCommand.java | 9 +- .../zstack/ZstackConsoleNcpStateCommand.java | 39 +++- .../zstack/autocode/ClassGenerator.java | 4 +- .../dongle/zstack/ZigBeeDongleZstack.java | 48 ++-- .../zigbee/dongle/zstack/ZstackNcp.java | 215 +----------------- .../dongle/zstack/api/af/AfDataOptions.java | 2 +- .../api/af/ZstackAfDataConfirmAreq.java | 4 +- .../zstack/api/af/ZstackAfRegisterSreq.java | 2 +- .../zstack/api/af/ZstackAfRegisterSrsp.java | 2 +- .../api/sbl/ZstackSbHandshakeCmdSrsp.java | 6 +- .../dongle/zstack/api/sys/ZstackConfigId.java | 10 +- .../api/sys/ZstackSysGetExtAddrSrsp.java | 6 +- .../api/sys/ZstackSysSetExtAddrSreq.java | 6 +- .../api/sys/ZstackSysSetTxPowerSreq.java | 2 +- .../api/sys/ZstackSysSetTxPowerSrsp.java | 2 +- .../sys/ZstackSysZdiagsClearStatsSreq.java | 6 +- .../api/zdo/ZstackZdoGetLinkKeySrsp.java | 6 +- .../api/zdo/ZstackZdoMsgCbIncomingAreq.java | 6 +- .../api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 6 +- .../api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 6 +- .../api/zdo/ZstackZdoSetLinkKeySrsp.java | 6 +- .../zigbee/dongle/zstack/ZStackNcpTest.java | 50 ++-- .../dongle/zstack/ZigBeeDongleZstackTest.java | 6 +- 24 files changed, 146 insertions(+), 312 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java index a512104db2..90c4594b8c 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleAbstractCommand.java @@ -14,6 +14,7 @@ import com.zsmartsystems.zigbee.console.ZigBeeConsoleCommand; import com.zsmartsystems.zigbee.dongle.zstack.ZigBeeDongleZstack; import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; /** * @@ -23,8 +24,12 @@ public abstract class ZstackConsoleAbstractCommand implements ZigBeeConsoleCommand { private static String CFG_UNSUPPORTED = "Not Supported"; - protected ZstackNcp getZstackNcp(ZigBeeNetworkManager networkManager) throws IllegalArgumentException, IllegalStateException { - return getDongle(networkManager).getZstackNcp(); + protected ZstackProtocolHandler getProtocolHandler(ZigBeeNetworkManager networkManager) throws IllegalArgumentException, IllegalStateException { + return getDongle(networkManager).getProtocolHandler(); + } + + protected ZstackNcp getZstackNcp(ZigBeeNetworkManager networkManager) { + return new ZstackNcp(getProtocolHandler(networkManager)); } protected ZigBeeDongleZstack getDongle(ZigBeeNetworkManager networkManager) { diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java index 493e4f60d1..aefecdb98f 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -14,7 +14,6 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackNwkKeyDesc; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSecMgrEntry; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; /** @@ -46,9 +45,9 @@ public String getHelp() { @Override public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) throws IllegalArgumentException { - ZstackNcp ncp = getZstackNcp(networkManager); + ZstackNcp ncp = new ZstackNcp(getProtocolHandler(networkManager)); - ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); + int[] preConfigKey = ncp.readConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY); int[] nwkKeyConfig = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWKKEY); int[] altKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ALTERN_KEY_INFO); int[] nwkActiveKeyInfo = ncp.readConfiguration(ZstackConfigId.ZCD_NV_NWK_ACTIVE_KEY_INFO); @@ -62,10 +61,10 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr secMgrEntry.deserialize(deserializer); } - if (nvInfo == null) { + if (preConfigKey == null) { out.println("NV Device info : ERROR"); } else { - out.println("Preconfigured Network Key : " + nvInfo.getPreConfigKey()); + out.println("Preconfigured Network Key : " + preConfigKey); } if (nwkKeyConfig == null) { diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java index ad292b519f..686c6a7e79 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpStateCommand.java @@ -8,17 +8,22 @@ package com.zsmartsystems.zigbee.console.zstack; import java.io.PrintStream; -import java.util.Set; -import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.dongle.zstack.ZstackNcp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; /** * @@ -53,13 +58,15 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr } private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { - ZstackNcp ncp = getZstackNcp(networkManager); + final ZstackProtocolHandler handler = getProtocolHandler(networkManager); - ZstackUtilGetNvInfoSrsp nvInfo = ncp.getNvDeviceInfo(); - ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - ZstackSysVersionSrsp ncpVersion = getDongle(networkManager).getZstackNcp().getVersion(); - Set ncpCapabilities = ncp.pingNcp(); - int currentChannel = ncp.readChannel(); + ZstackUtilGetNvInfoSrsp nvInfo = handler.sendTransaction(new ZstackUtilGetNvInfoSreq(), ZstackUtilGetNvInfoSrsp.class); + ZstackUtilGetDeviceInfoSrsp deviceInfo = handler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); + ZstackSysVersionSrsp ncpVersion = handler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); + ZstackSysPingSrsp pingResponse = handler.sendTransaction(new ZstackSysPingSreq(), ZstackSysPingSrsp.class); + ZstackZdoExtNwkInfoSrsp networkInfo = handler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); + + final ZstackNcp ncp = new ZstackNcp(handler); int[] userDesc = ncp.readConfiguration(ZstackConfigId.ZCD_NV_USERDESC); int[] bdbDeviceOnNwk = ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); @@ -109,13 +116,21 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { out.println("Transport version : " + ncpVersion.getTransportRev()); } - if (ncpCapabilities == null) { + if (pingResponse == null) { out.println("NCP API Capabilities : ERROR"); } else { - out.println("NCP API Capabilities : " + ncpCapabilities); + out.println("NCP API Capabilities : " + pingResponse.getCapabilities()); + } + + if (networkInfo == null) { + out.println("NCP NWK Info : ERROR"); + } else { + out.println("NWK Info PanId : " + networkInfo.getPanId()); + out.println("NWK Info Extended PanId : " + networkInfo.getExtendedPanId()); + out.println("NWK Info Current Channel : " + networkInfo.getChannel()); + out.println("NWK Info NwkAddress : " + networkInfo.getShortAddress()); } - out.println("Current logical channel : " + ZigBeeChannel.create(currentChannel)); out.println("User Description : " + hex2String(userDesc)); } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index dd10a4f263..685c8c8729 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -109,7 +109,7 @@ protected PrintWriter getClassOut(File packageFile, String className) throws Fil final File classFile = new File(packageFile + File.separator + className + ".java"); System.out.println("Generating: " + classFile.getAbsolutePath()); final FileOutputStream fileOutputStream = new FileOutputStream(classFile, false); - return new PrintWriter(fileOutputStream); + return new PrintWriter(fileOutputStream, false, Charset.forName("UTF-8")); } protected void clearImports() { @@ -135,7 +135,7 @@ protected void outputCopywrite(PrintWriter out) { BufferedReader br; try { - br = new BufferedReader(new FileReader("pom.xml")); + br = new BufferedReader(new FileReader("pom.xml", Charset.forName("UTF-8"))); String line = br.readLine(); while (line != null) { if (line.contains("") && line.contains("")) { diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 5f74fe96de..18fcb10d5a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -45,9 +45,13 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; @@ -271,7 +275,7 @@ public ZigBeeStatus initialize() { } logger.debug("ZStack subsystem capabilities: {}", capabilities); - ZstackSysVersionSrsp version = ncp.getVersion(); + ZstackSysVersionSrsp version = protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); if (version == null) { return ZigBeeStatus.COMMUNICATION_ERROR; } @@ -288,7 +292,12 @@ public ZigBeeStatus initialize() { builder.append(version.getTransportRev()); versionString = builder.toString(); - ieeeAddress = ncp.getDeviceInfo().getIeeeAddress(); + final ZstackUtilGetDeviceInfoSrsp deviceInfo = protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); + if (deviceInfo == null) { + return ZigBeeStatus.COMMUNICATION_ERROR; + } + + ieeeAddress = deviceInfo.getIeeeAddress(); logger.debug("ZStack local IeeeAddress: {}", ieeeAddress); final int[] configurationIsOnANetwork = ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); @@ -301,7 +310,7 @@ public ZigBeeStatus initialize() { ZstackConfigId.ZCD_NV_PANID, ZstackConfigId.ZCD_NV_PRECFGKEY, ZstackConfigId.ZCD_NV_CHANLIST)); - logicalChannel = ZigBeeChannel.create(ncp.readChannel()); + logicalChannel = ncp.readChannelFromNV(); logger.debug("Current selected channel is configured as {}", logicalChannel); stackConfiguration.putAll(readConfiguration); @@ -327,7 +336,7 @@ public ZigBeeStatus startup(boolean reinitialize) { // If we want to reinitialize the network, then go... if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); - if (ncp.setStartupOptions(true, true) != ZstackResponseCode.SUCCESS) { + if (ncp.writeConfiguration(ZstackConfigId.ZCD_NV_STARTUP_OPTION, new int[] {0x03}) != ZstackResponseCode.SUCCESS) { logger.debug("ZStack Initialisation: Failed to set startup options"); return ZigBeeStatus.COMMUNICATION_ERROR; } @@ -455,6 +464,10 @@ public ZstackNcp getZstackNcp() { return new ZstackNcp(protocolHandler); } + public ZstackProtocolHandler getProtocolHandler() { + return protocolHandler; + } + @Override public IeeeAddress getIeeeAddress() { return ieeeAddress; @@ -480,10 +493,8 @@ public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { channelMask = channel.getMask(); } - ZstackNcp ncp = getZstackNcp(); - logicalChannel = channel; - stackConfiguration.put(ZstackConfigId.ZCD_NV_CHANLIST, ncp.valueFromUInt32(channelMask)); + stackConfiguration.put(ZstackConfigId.ZCD_NV_CHANLIST, valueFromUInt32(channelMask)); // setup zigbee channel return ZigBeeStatus.SUCCESS; @@ -502,7 +513,7 @@ public ZigBeeStatus setZigBeePanId(int panId) { if (networkStateUp) { return ZigBeeStatus.INVALID_STATE; } - stackConfiguration.put(ZstackConfigId.ZCD_NV_PANID, getZstackNcp().valueFromUInt16(panId)); + stackConfiguration.put(ZstackConfigId.ZCD_NV_PANID, valueFromUInt16(panId)); return ZigBeeStatus.SUCCESS; } @@ -544,8 +555,7 @@ public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] { 1 }); return ZigBeeStatus.SUCCESS; } else { - ZstackResponseCode response = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, - key.getValue()); + ZstackResponseCode response = ncp.setCentralisedKey(ZstackCentralizedLinkKeyMode.PROVIDED_APS_KEY, key.getValue()); if (response == ZstackResponseCode.SUCCESS) { linkKey = key; return ZigBeeStatus.SUCCESS; @@ -698,11 +708,11 @@ private void handleLinkStateChange(final boolean linkState) { networkStateUp = linkState; if (linkState) { - ZstackNcp ncp = getZstackNcp(); - nwkAddress = ncp.getNwkAddress(); - logicalChannel = ZigBeeChannel.create(ncp.readChannelCmd()); - ieeeAddress = ncp.getDeviceInfo().getIeeeAddress(); - // TODO: read back stuff nv? + final ZstackZdoExtNwkInfoSrsp response = protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); + + nwkAddress = response.getShortAddress(); + logicalChannel = ZigBeeChannel.create(response.getChannel()); + zigbeeTransportReceive.setTransportState(ZigBeeTransportState.ONLINE); } else { zigbeeTransportReceive.setTransportState(ZigBeeTransportState.OFFLINE); @@ -816,4 +826,12 @@ private ZigBeeStatus startNetwork() { return ZigBeeStatus.SUCCESS; } + + private int[] valueFromUInt16(int value) { + return new int[] { value & 0xFF, (value >> 8) & 0xFF }; + } + + private int[] valueFromUInt32(int value) { + return new int[] { value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF }; + } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index a9c35f0e56..f80db0c7b0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -16,23 +16,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.ZigBeeChannel; import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackCentralizedLinkKeyMode; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackInstallCodeFormat; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSreq; @@ -45,23 +38,12 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetReqAcmd; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; -import com.zsmartsystems.zigbee.security.ZigBeeKey; /** * This class provides utility methods for accessing the ZStack NCP and returning specific data for use in the @@ -76,12 +58,6 @@ public class ZstackNcp { */ private final Logger logger = LoggerFactory.getLogger(ZstackNcp.class); - /* - * Startup options bitmap - */ - private final int STARTOPT_CLEAR_CONFIG = 0x0001; - private final int STARTOPT_CLEAR_STATE = 0x0002; - /** * The protocol handler used to send and receive ZStack packets */ @@ -151,86 +127,6 @@ public Set pingNcp() { return capabilities; } - /** - * The command reads the version information from the stack - * - * @return the {@link ZstackSysVersionSrsp} - */ - public ZstackSysVersionSrsp getVersion() { - return protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); - } - - /** - * This command reads the network info from the device - * @return the {@link ZstackZdoExtNwkInfoSrsp} - */ - public ZstackZdoExtNwkInfoSrsp getNetworkInfo() { - return protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); - } - - /** - * The command reads the device information from the NCP - * - * @return the {@link ZstackUtilGetDeviceInfoSrsp} - */ - public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { - return protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); - } - - /** - * The command reads the non-volatile device information from the NCP - * - * @return the {@link ZstackUtilGetDeviceInfoSrsp} - */ - public ZstackUtilGetNvInfoSrsp getNvDeviceInfo() { - return protocolHandler.sendTransaction(new ZstackUtilGetNvInfoSreq(), ZstackUtilGetNvInfoSrsp.class); - } - - /** - * Gets the current network address of the NCP - * - * @return the 16 bit local network address of the NCP or -1 if there was an error - */ - public int getNwkAddress() { - ZstackUtilGetDeviceInfoSrsp info = getDeviceInfo(); - - return info == null ? -1 : info.getShortAddr(); - } - - /** - * Sets the startup options when the NCP starts. - *

    - * The CC2530-ZNP device has two kinds of information stored in non-volatile memory. The configuration parameters - * and network state information. - *

    - * The configuration parameters are configured by the user before start of ZigBee operation. The - * STARTOPT_CLEAR_CONFIG bit is read by the CC2530-ZNP device immediately when it powers up after a reset. - * When the configuration parameters are restored to defaults, the ZCD_NV_STARTUP_OPTION itself is not restored - * except for clearing the STARTOPT_CLEAR_CONFIG bit. - *

    - * The network state information is collected by the device after it joins a network and creates bindings etc. (at - * runtime). This is not set by the application processor. This information is stored so that if the device were to - * reset accidentally, it can restore itself without going through all the network joining and binding process - * again. - *

    - * If the application processor does not wish to continue operating in the previous ZigBee network, it needs to - * instruct the CC2530-ZNP device to clear the network state information and start again based on the configuration - * parameters. This is done by setting the STARTOPT_CLEAR_STATE bit in the startup option. - * - * @param clearConfig STARTOPT_CLEAR_CONFIG – If this option is set, the device will overwrite all the configuration - * parameters (except this one) with the “default” values that it is programmed with. This is used to - * erase the existing configuration and bring the device into a known state. - * @param clearState STARTOPT_CLEAR_STATE – If this option is set, the device will clear its previous network state - * (which would exist if the device had been operating on a network prior to the reset). This is - * typically used during application development. During regular device operation, this flag is typically - * not set, so that an accidental device reset will not cause loss of network state. - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode setStartupOptions(boolean clearConfig, boolean clearState) { - int optionVal = (clearConfig ? STARTOPT_CLEAR_CONFIG : 0) + (clearState ? STARTOPT_CLEAR_STATE : 0); - return writeConfiguration(ZstackConfigId.ZCD_NV_STARTUP_OPTION, valueFromUInt8(optionVal)); - } - /** * Reads a configuration parameter from the NCP * @@ -273,7 +169,10 @@ public ZstackResponseCode writeConfiguration(ZstackConfigId configId, int[] valu return response.getStatus(); } - public int readChannel() { + /** + * Reads the current logical channel from non volatile memory. It is in the configuration ID for the NIB. + */ + public ZigBeeChannel readChannelFromNV() { ZstackSysNvReadSreq request = new ZstackSysNvReadSreq(); request.setSysId(1); request.setItemId(0); @@ -282,44 +181,10 @@ public int readChannel() { request.setLength(1); ZstackSysNvReadSrsp response = protocolHandler.sendTransaction(request, ZstackSysNvReadSrsp.class); if (response == null || response.getValue() == null || response.getValue().length == 0) { - return -1; + return ZigBeeChannel.UNKNOWN; } else { - return response.getValue()[0]; - } - } - - public int readChannelCmd() { - ZstackZdoExtNwkInfoSrsp networkInfo = getNetworkInfo(); - - return networkInfo == null ? -1 : networkInfo.getChannel(); - } - - /** - * Gets the network key. - * - * @return the {@link ZigBeeKey} returned from the NCP or null on error - */ - public ZigBeeKey getNetworkKey() { - int[] response = readConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY); - if (response == null) { - return null; + return ZigBeeChannel.create(response.getValue()[0]); } - - return new ZigBeeKey(response); - } - - /** - * Sets the transmit power to be used in the NCP - * - * @param txPower the TX power in dBm - * @return the power returned from the NCP on success or null on error - */ - public ZstackResponseCode setTxPower(int txPower) { - ZstackSysSetTxPowerSreq request = new ZstackSysSetTxPowerSreq(); - request.setTxPower(txPower); - ZstackSysSetTxPowerSrsp response = protocolHandler.sendTransaction(request, ZstackSysSetTxPowerSrsp.class); - - return response == null ? null : response.getStatus(); } /** @@ -354,22 +219,6 @@ public ZstackResponseCode startupApplication() { return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } - /** - * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. - *

    - * APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE - * - * @param required true if the TCLK exchange procedure is required. - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode requireKeyExchange(boolean required) { - ZstackAppCnfBdbSetTcRequireKeyExchangeSreq request = new ZstackAppCnfBdbSetTcRequireKeyExchangeSreq(); - request.setTrustCenterRequireKeyExchange(required); - ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); - - return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); - } - /** * Sets the policy to mandate or not the usage of an Install Code upon joining. *

    @@ -388,22 +237,6 @@ public ZstackResponseCode setCentralisedKey(ZstackCentralizedLinkKeyMode mode, i return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } - /** - * Sets the AllowRejoin TC policy. - *

    - * APP_CNF_SET_ALLOWREJOIN_TC_POLICY - * - * @param allow true to allow rejoins - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode allowRejoin(boolean allow) { - ZstackAppCnfSetAllowrejoinTcPolicySreq request = new ZstackAppCnfSetAllowrejoinTcPolicySreq(); - request.setAllowRejoin(allow); - ZstackAppCnfSetAllowrejoinTcPolicySrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); - - return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); - } - /** * Registers for a ZDO callback * @@ -441,38 +274,4 @@ public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileI return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } - - /** - * Adds an install code to the NCP. The code must be a ZigBee key - ie not the install code itself. - * - * @param ieeeAddress the {@link IeeeAddress} associated with the key - * @param key the {@link ZigBeeKey} to set - * @return {@link ZstackResponseCode} returned from the NCP - */ - public ZstackResponseCode addInstallCode(IeeeAddress ieeeAddress, ZigBeeKey key) { - ZstackAppCnfBdbAddInstallcodeSreq request = new ZstackAppCnfBdbAddInstallcodeSreq(); - request.setInstallCodeFormat(ZstackInstallCodeFormat.DERIVED_KEY); - request.setIeeeAddress(ieeeAddress); - request.setInstallCode(key); - - ZstackAppCnfBdbAddInstallcodeSrsp response = protocolHandler.sendTransaction(request, ZstackAppCnfBdbAddInstallcodeSrsp.class); - - return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); - } - - public int[] valueFromBoolean(boolean value) { - return new int[] { value ? 1 : 0 }; - } - - public int[] valueFromUInt8(int value) { - return new int[] { value }; - } - - public int[] valueFromUInt16(int value) { - return new int[] { value & 0xFF, (value >> 8) & 0xFF }; - } - - public int[] valueFromUInt32(int value) { - return new int[] { value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF }; - } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index 998a0f0c13..d53716698e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -27,7 +27,7 @@ public enum AfDataOptions { AF_ACK_REQUEST(0x0010), /** - * Set this bit to force route discovery if a routing table entry doesnt exist + * Set this bit to force route discovery if a routing table entry doesn’t exist */ AF_DISCV_ROUTE(0x0020), diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java index 47c14c45b5..e0680b3c9c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -15,8 +15,8 @@ *

    * This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a * AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status - * of whether the APS acknowledgement was received or not (ZApsNoAck 0xb7). If APS acknowledgement was not used, then the confirm - * carries the status of whether the MAC acknowledgement (next hop acknowledgment) was received or not (ZMacNoACK 0xe9). This + * of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm + * carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This * also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of * the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS * acknowledgement is received. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index 6e715774a3..f9941b60b4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -13,7 +13,7 @@ /** * Class to implement the Z-Stack command AF_REGISTER. *

    - * This command enables the host processor to register an applications endpoint description (and its simple descriptor). + * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint * description per application profile. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java index c714969bf3..4d9a261d27 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -13,7 +13,7 @@ /** * Class to implement the Z-Stack command AF_REGISTER. *

    - * This command enables the host processor to register an applications endpoint description (and its simple descriptor). + * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint * description per application profile. diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java index be1c7a72c8..664318705a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -38,7 +38,7 @@ public class ZstackSbHandshakeCmdSrsp extends ZstackFrameResponse { private int bufferLength; /** - * 0x800 CC2538 flash page size + * 0x800 – CC2538 flash page size */ private int pageSize; @@ -132,7 +132,7 @@ public void setBufferLength(int bufferLength) { } /** - * 0x800 CC2538 flash page size + * 0x800 – CC2538 flash page size * * @return the current pageSize as {@link int} */ @@ -141,7 +141,7 @@ public int getPageSize() { } /** - * 0x800 CC2538 flash page size + * 0x800 – CC2538 flash page size * * @param pageSize the PageSize to set as {@link int} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index 1296209220..962e6ae573 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -345,8 +345,8 @@ public enum ZstackConfigId { * If security functionality is enabled, there are two options to distribute the security key to all devices in the network. If this * parameter is true, the same security key is assumed to be pre-configured in all devices in the network.If it is set to false, then * the key only needs to be configured on the coordinator device. In this case, the key is distributed to each device upon joining by - * the coordinator. This key distribution will happen in the clear on the last hop of the packet transmission and this - * constitutes a brief period of vulnerability during which a malicious device can capture the key. Hence it is not recommended + * the coordinator. This key distribution will happen in the “clear” on the last hop of the packet transmission and this + * constitutes a brief “period of vulnerability” during which a malicious device can capture the key. Hence it is not recommended * unless it can be ensured that there are no malicious devices in the vicinity at the time of network formation. *

    * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 1 byte; @@ -454,7 +454,7 @@ public enum ZstackConfigId { /** * An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it can easily identified or * described later. The first byte is the length of the user descriptor data and must not be greater than 16. Size: 17 bytes; Default - * value: CC2530-ZNP x...... (dots represent the device IEEE address) + * value: “CC2530-ZNP x......” (dots represent the device IEEE address) */ ZCD_NV_USERDESC(0x0081), @@ -465,7 +465,7 @@ public enum ZstackConfigId { /** * This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. Networks that exist in the same - * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate dont care. Size: + * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate “don’t care”. Size: * 2 bytes; Default value: 0xFFFF */ ZCD_NV_PANID(0x0083), @@ -509,7 +509,7 @@ public enum ZstackConfigId { * This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the host processor. By * default, this item is set to FALSE, which means that the host processor must use the ZDO_MSG_CB_REGISTER command to subscribe to * a specific ZDO callback in order to receive it. The ZDO callback is then conveyed as part of the ZDO_MSG_CB_INCOMING command. If - * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the verbose response. For example, the host + * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the “verbose” response. For example, the host * processor would receive the ZDO_IEEE_ADDR_RSP command in response to ZDO_IEEE_ADDR_REQ. Size: 1 byte; Default value: FALSE */ ZCD_NV_ZDO_DIRECT_CB(0x008F), diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java index d9f9b1928f..2faec3ff5d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -22,7 +22,7 @@ public class ZstackSysGetExtAddrSrsp extends ZstackFrameResponse { /** - * The devices extended address. + * The device’s extended address. */ private IeeeAddress extAddress; @@ -40,7 +40,7 @@ public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { } /** - * The devices extended address. + * The device’s extended address. * * @return the current extAddress as {@link IeeeAddress} */ @@ -49,7 +49,7 @@ public IeeeAddress getExtAddress() { } /** - * The devices extended address. + * The device’s extended address. * * @param extAddress the ExtAddress to set as {@link IeeeAddress} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java index a4a993ab57..ff18f9a06a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -23,7 +23,7 @@ public class ZstackSysSetExtAddrSreq extends ZstackFrameRequest { /** - * The devices extended address. + * The device’s extended address. */ private IeeeAddress extAddress; @@ -35,7 +35,7 @@ public ZstackSysSetExtAddrSreq() { } /** - * The devices extended address. + * The device’s extended address. * * @return the current extAddress as {@link IeeeAddress} */ @@ -44,7 +44,7 @@ public IeeeAddress getExtAddress() { } /** - * The devices extended address. + * The device’s extended address. * * @param extAddress the ExtAddress to set as {@link IeeeAddress} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java index 6422ea226f..0c9f880305 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -14,7 +14,7 @@ * Class to implement the Z-Stack command SYS_SET_TX_POWER. *

    * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio nearest characterized value for the specific radio. + * applied to the radio – nearest characterized value for the specific radio. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java index bd54a60678..2c5dee61b1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -14,7 +14,7 @@ * Class to implement the Z-Stack command SYS_SET_TX_POWER. *

    * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio nearest characterized value for the specific radio. + * applied to the radio – nearest characterized value for the specific radio. *

    * Note that this code is autogenerated. Manual changes may be overwritten. * diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java index a779a2847c..2cf9f4dc11 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -23,7 +23,7 @@ public class ZstackSysZdiagsClearStatsSreq extends ZstackFrameRequest { /** - * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. */ private boolean clearNv; @@ -35,7 +35,7 @@ public ZstackSysZdiagsClearStatsSreq() { } /** - * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. * * @return the current clearNv as {@link boolean} */ @@ -44,7 +44,7 @@ public boolean getClearNV() { } /** - * TRUE Clears statistics in NV memory including Boot Counter. FALSE Clears statistics in RAM only. Boot Counter is preserved. + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. * * @param clearNv the clearNV to set as {@link boolean} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java index 7b29691e6c..8110706066 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -24,7 +24,7 @@ public class ZstackZdoGetLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. */ private ZstackResponseCode status; @@ -54,7 +54,7 @@ public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. * * @return the current status as {@link ZstackResponseCode} */ @@ -63,7 +63,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java index 29593a4e96..b3363d9819 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -36,7 +36,7 @@ public class ZstackZdoMsgCbIncomingAreq extends ZstackFrameResponse { private int clusterId; /** - * N/A not used. + * N/A – not used. */ private boolean securityUse; @@ -127,7 +127,7 @@ public void setClusterId(int clusterId) { } /** - * N/A not used. + * N/A – not used. * * @return the current securityUse as {@link boolean} */ @@ -136,7 +136,7 @@ public boolean getSecurityUse() { } /** - * N/A not used. + * N/A – not used. * * @param securityUse the SecurityUse to set as {@link boolean} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java index 63d6c49ad5..33d473fe16 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoMsgCbRegisterSrsp extends ZstackFrameResponse { /** - * 0x00 Success. + * 0x00 – Success. */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { } /** - * 0x00 Success. + * 0x00 – Success. * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 Success. + * 0x00 – Success. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java index 1a9852ed8e..dba377b8c8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoRemoveLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 Success. 0xC8 Unknown device. + * 0x00 – Success. 0xC8 – Unknown device. * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java index cfcbaf1287..53f9591fd1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -22,7 +22,7 @@ public class ZstackZdoSetLinkKeySrsp extends ZstackFrameResponse { /** - * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full */ private ZstackResponseCode status; @@ -40,7 +40,7 @@ public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { } /** - * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full * * @return the current status as {@link ZstackResponseCode} */ @@ -49,7 +49,7 @@ public ZstackResponseCode getStatus() { } /** - * 0x00 Success. 0x01 Fail to add to address manager. 0x11 Security manager key table full + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full * * @param status the Status to set as {@link ZstackResponseCode} */ diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java index 300d278a92..b36fd55188 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -22,8 +22,6 @@ import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; @@ -102,41 +100,41 @@ public void getDeviceInfo() { Mockito.when(response.getDeviceState()).thenReturn(ZstackZdoState.DEV_INIT); Mockito.when(response.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF")); Mockito.when(response.getShortAddr()).thenReturn(0x1234); - ZstackNcp ncp = getZstackNcp(response); + // ZstackNcp ncp = getZstackNcp(response); - ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - System.out.println("Device info returned " + deviceInfo); + // ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); + // System.out.println("Device info returned " + deviceInfo); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackUtilGetDeviceInfoSrsp.class); - assertEquals(0x1234, deviceInfo.getShortAddr()); - assertEquals(new IeeeAddress("1234567890ABCDEF"), deviceInfo.getIeeeAddress()); + // Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackUtilGetDeviceInfoSrsp.class); + // assertEquals(0x1234, deviceInfo.getShortAddr()); + // assertEquals(new IeeeAddress("1234567890ABCDEF"), deviceInfo.getIeeeAddress()); ZstackFrameRequest request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackUtilGetDeviceInfoSreq); - assertEquals(0x1234, ncp.getNwkAddress()); - assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getDeviceInfo().getIeeeAddress()); + // assertEquals(0x1234, ncp.getNwkAddress()); + // assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getDeviceInfo().getIeeeAddress()); } - @Test - public void setStartupOptions() { - ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackZbWriteConfigurationSrsp.class)); + // @Test + // public void setStartupOptions() { + // ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackZbWriteConfigurationSrsp.class)); - ncp.setStartupOptions(false, false); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); + // ncp.setStartupOptions(false, false); + // Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + // assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - ncp.setStartupOptions(true, false); - Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); + // ncp.setStartupOptions(true, false); + // Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + // assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - ncp.setStartupOptions(false, true); - Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); + // ncp.setStartupOptions(false, true); + // Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + // assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - ncp.setStartupOptions(true, true); - Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - } + // ncp.setStartupOptions(true, true); + // Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); + // assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); + // } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index 0d547064ad..05e7b1b300 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -64,7 +64,7 @@ public void testEzspStackStatusHandler() throws Exception { ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); - Mockito.when(ncp.getNwkAddress()).thenReturn(1243); + // Mockito.when(ncp.getNwkAddress()).thenReturn(1243); ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null) { @Override public ZstackNcp getZstackNcp() { @@ -104,8 +104,8 @@ public void setZigBeeChannel() { public void testEzspMessageSentHandler() throws Exception { ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); - final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); - Mockito.when(ncp.getNwkAddress()).thenReturn(1243); + // final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); + // Mockito.when(ncp.getNwkAddress()).thenReturn(1243); ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); dongle.setZigBeeTransportReceive(transport); From 32ba22c6ad5b64775f3e661515cf68168bd3334e Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sun, 30 Oct 2022 21:19:38 +0100 Subject: [PATCH 26/33] Tests updated --- .../dongle/zstack/ZigBeeDongleZstack.java | 92 +++-- .../zigbee/dongle/zstack/ZstackNcp.java | 18 + .../zigbee/dongle/zstack/ZStackNcpTest.java | 116 ++---- .../dongle/zstack/ZigBeeDongleZstackTest.java | 387 ++++++++++++------ .../internal/ZstackProtocolHandlerTest.java | 64 +-- .../zigbee/ZigBeeChannelMask.java | 16 + 6 files changed, 384 insertions(+), 309 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java index 18fcb10d5a..e23f6262a9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstack.java @@ -45,19 +45,16 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackStackConfiguration; -import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.TransportConfig; import com.zsmartsystems.zigbee.transport.TransportConfigOption; @@ -121,12 +118,17 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { /** * The serial port used to connect to the dongle */ - private ZigBeePort serialPort; + private final ZigBeePort serialPort; /** * The protocol handler used to send and receive ZStack packets */ - private ZstackProtocolHandler protocolHandler; + private final ZstackProtocolHandler protocolHandler; + + /** + * The NCP is used for convenient access to the protocol handler + */ + private final ZstackNcp ncp; /** * The stack configuration we need for the NCP @@ -202,7 +204,7 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { * The rate at which we will do a status poll if we've not sent any other * messages within this period */ - private int pollRate = 100000; + private int pollRate = 10000; /** * The time the last command was sent from the {@link ZigBeeNetworkManager}. @@ -220,12 +222,14 @@ public class ZigBeeDongleZstack implements ZigBeeTransportTransmit { public ZigBeeDongleZstack(final ZigBeePort serialPort) { this.serialPort = serialPort; + this.protocolHandler = new ZstackProtocolHandler(); + this.ncp = new ZstackNcp(protocolHandler); + // Define the default configuration stackConfiguration = new LinkedHashMap<>(); stackConfiguration.put(ZstackConfigId.ZCD_NV_ZDO_DIRECT_CB, new int[] { 0x00 }); stackConfiguration.put(ZstackConfigId.ZCD_NV_PRECFGKEYS_ENABLE, new int[] { 0x01 }); - stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] { 0x01 }); } @Override @@ -260,11 +264,8 @@ public ZigBeeStatus initialize() { return ZigBeeStatus.COMMUNICATION_ERROR; } - protocolHandler = new ZstackProtocolHandler(); protocolHandler.start(serialPort); - ZstackNcp ncp = getZstackNcp(); - Set capabilities = ncp.pingNcp(); if (capabilities.isEmpty()) { if (ncp.resetNcp(ZstackResetType.TARGET_DEVICE) == null) { @@ -275,10 +276,11 @@ public ZigBeeStatus initialize() { } logger.debug("ZStack subsystem capabilities: {}", capabilities); - ZstackSysVersionSrsp version = protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); + ZstackSysVersionSrsp version = ncp.getVersion(); if (version == null) { return ZigBeeStatus.COMMUNICATION_ERROR; } + StringBuilder builder = new StringBuilder(); builder.append("Software="); builder.append(version.getMajorRel()); @@ -292,7 +294,7 @@ public ZigBeeStatus initialize() { builder.append(version.getTransportRev()); versionString = builder.toString(); - final ZstackUtilGetDeviceInfoSrsp deviceInfo = protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); + final ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); if (deviceInfo == null) { return ZigBeeStatus.COMMUNICATION_ERROR; } @@ -309,7 +311,8 @@ public ZigBeeStatus initialize() { ZstackConfigId.ZCD_NV_EXTPANID, ZstackConfigId.ZCD_NV_PANID, ZstackConfigId.ZCD_NV_PRECFGKEY, - ZstackConfigId.ZCD_NV_CHANLIST)); + ZstackConfigId.ZCD_NV_CHANLIST, + ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK)); logicalChannel = ncp.readChannelFromNV(); logger.debug("Current selected channel is configured as {}", logicalChannel); @@ -331,8 +334,6 @@ public ZigBeeStatus startup(boolean reinitialize) { return ZigBeeStatus.INVALID_STATE; } - ZstackNcp ncp = getZstackNcp(); - // If we want to reinitialize the network, then go... if (reinitialize) { logger.debug("Reinitialising ZStack NCP network."); @@ -406,17 +407,13 @@ public ZigBeeStatus startup(boolean reinitialize) { new int[] {}, new int[] {}); if (!initialised) { - if (!configureListeners()) { - return ZigBeeStatus.FAILURE; - } + configureListeners(); } // Configure channel - int[] channelList = stackConfiguration.get(ZstackConfigId.ZCD_NV_CHANLIST); + final int[] channelList = stackConfiguration.get(ZstackConfigId.ZCD_NV_CHANLIST); if (channelList != null && channelList.length == 4) { - final ZstackDeserializer deserializer = new ZstackDeserializer(channelList); - int channelMask = deserializer.deserializeUInt32(); - ncp.setChannelMask(new ZigBeeChannelMask(channelMask)); + ncp.setChannelMask(new ZigBeeChannelMask(valueToUint32(channelList))); } else { ncp.setChannelMask(new ZigBeeChannelMask(ZigBeeChannelMask.CHANNEL_MASK_2GHZ)); } @@ -452,7 +449,6 @@ public void shutdown() { serialPort.close(); protocolHandler.close(); handleLinkStateChange(false); - protocolHandler = null; } /** @@ -461,9 +457,14 @@ public void shutdown() { * @return an instance of the {@link ZstackNcp} */ public ZstackNcp getZstackNcp() { - return new ZstackNcp(protocolHandler); + return ncp; } + /** + * Returns the protocolHandler in use for the dongle + * + * @return an in stance of the {@link ZstackProtocolHandler} + */ public ZstackProtocolHandler getProtocolHandler() { return protocolHandler; } @@ -489,8 +490,10 @@ public ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel) { if (ZigBeeChannel.UNKNOWN == channel) { // use scan over all masks channelMask = ZigBeeChannelMask.CHANNEL_MASK_2GHZ; - } else { + } else if ((ZigBeeChannelMask.CHANNEL_MASK_2GHZ & channel.getMask()) > 0) { channelMask = channel.getMask(); + } else { + return ZigBeeStatus.INVALID_ARGUMENTS; } logicalChannel = channel; @@ -519,7 +522,12 @@ public ZigBeeStatus setZigBeePanId(int panId) { @Override public ExtendedPanId getZigBeeExtendedPanId() { - return new ExtendedPanId(stackConfiguration.get(ZstackConfigId.ZCD_NV_EXTPANID)); + final int[] extPanIdValue = stackConfiguration.get(ZstackConfigId.ZCD_NV_EXTPANID); + if (extPanIdValue == null || extPanIdValue.length != 8) { + return null; + } else { + return new ExtendedPanId(extPanIdValue); + } } @Override @@ -543,13 +551,16 @@ public ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key) { @Override public ZigBeeKey getZigBeeNetworkKey() { - return new ZigBeeKey(stackConfiguration.get(ZstackConfigId.ZCD_NV_PRECFGKEY)); + final int[] key = stackConfiguration.get(ZstackConfigId.ZCD_NV_PRECFGKEY); + if (key == null || key.length != 16) { + return null; + } else { + return new ZigBeeKey(stackConfiguration.get(ZstackConfigId.ZCD_NV_PRECFGKEY)); + } } @Override public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { - ZstackNcp ncp = getZstackNcp(); - if (DEFAULT_TCLK.equals(key)) { // use default key stackConfiguration.put(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK, new int[] { 1 }); @@ -568,7 +579,9 @@ public ZigBeeStatus setTcLinkKey(ZigBeeKey key) { @Override public ZigBeeKey getTcLinkKey() { final int[] useDefault = stackConfiguration.get(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK); - if (useDefault != null && useDefault[0] != 0) { + if (useDefault == null) { + return null; + } else if (useDefault[0] != 0) { return DEFAULT_TCLK; } else if (linkKey != null) { return linkKey; @@ -689,7 +702,10 @@ public void run() { return; } // Don't wait for the response. This is running in a single thread scheduler - protocolHandler.queueFrame(new ZstackUtilGetDeviceInfoSreq()); + final ZstackUtilGetDeviceInfoSrsp response = ncp.getDeviceInfo(); + if (response == null || response.getStatus() != ZstackResponseCode.SUCCESS || ZstackZdoState.DEV_ZB_COORD != response.getDeviceState()) { + handleLinkStateChange(false); + } } }, pollRate, pollRate, TimeUnit.MILLISECONDS); } @@ -708,7 +724,7 @@ private void handleLinkStateChange(final boolean linkState) { networkStateUp = linkState; if (linkState) { - final ZstackZdoExtNwkInfoSrsp response = protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); + final ZstackZdoExtNwkInfoSrsp response = ncp.getNetworkInfo(); nwkAddress = response.getShortAddress(); logicalChannel = ZigBeeChannel.create(response.getChannel()); @@ -719,7 +735,7 @@ private void handleLinkStateChange(final boolean linkState) { } } - private boolean configureListeners() { + private void configureListeners() { // setup listeners protocolHandler.listener(ZstackAfIncomingMsgAreq.class, response -> { logger.debug("Zstack incoming message"); @@ -785,8 +801,6 @@ private boolean configureListeners() { handleLinkStateChange(false); startup(false); }); - - return true; } /** @@ -797,8 +811,6 @@ private boolean configureListeners() { */ private ZigBeeStatus startNetwork() { logger.debug("ZStack starting network"); - ZstackNcp ncp = getZstackNcp(); - final Future networkUpFuture = protocolHandler .waitForEvent(ZstackZdoStateChangeIndAreq.class, response -> { switch (response.getState()) { @@ -834,4 +846,8 @@ private int[] valueFromUInt16(int value) { private int[] valueFromUInt32(int value) { return new int[] { value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF }; } + + private int valueToUint32(int[] buffer) { + return buffer[0] + (buffer[1] << 8) + (buffer[2] << 16) + (buffer[3] << 24); + } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java index f80db0c7b0..0a624106ff 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/ZstackNcp.java @@ -38,7 +38,13 @@ import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetReqAcmd; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSreq; @@ -274,4 +280,16 @@ public ZstackResponseCode addEndpoint(int endpointId, int deviceId, int profileI return response == null ? ZstackResponseCode.FAILURE : response.getStatus(); } + + public ZstackSysVersionSrsp getVersion() { + return protocolHandler.sendTransaction(new ZstackSysVersionSreq(), ZstackSysVersionSrsp.class); + } + + public ZstackUtilGetDeviceInfoSrsp getDeviceInfo() { + return protocolHandler.sendTransaction(new ZstackUtilGetDeviceInfoSreq(), ZstackUtilGetDeviceInfoSrsp.class); + } + + public ZstackZdoExtNwkInfoSrsp getNetworkInfo() { + return protocolHandler.sendTransaction(new ZstackZdoExtNwkInfoSreq(), ZstackZdoExtNwkInfoSrsp.class); + } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java index b36fd55188..84c4c63f13 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZStackNcpTest.java @@ -7,30 +7,29 @@ */ package com.zsmartsystems.zigbee.dongle.zstack; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.sameInstance; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetReqAcmd; import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; /** @@ -39,102 +38,49 @@ * */ public class ZStackNcpTest { - private ArgumentCaptor transactionCapture = ArgumentCaptor.forClass(ZstackFrameRequest.class); - private ZstackProtocolHandler handler; + private final ArgumentCaptor transactionCapture = ArgumentCaptor.forClass(ZstackFrameRequest.class); + private final ZstackProtocolHandler handler = Mockito.mock(ZstackProtocolHandler.class); - private ZstackNcp getZstackNcp(ZstackFrameResponse response) { - handler = Mockito.mock(ZstackProtocolHandler.class); - ZstackNcp ncp = new ZstackNcp(handler); - - Mockito.doAnswer(new Answer() { - @Override - public ZstackFrameResponse answer(InvocationOnMock invocation) { - return response; - } - }).when(handler).sendTransaction(ArgumentMatchers.any(ZstackFrameRequest.class), ArgumentMatchers.eq(response.getClass())); - - return ncp; - } + private final ZstackNcp ncp = new ZstackNcp(handler); @Test - public void resetNcp() { - ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackSysResetIndAreq.class)); + public void resetNcp() throws InterruptedException, ExecutionException { + final Future future = Mockito.mock(Future.class); - ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackSysResetIndAreq.class); + final ZstackSysResetIndAreq resetEvent = new ZstackSysResetIndAreq(new int[] {0, 0, 1, 0, 0, 0, 0, 0}); + when(future.get()) + .thenReturn(resetEvent); + when(handler.waitForEvent(Mockito.eq(ZstackSysResetIndAreq.class), Mockito.any())) + .thenReturn(future); - ZstackFrameRequest request = transactionCapture.getValue(); - System.out.println(request); - assertTrue(request instanceof ZstackSysResetReqAcmd); - assertEquals(ZstackResetType.SERIAL_BOOTLOADER, ((ZstackSysResetReqAcmd) request).getType()); + ZstackSysResetIndAreq result = ncp.resetNcp(ZstackResetType.SERIAL_BOOTLOADER); - ncp.resetNcp(ZstackResetType.TARGET_DEVICE); - Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackSysResetIndAreq.class); + Mockito.verify(handler).waitForEvent(Mockito.eq(ZstackSysResetIndAreq.class), Mockito.any()); + Mockito.verify(handler).queueFrame(transactionCapture.capture()); + Mockito.verify(future).get(); + Mockito.verifyNoMoreInteractions(handler, future); - request = transactionCapture.getValue(); - System.out.println(request); - assertTrue(request instanceof ZstackSysResetReqAcmd); - assertEquals(ZstackResetType.TARGET_DEVICE, ((ZstackSysResetReqAcmd) request).getType()); + ZstackFrameRequest request = transactionCapture.getValue(); + assertThat(request, is(instanceOf(ZstackSysResetReqAcmd.class))); + assertThat(((ZstackSysResetReqAcmd) request).getType(), is(ZstackResetType.SERIAL_BOOTLOADER)); + assertThat(result, is(sameInstance(resetEvent))); } @Test public void pingNcp() { ZstackSysPingSrsp response = Mockito.mock(ZstackSysPingSrsp.class); - Mockito.when(response.getCapabilities()).thenReturn(0x17D); - ZstackNcp ncp = getZstackNcp(response); + Mockito.when(response.getCapabilities()) + .thenReturn(0x17D); + Mockito.when(handler.sendTransaction(transactionCapture.capture(), Mockito.eq(ZstackSysPingSrsp.class))) + .thenReturn(response); Set capabilities = ncp.pingNcp(); - System.out.println("Capabilities returned " + capabilities); - Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackSysPingSrsp.class); + Mockito.verify(handler).sendTransaction(transactionCapture.capture(), Mockito.eq(ZstackSysPingSrsp.class)); ZstackFrameRequest request = transactionCapture.getValue(); System.out.println(request); assertTrue(request instanceof ZstackSysPingSreq); assertEquals(7, capabilities.size()); } - - @Test - public void getDeviceInfo() { - ZstackUtilGetDeviceInfoSrsp response = Mockito.mock(ZstackUtilGetDeviceInfoSrsp.class); - Mockito.when(response.getDeviceState()).thenReturn(ZstackZdoState.DEV_INIT); - Mockito.when(response.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF")); - Mockito.when(response.getShortAddr()).thenReturn(0x1234); - // ZstackNcp ncp = getZstackNcp(response); - - // ZstackUtilGetDeviceInfoSrsp deviceInfo = ncp.getDeviceInfo(); - // System.out.println("Device info returned " + deviceInfo); - - // Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackUtilGetDeviceInfoSrsp.class); - // assertEquals(0x1234, deviceInfo.getShortAddr()); - // assertEquals(new IeeeAddress("1234567890ABCDEF"), deviceInfo.getIeeeAddress()); - - ZstackFrameRequest request = transactionCapture.getValue(); - System.out.println(request); - assertTrue(request instanceof ZstackUtilGetDeviceInfoSreq); - - // assertEquals(0x1234, ncp.getNwkAddress()); - // assertEquals(new IeeeAddress("1234567890ABCDEF"), ncp.getDeviceInfo().getIeeeAddress()); - } - - // @Test - // public void setStartupOptions() { - // ZstackNcp ncp = getZstackNcp(Mockito.mock(ZstackZbWriteConfigurationSrsp.class)); - - // ncp.setStartupOptions(false, false); - // Mockito.verify(handler, Mockito.times(1)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - // assertEquals(0, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - - // ncp.setStartupOptions(true, false); - // Mockito.verify(handler, Mockito.times(2)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - // assertEquals(1, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - - // ncp.setStartupOptions(false, true); - // Mockito.verify(handler, Mockito.times(3)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - // assertEquals(2, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - - // ncp.setStartupOptions(true, true); - // Mockito.verify(handler, Mockito.times(4)).sendTransaction(transactionCapture.capture(), ZstackZbWriteConfigurationSrsp.class); - // assertEquals(3, ((ZstackZbWriteConfigurationSreq) transactionCapture.getValue()).getValue()[0]); - // } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java index 05e7b1b300..25f0ecc559 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/ZigBeeDongleZstackTest.java @@ -7,32 +7,45 @@ */ package com.zsmartsystems.zigbee.dongle.zstack; -import static org.junit.Assert.assertEquals; - -import java.util.concurrent.Executors; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import org.junit.Before; import org.junit.Test; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import com.zsmartsystems.zigbee.ExtendedPanId; +import com.zsmartsystems.zigbee.IeeeAddress; import com.zsmartsystems.zigbee.TestUtilities; import com.zsmartsystems.zigbee.ZigBeeChannel; +import com.zsmartsystems.zigbee.ZigBeeChannelMask; import com.zsmartsystems.zigbee.ZigBeeNwkAddressMode; import com.zsmartsystems.zigbee.ZigBeeProfileType; import com.zsmartsystems.zigbee.ZigBeeStatus; import com.zsmartsystems.zigbee.aps.ZigBeeApsFrame; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackResetType; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSystemCapabilities; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; import com.zsmartsystems.zigbee.dongle.zstack.internal.ZstackProtocolHandler; +import com.zsmartsystems.zigbee.security.ZigBeeKey; import com.zsmartsystems.zigbee.transport.ZigBeePort; -import com.zsmartsystems.zigbee.transport.ZigBeeTransportProgressState; import com.zsmartsystems.zigbee.transport.ZigBeeTransportReceive; import com.zsmartsystems.zigbee.transport.ZigBeeTransportState; @@ -43,99 +56,252 @@ * */ public class ZigBeeDongleZstackTest { - private static int TIMEOUT = 5000; - - @Test - public void setZigBeeExtendedPanId() { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + private final ZigBeePort port = Mockito.mock(ZigBeePort.class); + private final ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); + private final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); + private final ZstackProtocolHandler protocolHandler = Mockito.mock(ZstackProtocolHandler.class); + private final ScheduledExecutorService executorService = Mockito.mock(ScheduledExecutorService.class); + + private final ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(port); + + @Before + public void beforeTest() throws Exception { + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "protocolHandler", protocolHandler); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "ncp", ncp); + TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); - dongle.setZigBeeExtendedPanId(new ExtendedPanId("123456789abcdef")); + dongle.setZigBeeTransportReceive(transport); } @Test - public void setZigBeePanId() { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - - dongle.setZigBeePanId(0x1234); + public void testInitialize() { + when(port.open()).thenReturn(true); + + when(ncp.pingNcp()).thenReturn(Collections.singleton(ZstackSystemCapabilities.MT_CAP_AF)); + + final ZstackSysVersionSrsp version = new ZstackSysVersionSrsp(new int[] { + 0, 0, + 1, 2, 3, 4, 5 + }); + when(ncp.getVersion()).thenReturn(version); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK)).thenReturn(new int[] {0}); + + final ZstackUtilGetDeviceInfoSrsp deviceInfo = new ZstackUtilGetDeviceInfoSrsp(new int[] { + 0, 0, + 0, + 2, 3, 4, 5, 6, 7, 8, 9, + 0, 0, + 7, + 0, + 0 + }); + when(ncp.getDeviceInfo()).thenReturn(deviceInfo); + + assertThat(dongle.initialize(), is(ZigBeeStatus.SUCCESS)); + + assertThat(dongle.getVersionString(), is("Software=3.4.5 Product=2 Transport=1")); + assertThat(dongle.getIeeeAddress(), is(new IeeeAddress(new int[] {2, 3, 4, 5, 6, 7, 8, 9}))); + assertThat(dongle.getNwkAddress(), is(nullValue())); + assertThat(dongle.getTcLinkKey(), is(nullValue())); + assertThat(dongle.getZigBeeNetworkKey(), is(nullValue())); + assertThat(dongle.getZigBeePanId(), is(-1)); + assertThat(dongle.getZigBeeExtendedPanId(), is(nullValue())); + + verify(port).open(); + + verify(protocolHandler).start(port); + + verify(transport).setTransportState(ZigBeeTransportState.INITIALISING); + + verify(ncp).pingNcp(); + verify(ncp).getVersion(); + verify(ncp).getDeviceInfo(); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); + + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, executorService); } @Test - public void testEzspStackStatusHandler() throws Exception { - ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); - - final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); - // Mockito.when(ncp.getNwkAddress()).thenReturn(1243); - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null) { - @Override - public ZstackNcp getZstackNcp() { - return ncp; - } - }; - dongle.setZigBeeTransportReceive(transport); - - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); - - ZstackZdoStateChangeIndAreq response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); - Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ZB_COORD); - Mockito.verify(transport, Mockito.timeout(TIMEOUT).times(0)).setTransportState(ZigBeeTransportState.ONLINE); + public void testInitializeOnANetwork() { + when(port.open()).thenReturn(true); + + when(ncp.pingNcp()).thenReturn(Collections.singleton(ZstackSystemCapabilities.MT_CAP_AF)); + + final ZstackSysVersionSrsp version = new ZstackSysVersionSrsp(new int[] { + 0, 0, + 1, 2, 3, 4, 5 + }); + when(ncp.getVersion()).thenReturn(version); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK)).thenReturn(new int[] {1}); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_EXTPANID)).thenReturn(new int[] {0, 1, 2, 3, 4, 5, 6, 7}); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_PANID)).thenReturn(new int[] {1, 2}); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY)).thenReturn(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_CHANLIST)).thenReturn(new int[] {0, 1, 2, 3}); + when(ncp.readConfiguration(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK)).thenReturn(new int[] {1}); + when(ncp.readChannelFromNV()).thenReturn(ZigBeeChannel.CHANNEL_17); + + final ZstackUtilGetDeviceInfoSrsp deviceInfo = new ZstackUtilGetDeviceInfoSrsp(new int[] { + 0, 0, + 0, + 2, 3, 4, 5, 6, 7, 8, 9, + 0, 0, + 7, + 0, + 0 + }); + when(ncp.getDeviceInfo()).thenReturn(deviceInfo); + + assertThat(dongle.initialize(), is(ZigBeeStatus.SUCCESS)); + + assertThat(dongle.getVersionString(), is("Software=3.4.5 Product=2 Transport=1")); + assertThat(dongle.getIeeeAddress(), is(new IeeeAddress(new int[] {2, 3, 4, 5, 6, 7, 8, 9}))); + + assertThat(dongle.getNwkAddress(), is(nullValue())); + assertThat(dongle.getTcLinkKey(), is(new ZigBeeKey("5A6967426565416C6C69616E63653039"))); + assertThat(dongle.getZigBeeNetworkKey(), is(new ZigBeeKey("000102030405060708090A0B0C0D0E0F"))); + assertThat(dongle.getZigBeePanId(), is(513)); + assertThat(dongle.getZigBeeExtendedPanId(), is(new ExtendedPanId("0706050403020100"))); + + verify(port).open(); + + verify(protocolHandler).start(port); + + verify(transport).setTransportState(ZigBeeTransportState.INITIALISING); + + verify(ncp).pingNcp(); + verify(ncp).getVersion(); + verify(ncp).getDeviceInfo(); + verify(ncp).readChannelFromNV(); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_BDBNODEISONANETWORK); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_EXTPANID); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_PANID); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_PRECFGKEY); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_CHANLIST); + verify(ncp).readConfiguration(ZstackConfigId.ZCD_NV_USE_DEFAULT_TCLK); + + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, executorService); + } - response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); - Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_ROUTER); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.ONLINE); - assertEquals(Integer.valueOf(1243), dongle.getNwkAddress()); + @Test + public void testStartup() throws InterruptedException, ExecutionException { + final Future future = Mockito.mock(Future.class); + + when(protocolHandler.waitForEvent(Mockito.eq(ZstackZdoStateChangeIndAreq.class), Mockito.any())) + .thenReturn(future); + + when(ncp.startupApplication()) + .thenReturn(ZstackResponseCode.SUCCESS); + + final ZstackZdoExtNwkInfoSrsp networkInfo = new ZstackZdoExtNwkInfoSrsp(new int[] { + 0, 0, + 1, 2, + 9, + 3, 4, + 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12 + }); + when(ncp.getNetworkInfo()) + .thenReturn(networkInfo); + + assertThat(dongle.startup(false), is(ZigBeeStatus.SUCCESS)); + + verify(ncp, times(2)).readConfiguration(Mockito.any()); + verify(transport).setTransportState(ZigBeeTransportState.ONLINE); + verify(ncp, times(19)).zdoRegisterCallback(Mockito.anyInt()); + verify(ncp).addEndpoint(1, 0x50, 0x104, new int[] {}, new int[] {}); + verify(ncp).setChannelMask(new ZigBeeChannelMask(ZigBeeChannelMask.CHANNEL_MASK_2GHZ)); + verify(ncp).startupApplication(); + verify(ncp).getNetworkInfo(); + verify(protocolHandler, times(5)).listener(Mockito.any(), Mockito.any()); + verify(protocolHandler).waitForEvent(Mockito.any(), Mockito.any()); + verify(executorService).scheduleWithFixedDelay(Mockito.any(), Mockito.eq(10000L), Mockito.eq(10000L), Mockito.eq(TimeUnit.MILLISECONDS)); + verify(future).get(); + + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, future, executorService); + } - response = Mockito.mock(ZstackZdoStateChangeIndAreq.class); - Mockito.when(response.getState()).thenReturn(ZstackZdoState.DEV_INIT); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).setTransportState(ZigBeeTransportState.OFFLINE); + @Test + public void testStartupReinitialize() throws InterruptedException, ExecutionException { + final Future future = Mockito.mock(Future.class); + + when(protocolHandler.waitForEvent(Mockito.eq(ZstackZdoStateChangeIndAreq.class), Mockito.any())) + .thenReturn(future); + + when(ncp.writeConfiguration(ZstackConfigId.ZCD_NV_STARTUP_OPTION, new int[] {3})) + .thenReturn(ZstackResponseCode.SUCCESS); + + final ZstackSysResetIndAreq reset = new ZstackSysResetIndAreq(new int[] { + 0, 0, + 2, + 1, 2, 3, 4, 5 + }); + when(ncp.resetNcp(ZstackResetType.TARGET_DEVICE)) + .thenReturn(reset); + + when(ncp.startupApplication()) + .thenReturn(ZstackResponseCode.SUCCESS); + + final ZstackZdoExtNwkInfoSrsp networkInfo = new ZstackZdoExtNwkInfoSrsp(new int[] { + 0, 0, + 1, 2, + 9, + 3, 4, + 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12 + }); + when(ncp.getNetworkInfo()) + .thenReturn(networkInfo); + + assertThat(dongle.startup(true), is(ZigBeeStatus.SUCCESS)); + + verify(ncp, times(4)).readConfiguration(Mockito.any()); + verify(ncp, times(3)).writeConfiguration(Mockito.any(), Mockito.any()); + verify(ncp, times(2)).resetNcp(Mockito.any()); + verify(transport).setTransportState(ZigBeeTransportState.ONLINE); + verify(ncp, times(19)).zdoRegisterCallback(Mockito.anyInt()); + verify(ncp).addEndpoint(1, 0x50, 0x104, new int[] {}, new int[] {}); + verify(ncp).setChannelMask(new ZigBeeChannelMask(ZigBeeChannelMask.CHANNEL_MASK_2GHZ)); + verify(ncp).startupApplication(); + verify(ncp).getNetworkInfo(); + verify(protocolHandler, times(5)).listener(Mockito.any(), Mockito.any()); + verify(protocolHandler).waitForEvent(Mockito.any(), Mockito.any()); + verify(executorService).scheduleWithFixedDelay(Mockito.any(), Mockito.eq(10000L), Mockito.eq(10000L), Mockito.eq(TimeUnit.MILLISECONDS)); + verify(future).get(); + + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, future, executorService); } @Test - public void setZigBeeChannel() { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); + public void setZigBeeExtendedPanId() { + final ExtendedPanId ePanId = new ExtendedPanId("123456789abcdef"); - assertEquals(ZigBeeStatus.INVALID_ARGUMENTS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_03)); + assertThat(dongle.setZigBeeExtendedPanId(ePanId), is(ZigBeeStatus.SUCCESS)); + assertThat(dongle.getZigBeeExtendedPanId(), is(ePanId)); + } - assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_11)); + @Test + public void setZigBeePanId() { + final int panId = 0x1234; - assertEquals(ZigBeeStatus.SUCCESS, dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_24)); + assertThat(dongle.setZigBeePanId(panId), is(ZigBeeStatus.SUCCESS)); + assertThat(dongle.getZigBeePanId(), is(panId)); } @Test - public void testEzspMessageSentHandler() throws Exception { - ZigBeeTransportReceive transport = Mockito.mock(ZigBeeTransportReceive.class); + public void setZigBeeChannel() { + assertThat(dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_03), is(ZigBeeStatus.INVALID_ARGUMENTS)); - // final ZstackNcp ncp = Mockito.mock(ZstackNcp.class); - // Mockito.when(ncp.getNwkAddress()).thenReturn(1243); - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - dongle.setZigBeeTransportReceive(transport); + assertThat(dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_11), is(ZigBeeStatus.SUCCESS)); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "initialised", true); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", - Executors.newScheduledThreadPool(1)); - - ZstackAfDataConfirmAreq response = Mockito.mock(ZstackAfDataConfirmAreq.class); - Mockito.when(response.getTransId()).thenReturn(231); - Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.SUCCESS); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, - ZigBeeTransportProgressState.RX_ACK); - - response = Mockito.mock(ZstackAfDataConfirmAreq.class); - Mockito.when(response.getTransId()).thenReturn(231); - Mockito.when(response.getStatus()).thenReturn(ZstackResponseCode.FAILURE); - Mockito.verify(transport, Mockito.timeout(TIMEOUT)).receiveCommandState(231, - ZigBeeTransportProgressState.RX_NAK); + assertThat(dongle.setZigBeeChannel(ZigBeeChannel.CHANNEL_24), is(ZigBeeStatus.SUCCESS)); } @Test public void sendCommandUnicast() throws Exception { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - - ZstackProtocolHandler handler = Mockito.mock(ZstackProtocolHandler.class); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", handler); - - ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); - ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); apsFrame.setCluster(0); apsFrame.setProfile(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); @@ -146,70 +312,21 @@ public void sendCommandUnicast() throws Exception { apsFrame.setPayload(new int[] {}); dongle.sendCommand(1, apsFrame); - Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) - .sendTransaction(ArgumentMatchers.any(ZstackAfDataRequestSreq.class), ArgumentMatchers.eq(ZstackAfDataRequestSrsp.class)); - } - - @Test - public void sendCommandBroadcast() throws Exception { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - ZstackProtocolHandler handler = Mockito.mock(ZstackProtocolHandler.class); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", handler); + verify(executorService).execute(Mockito.any()); - ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); - - ZigBeeApsFrame apsFrame = new ZigBeeApsFrame(); - apsFrame.setCluster(0); - apsFrame.setProfile(ZigBeeProfileType.ZIGBEE_HOME_AUTOMATION.getKey()); - apsFrame.setAddressMode(ZigBeeNwkAddressMode.DEVICE); - apsFrame.setDestinationAddress(0xfff9); - apsFrame.setApsCounter(1); - apsFrame.setRadius(30); - apsFrame.setPayload(new int[] {}); - - dongle.sendCommand(1, apsFrame); - Mockito.verify(handler, Mockito.timeout(TIMEOUT).times(1)) - .sendTransaction(ArgumentMatchers.any(ZstackAfDataRequestSreq.class), ArgumentMatchers.eq(ZstackAfDataRequestSrsp.class)); + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, executorService); } @Test public void shutdown() throws Exception { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "serialPort", Mockito.mock(ZigBeePort.class)); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", - Mockito.mock(ZstackProtocolHandler.class)); - dongle.shutdown(); - } - - @Test - public void scheduleNetworkStatePolling() throws Exception { - ZigBeeDongleZstack dongle = new ZigBeeDongleZstack(null); - ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); + verify(protocolHandler).setClosing(); + verify(port).close(); + verify(protocolHandler).close(); + verify(executorService).shutdown(); - ZstackProtocolHandler frameHandler = Mockito.mock(ZstackProtocolHandler.class); - - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "pollRate", 1); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "frameHandler", frameHandler); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "executorService", executorService); - - TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); - Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) - .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); - - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommandTime", Long.MAX_VALUE - 1); - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "networkStateUp", true); - TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); - Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).times(0)) - .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); - - TestUtilities.setField(ZigBeeDongleZstack.class, dongle, "lastSendCommandTime", 0); - TestUtilities.invokeMethod(ZigBeeDongleZstack.class, dongle, "scheduleNetworkStatePolling"); - Mockito.verify(frameHandler, Mockito.timeout(TIMEOUT).atLeast(1)) - .queueFrame(ArgumentMatchers.any(ZstackFrameRequest.class)); + verifyNoMoreInteractions(port, transport, ncp, protocolHandler, executorService); } - } diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index bccb6516fb..2155235d39 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -7,16 +7,12 @@ */ package com.zsmartsystems.zigbee.dongle.zstack.internal; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -33,62 +29,33 @@ * */ public class ZstackProtocolHandlerTest { - private int[] getPacket(int[] data) { - ZstackProtocolHandler handler = new ZstackProtocolHandler(); - byte[] bytedata = new byte[data.length]; - int cnt = 0; - for (int value : data) { - bytedata[cnt++] = (byte) value; - } - ByteArrayInputStream stream = new ByteArrayInputStream(bytedata); - ZigBeePort port = new TestPort(stream, null); - - Method privateMethod; - try { - Field field = handler.getClass().getDeclaredField("port"); - field.setAccessible(true); - field.set(handler, port); - - privateMethod = ZstackProtocolHandler.class.getDeclaredMethod("getPacket"); - privateMethod.setAccessible(true); - - return (int[]) privateMethod.invoke(handler); - } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException - | InvocationTargetException | NoSuchFieldException e) { - e.printStackTrace(); - } - - return null; - } - @Test - public void testReceivePacket() { + public void testReceivePacket() throws Exception { int[] response = getPacket(new int[] { 0xFE, 0x02, 0x61, 0x01, 0x12, 0x34, 0x44 }); assertTrue(Arrays.equals(response, new int[] { 0x61, 0x01, 0x12, 0x34 })); } @Test - public void testReceivePacketLeadingRubbish() { + public void testReceivePacketLeadingRubbish() throws Exception { int[] response = getPacket(new int[] { 0x00, 0x12, 0xFE, 0x02, 0x61, 0x01, 0x12, 0x34, 0x44 }); assertTrue(Arrays.equals(response, new int[] { 0x61, 0x01, 0x12, 0x34 })); } - @Test - public void isSynchronous() throws NoSuchMethodException, SecurityException, IllegalAccessException, - IllegalArgumentException, InvocationTargetException { + private int[] getPacket(int[] data) throws Exception { ZstackProtocolHandler handler = new ZstackProtocolHandler(); + byte[] bytedata = new byte[data.length]; + int cnt = 0; + for (int value : data) { + bytedata[cnt++] = (byte) value; + } + ByteArrayInputStream stream = new ByteArrayInputStream(bytedata); + ZigBeePort port = new TestPort(stream, null); - assertTrue((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", - int.class, 0x61)); - assertTrue((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", - int.class, 0x22)); - assertFalse((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", - int.class, 0x01)); - assertFalse((boolean) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "isSynchronous", - int.class, 0x42)); + TestUtilities.setField(ZstackProtocolHandler.class, handler, "port", port); + return (int[]) TestUtilities.invokeMethod(ZstackProtocolHandler.class, handler, "getPacket"); } - class TestPort implements ZigBeePort { + private class TestPort implements ZigBeePort { InputStream input; List outputData = new ArrayList<>(); @@ -155,10 +122,5 @@ public void setDtr(boolean state) { @Override public void setRts(boolean state) { } - - public List getOutputData() { - return outputData; - } } - } diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeChannelMask.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeChannelMask.java index 31c6f71391..e2cd56eb37 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeChannelMask.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/ZigBeeChannelMask.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * A class to hold a set of channels and methods to construct channel masks @@ -123,6 +124,21 @@ public boolean containsChannel(ZigBeeChannel channel) { return ((channelMask & channel.getMask()) != 0); } + @Override + public int hashCode() { + return Objects.hash(this.channelMask); + } + + @Override + public boolean equals(final Object other) { + if (other instanceof ZigBeeChannelMask) { + final ZigBeeChannelMask that = (ZigBeeChannelMask) other; + return Objects.equals(this.channelMask, that.channelMask); + } else { + return false; + } + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); From 5a3c25800bc0c58a5fdae715e5278019d94f55da Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:40:52 +0100 Subject: [PATCH 27/33] Fix interface issues --- .../zstack/autocode/ClassGenerator.java | 12 +++++------- .../zstack/autocode/CommandGenerator.java | 11 ++++++----- .../zstack/autocode/ZstackAutocoder.java | 3 ++- .../dongle/zstack/ZigBeeDongleZstack.java | 19 ++++++++++++++----- .../internal/ZstackProtocolHandler.java | 10 ++++++++-- 5 files changed, 35 insertions(+), 20 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java index 685c8c8729..eeab53bf73 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/ClassGenerator.java @@ -10,11 +10,10 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; -import java.nio.charset.Charset; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -104,12 +103,11 @@ protected String upperCaseFirstCharacter(String val) { return val.substring(0, 1).toUpperCase() + val.substring(1); } - protected PrintWriter getClassOut(File packageFile, String className) throws FileNotFoundException { + protected PrintWriter getClassOut(File packageFile, String className) throws FileNotFoundException, UnsupportedEncodingException { packageFile.mkdirs(); final File classFile = new File(packageFile + File.separator + className + ".java"); System.out.println("Generating: " + classFile.getAbsolutePath()); - final FileOutputStream fileOutputStream = new FileOutputStream(classFile, false); - return new PrintWriter(fileOutputStream, false, Charset.forName("UTF-8")); + return new PrintWriter(classFile, "UTF-8"); } protected void clearImports() { @@ -135,7 +133,7 @@ protected void outputCopywrite(PrintWriter out) { BufferedReader br; try { - br = new BufferedReader(new FileReader("pom.xml", Charset.forName("UTF-8"))); + br = new BufferedReader(new FileReader("pom.xml")); String line = br.readLine(); while (line != null) { if (line.contains("") && line.contains("")) { @@ -147,7 +145,7 @@ protected void outputCopywrite(PrintWriter out) { br.close(); - br = new BufferedReader(new FileReader("src/etc/header.txt", Charset.forName("UTF-8"))); + br = new BufferedReader(new FileReader("src/etc/header.txt")); line = br.readLine(); out.println("/**"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 89c1e61ecf..6ba0a9e769 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -13,6 +13,7 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.StringWriter; +import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,7 +39,7 @@ public class CommandGenerator extends ClassGenerator { private List enumerations; - public void go(Protocol protocol) throws FileNotFoundException { + public void go(Protocol protocol) throws FileNotFoundException, UnsupportedEncodingException { enumerations = protocol.enumerations; String className; @@ -75,7 +76,7 @@ public void go(Protocol protocol) throws FileNotFoundException { } private void createCommandClass(String className, Command command, List parameters) - throws FileNotFoundException { + throws FileNotFoundException, UnsupportedEncodingException { System.out.println("Processing command class " + command.name + " [" + className + "()]"); @@ -412,7 +413,7 @@ private void createCommandClass(String className, Command command, List configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), - Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); + final List hexvalue = new ArrayList<>(); + for (final int val : config.getValue()) { + hexvalue.add(Integer.toHexString(val)); + } + + logger.debug("Configuration state {} = {}", config.getKey(), hexvalue); } stackConfigurer.setConfiguration(stackConfiguration); configuration = stackConfigurer.getConfiguration(stackConfiguration.keySet()); for (Entry config : configuration.entrySet()) { - logger.debug("Configuration state {} = {}", config.getKey(), - Arrays.stream(config.getValue()).mapToObj(Integer::toHexString).collect(Collectors.toList())); + final List hexvalue = new ArrayList<>(); + for (final int val : config.getValue()) { + hexvalue.add(Integer.toHexString(val)); + } + + logger.debug("Configuration state {} = {}", config.getKey(), hexvalue); } // reset the device diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java index f7d95522c4..30dbd9a609 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandler.java @@ -19,8 +19,6 @@ import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Predicate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -467,4 +465,12 @@ public void transactionComplete() { } } } + + public static interface Consumer { + public void accept(final T object); + } + + public static interface Predicate { + public boolean test(final T object); + } } From 0bacccd0a960de8a166ec95ea684fdf58675db56 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:54:09 +0100 Subject: [PATCH 28/33] Update parent version --- com.zsmartsystems.zigbee.console.zstack/pom.xml | 2 +- com.zsmartsystems.zigbee.dongle.zstack/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.zstack/pom.xml b/com.zsmartsystems.zigbee.console.zstack/pom.xml index 54113f4763..aca84452d3 100644 --- a/com.zsmartsystems.zigbee.console.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.console.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.8-SNAPSHOT + 1.4.10-SNAPSHOT diff --git a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml index 3d2c4a3263..b6136ade21 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack/pom.xml @@ -9,7 +9,7 @@ com.zsmartsystems zigbee - 1.4.8-SNAPSHOT + 1.4.10-SNAPSHOT From 0fc54f81b1b667d385fc15f76bf6c64b73399547 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 2 Nov 2022 22:00:38 +0100 Subject: [PATCH 29/33] Update parent version --- com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml index 4c9f208e9b..a9c6df102a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/pom.xml @@ -14,7 +14,7 @@ com.zsmartsystems zigbee - 1.4.8-SNAPSHOT + 1.4.10-SNAPSHOT From 9973b1a73655372e3c1a13b623254107b70e3ccf Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 2 Nov 2022 22:22:02 +0100 Subject: [PATCH 30/33] LGTM issue --- .../zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java index aefecdb98f..c2535b5afd 100644 --- a/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java +++ b/com.zsmartsystems.zigbee.console.zstack/src/main/java/com/zsmartsystems/zigbee/console/zstack/ZstackConsoleNcpSecurityCommand.java @@ -64,7 +64,7 @@ public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStr if (preConfigKey == null) { out.println("NV Device info : ERROR"); } else { - out.println("Preconfigured Network Key : " + preConfigKey); + out.println("Preconfigured Network Key : " + hexDump(preConfigKey)); } if (nwkKeyConfig == null) { From edc4af11fd5eefc8356591447e2ebf58764376d0 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Wed, 2 Nov 2022 23:48:45 +0100 Subject: [PATCH 31/33] removed unnecessary dependencies --- com.zsmartsystems.zigbee.console.main/pom.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.main/pom.xml b/com.zsmartsystems.zigbee.console.main/pom.xml index e9f61ff06e..a5b786a2be 100644 --- a/com.zsmartsystems.zigbee.console.main/pom.xml +++ b/com.zsmartsystems.zigbee.console.main/pom.xml @@ -86,18 +86,6 @@ ${project.version} - - commons-lang - commons-lang - 2.6 - - - - commons-io - commons-io - 2.4 - - commons-cli commons-cli From b30037268ee90dad739042d42a892cbc975e699e Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sun, 26 Mar 2023 10:00:18 +0200 Subject: [PATCH 32/33] Updated generator/generated files --- .../dongle/cc2531/Cc2351TestPacket.java | 8 - .../EmberFirmwareUpdateHandlerTest.java | 8 - .../internal/ash/AshFrameHandlerTest.java | 8 - .../internal/spi/SpiFrameHandlerTest.java | 8 - .../TelegesisFirmwareUpdateHandlerTest.java | 8 - .../internal/TelegesisFrameHandlerTest.java | 8 - .../xbee/internal/XBeeFrameHandlerTest.java | 8 - .../zstack/autocode/CommandGenerator.java | 6 +- .../dongle/zstack/api/ZstackFrameFactory.java | 484 +++--- .../dongle/zstack/api/ZstackResponseCode.java | 258 ++-- .../dongle/zstack/api/af/AfDataOptions.java | 164 +- .../api/af/ZstackAfDataConfirmAreq.java | 249 ++-- .../api/af/ZstackAfDataRequestSreq.java | 581 ++++---- .../api/af/ZstackAfDataRequestSrsp.java | 137 +- .../api/af/ZstackAfIncomingMsgAreq.java | 669 ++++----- .../zstack/api/af/ZstackAfRegisterSreq.java | 497 +++--- .../zstack/api/af/ZstackAfRegisterSrsp.java | 143 +- .../ZstackAppCnfBdbAddInstallcodeSreq.java | 269 ++-- .../ZstackAppCnfBdbAddInstallcodeSrsp.java | 137 +- ...ppCnfBdbCommissioningNotificationAreq.java | 273 ++-- ...BdbSetActiveDefaultCentralizedKeySreq.java | 217 +-- ...BdbSetActiveDefaultCentralizedKeySrsp.java | 137 +- .../appcnf/ZstackAppCnfBdbSetChannelSreq.java | 207 +-- .../appcnf/ZstackAppCnfBdbSetChannelSrsp.java | 137 +- ...ppCnfBdbSetJoinusesinstallcodekeySreq.java | 203 +-- ...ppCnfBdbSetJoinusesinstallcodekeySrsp.java | 137 +- ...kAppCnfBdbSetTcRequireKeyExchangeSreq.java | 179 +-- ...kAppCnfBdbSetTcRequireKeyExchangeSrsp.java | 137 +- ...stackAppCnfSetAllowrejoinTcPolicySreq.java | 155 +- ...stackAppCnfSetAllowrejoinTcPolicySrsp.java | 137 +- .../appcnf/ZstackAuthenticationOption.java | 150 +- .../appcnf/ZstackBdbCommissioningMode.java | 180 +-- .../ZstackBdbRemainingCommissioningModes.java | 180 +-- .../zstack/api/appcnf/ZstackBdbStatus.java | 270 ++-- .../appcnf/ZstackCentralizedLinkKeyMode.java | 192 +-- .../api/appcnf/ZstackInstallCodeFormat.java | 140 +- .../zstack/api/mac/ZstackMacScanReqSreq.java | 543 +++---- .../zstack/api/mac/ZstackMacScanReqSrsp.java | 79 +- .../api/rpc/ZstackRpcSreqErrorSrsp.java | 239 +-- .../zstack/api/rpc/ZstackSreqErrorCode.java | 178 +-- .../api/sapi/ZstackDeviceInformation.java | 218 +-- .../api/sapi/ZstackZbGetDeviceInfoSreq.java | 155 +- .../api/sapi/ZstackZbGetDeviceInfoSrsp.java | 187 +-- .../sapi/ZstackZbReadConfigurationSreq.java | 157 +- .../sapi/ZstackZbReadConfigurationSrsp.java | 255 ++-- .../sapi/ZstackZbWriteConfigurationSreq.java | 221 +-- .../sapi/ZstackZbWriteConfigurationSrsp.java | 137 +- .../api/sbl/ZstackSbHandshakeCmdSreq.java | 95 +- .../api/sbl/ZstackSbHandshakeCmdSrsp.java | 337 ++--- .../zstack/api/sbl/ZstackSbWriteCmdSreq.java | 163 +- .../zstack/api/sbl/ZstackSbWriteCmdSrsp.java | 133 +- .../dongle/zstack/api/sys/ZstackConfigId.java | 1326 ++++++++--------- .../api/sys/ZstackDiagnosticAttribute.java | 288 ++-- .../zstack/api/sys/ZstackNwkKeyDesc.java | 200 +-- .../zstack/api/sys/ZstackResetReason.java | 168 +-- .../zstack/api/sys/ZstackResetType.java | 158 +- .../zstack/api/sys/ZstackSecMgrEntry.java | 256 ++-- .../api/sys/ZstackSysGetExtAddrSreq.java | 99 +- .../api/sys/ZstackSysGetExtAddrSrsp.java | 137 +- .../zstack/api/sys/ZstackSysNvReadSreq.java | 363 ++--- .../zstack/api/sys/ZstackSysNvReadSrsp.java | 201 +-- .../api/sys/ZstackSysOsalNvReadSreq.java | 209 +-- .../api/sys/ZstackSysOsalNvReadSrsp.java | 203 +-- .../api/sys/ZstackSysOsalNvWriteSreq.java | 273 ++-- .../api/sys/ZstackSysOsalNvWriteSrsp.java | 139 +- .../zstack/api/sys/ZstackSysPingSreq.java | 99 +- .../zstack/api/sys/ZstackSysPingSrsp.java | 135 +- .../zstack/api/sys/ZstackSysResetIndAreq.java | 391 ++--- .../zstack/api/sys/ZstackSysResetReqAcmd.java | 149 +- .../api/sys/ZstackSysSetExtAddrSreq.java | 157 +- .../api/sys/ZstackSysSetExtAddrSrsp.java | 137 +- .../api/sys/ZstackSysSetTxPowerSreq.java | 157 +- .../api/sys/ZstackSysSetTxPowerSrsp.java | 139 +- .../zstack/api/sys/ZstackSysVersionSreq.java | 99 +- .../zstack/api/sys/ZstackSysVersionSrsp.java | 343 ++--- .../sys/ZstackSysZdiagsClearStatsSreq.java | 157 +- .../sys/ZstackSysZdiagsClearStatsSrsp.java | 137 +- .../api/sys/ZstackSysZdiagsGetStatsSreq.java | 155 +- .../api/sys/ZstackSysZdiagsGetStatsSrsp.java | 135 +- .../api/sys/ZstackSysZdiagsInitStatsSreq.java | 99 +- .../api/sys/ZstackSysZdiagsInitStatsSrsp.java | 137 +- .../ZstackSysZdiagsRestoreStatsNvSreq.java | 155 +- .../ZstackSysZdiagsRestoreStatsNvSrsp.java | 137 +- .../sys/ZstackSysZdiagsSaveStatsToNvSreq.java | 99 +- .../sys/ZstackSysZdiagsSaveStatsToNvSrsp.java | 135 +- .../api/sys/ZstackSystemCapabilities.java | 238 +-- .../dongle/zstack/api/sys/ZstackZdoState.java | 244 +-- .../ZstackUtilApsmeLinkKeyDataGetSreq.java | 157 +- .../ZstackUtilApsmeLinkKeyDataGetSrsp.java | 295 ++-- .../ZstackUtilApsmeLinkKeyNvIdGetSreq.java | 157 +- .../ZstackUtilApsmeLinkKeyNvIdGetSrsp.java | 189 +-- .../api/util/ZstackUtilGetDeviceInfoSreq.java | 99 +- .../api/util/ZstackUtilGetDeviceInfoSrsp.java | 425 +++--- .../api/util/ZstackUtilGetNvInfoSreq.java | 99 +- .../api/util/ZstackUtilGetNvInfoSrsp.java | 411 ++--- .../api/util/ZstackUtilLedControlSreq.java | 207 +-- .../api/util/ZstackUtilLedControlSrsp.java | 137 +- .../api/util/ZstackUtilSetChannelsSreq.java | 157 +- .../api/util/ZstackUtilSetChannelsSrsp.java | 139 +- .../api/util/ZstackUtilSetPanidSreq.java | 155 +- .../api/util/ZstackUtilSetPanidSrsp.java | 137 +- .../api/util/ZstackUtilSetPrecfgkeySreq.java | 159 +- .../api/util/ZstackUtilSetPrecfgkeySrsp.java | 139 +- .../api/util/ZstackUtilSetSeclevelSreq.java | 157 +- .../api/util/ZstackUtilSetSeclevelSrsp.java | 139 +- .../api/zdo/ZstackZdoExtNwkInfoSreq.java | 99 +- .../api/zdo/ZstackZdoExtNwkInfoSrsp.java | 451 +++--- .../api/zdo/ZstackZdoGetLinkKeySreq.java | 157 +- .../api/zdo/ZstackZdoGetLinkKeySrsp.java | 245 +-- .../zstack/api/zdo/ZstackZdoLeaveIndAreq.java | 341 ++--- .../api/zdo/ZstackZdoMsgCbIncomingAreq.java | 453 +++--- .../api/zdo/ZstackZdoMsgCbRegisterSreq.java | 155 +- .../api/zdo/ZstackZdoMsgCbRegisterSrsp.java | 137 +- .../api/zdo/ZstackZdoNwkDiscoveryReqSreq.java | 207 +-- .../api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java | 155 +- .../api/zdo/ZstackZdoRemoveLinkKeySreq.java | 157 +- .../api/zdo/ZstackZdoRemoveLinkKeySrsp.java | 137 +- .../api/zdo/ZstackZdoSetLinkKeySreq.java | 263 ++-- .../api/zdo/ZstackZdoSetLinkKeySrsp.java | 137 +- .../api/zdo/ZstackZdoStartupFromAppSreq.java | 155 +- .../api/zdo/ZstackZdoStartupFromAppSrsp.java | 137 +- .../api/zdo/ZstackZdoStateChangeIndAreq.java | 133 +- .../zstack/api/zdo/ZstackZdoTcDevIndAreq.java | 239 +-- .../internal/ZstackProtocolHandlerTest.java | 8 - .../zigbee/serial/ZigBeeSerialPort.java | 14 +- .../zigbee/transport/ZigBeePort.java | 10 - 126 files changed, 12301 insertions(+), 12279 deletions(-) diff --git a/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java b/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java index 0449458747..aecbcfe8cc 100644 --- a/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java +++ b/com.zsmartsystems.zigbee.dongle.cc2531/src/test/java/com/zsmartsystems/zigbee/dongle/cc2531/Cc2351TestPacket.java @@ -111,13 +111,5 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } - - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } } } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java index 8a4605b56e..2b3419ed96 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/EmberFirmwareUpdateHandlerTest.java @@ -202,14 +202,6 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } - public byte[] getOutput() { return Arrays.copyOfRange(output, 0, cnt); } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java index 62b294eec9..d35af6d74b 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/ash/AshFrameHandlerTest.java @@ -206,14 +206,6 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } - public List getOutputData() { return outputData; } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java index 6a71caa1d0..fe3df70a93 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/test/java/com/zsmartsystems/zigbee/dongle/ember/internal/spi/SpiFrameHandlerTest.java @@ -354,13 +354,5 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } - - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } } } diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java index 7ffca8f6a5..1781a584ad 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFirmwareUpdateHandlerTest.java @@ -203,14 +203,6 @@ public boolean open(int baudRate, FlowControl flowControl) { public void purgeRxBuffer() { } - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } - public byte[] getOutput() { return Arrays.copyOfRange(output, 0, cnt); } diff --git a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java index 57ed8c1652..c053c3c9ad 100644 --- a/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.telegesis/src/test/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/TelegesisFrameHandlerTest.java @@ -328,13 +328,5 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } - - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } } } diff --git a/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java b/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java index 486755c25d..133a63cb9e 100644 --- a/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.xbee/src/test/java/com/zsmartsystems/zigbee/dongle/xbee/internal/XBeeFrameHandlerTest.java @@ -151,13 +151,5 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } - - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } } } diff --git a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java index 6ba0a9e769..c15c599163 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.zstack.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/autocode/CommandGenerator.java @@ -14,6 +14,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -93,9 +94,10 @@ private void createCommandClass(String className, Command command, List"); } out.println(" * Note that this code is autogenerated. Manual changes may be overwritten."); - out.println(" *"); - out.println(" * @author Chris Jackson"); out.println(" */"); + out.println(""); + addImport("javax.annotation.Generated"); + out.println("@Generated(value = \"com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator\", date = \"" + new Date() + "\")"); if (className.endsWith("Srsp") || className.endsWith("Areq")) { addImport(zstackCommandPackage + ".ZstackFrameResponse"); diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java index 1e0833ed51..d8731ae15a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackFrameFactory.java @@ -1,242 +1,242 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api; - -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbCommissioningNotificationAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.mac.ZstackMacScanReqSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbHandshakeCmdSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbWriteCmdSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysGetExtAddrSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetExtAddrSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsClearStatsSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsInitStatsSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsRestoreStatsNvSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsSaveStatsToNvSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyDataGetSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyNvIdGetSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPanidSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPrecfgkeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetSeclevelSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoGetLinkKeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoLeaveIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoNwkDiscoveryReqSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoRemoveLinkKeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; -import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Factory class to create Z-Stack commands from incoming data. This will only create {@link ZstackFrameResponse}s. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackFrameFactory { - /** - * Logger - */ - private static Logger logger = LoggerFactory.getLogger(ZstackFrameFactory.class); - - /* - * Subsystem definitions - */ - public static int ZSTACK_RPC = 0x0000; - public static int ZSTACK_SYS = 0x0100; - public static int ZSTACK_MAC = 0x0200; - public static int ZSTACK_AF = 0x0400; - public static int ZSTACK_ZDO = 0x0500; - public static int ZSTACK_SAPI = 0x0600; - public static int ZSTACK_UTIL = 0x0700; - public static int ZSTACK_APP_CNF = 0x0F00; - public static int ZSTACK_SBL = 0x0D00; - - /** - * Subsystem definition mask - */ - private static int ZSTACK_SUBSYSTEM_MASK = 0x1F; - - private static final int AF_DATA_CONFIRM = 0x80; - private static final int AF_DATA_REQUEST = 0x01; - private static final int AF_INCOMING_MSG = 0x81; - private static final int AF_REGISTER = 0x00; - private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x04; - private static final int APP_CNF_BDB_COMMISSIONING_NOTIFICATION = 0x80; - private static final int APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY = 0x07; - private static final int APP_CNF_BDB_SET_CHANNEL = 0x08; - private static final int APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY = 0x06; - private static final int APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE = 0x09; - private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x03; - private static final int MAC_SCAN_REQ = 0x0C; - private static final int RPC_SREQ_ERROR = 0x00; - private static final int SB_HANDSHAKE_CMD = 0x04; - private static final int SB_WRITE_CMD = 0x00; - private static final int SYS_GET_EXT_ADDR = 0x04; - private static final int SYS_NV_READ = 0x33; - private static final int SYS_OSAL_NV_READ = 0x08; - private static final int SYS_OSAL_NV_WRITE = 0x09; - private static final int SYS_PING = 0x01; - private static final int SYS_RESET_IND = 0x80; - private static final int SYS_SET_EXT_ADDR = 0x03; - private static final int SYS_SET_TX_POWER = 0x14; - private static final int SYS_VERSION = 0x02; - private static final int SYS_ZDIAGS_CLEAR_STATS = 0x18; - private static final int SYS_ZDIAGS_GET_STATS = 0x19; - private static final int SYS_ZDIAGS_INIT_STATS = 0x17; - private static final int SYS_ZDIAGS_RESTORE_STATS_NV = 0x1A; - private static final int SYS_ZDIAGS_SAVE_STATS_TO_NV = 0x1B; - private static final int UTIL_APSME_LINK_KEY_DATA_GET = 0x44; - private static final int UTIL_APSME_LINK_KEY_NV_ID_GET = 0x45; - private static final int UTIL_GET_DEVICE_INFO = 0x00; - private static final int UTIL_GET_NV_INFO = 0x01; - private static final int UTIL_LED_CONTROL = 0x09; - private static final int UTIL_SET_CHANNELS = 0x03; - private static final int UTIL_SET_PANID = 0x02; - private static final int UTIL_SET_PRECFGKEY = 0x05; - private static final int UTIL_SET_SECLEVEL = 0x04; - private static final int ZB_GET_DEVICE_INFO = 0x06; - private static final int ZB_READ_CONFIGURATION = 0x04; - private static final int ZB_WRITE_CONFIGURATION = 0x05; - private static final int ZDO_EXT_NWK_INFO = 0x50; - private static final int ZDO_GET_LINK_KEY = 0x25; - private static final int ZDO_LEAVE_IND = 0xC9; - private static final int ZDO_MSG_CB_INCOMING = 0xFF; - private static final int ZDO_MSG_CB_REGISTER = 0x3E; - private static final int ZDO_NWK_DISCOVERY_REQ = 0x26; - private static final int ZDO_REMOVE_LINK_KEY = 0x24; - private static final int ZDO_SET_LINK_KEY = 0x23; - private static final int ZDO_STARTUP_FROM_APP = 0x40; - private static final int ZDO_STATE_CHANGE_IND = 0xC0; - private static final int ZDO_TC_DEV_IND = 0xCA; - - private static Map> zstackFrameMap = new HashMap>(); - - static { - zstackFrameMap.put(ZSTACK_AF + AF_DATA_CONFIRM, ZstackAfDataConfirmAreq.class); - zstackFrameMap.put(ZSTACK_AF + AF_DATA_REQUEST, ZstackAfDataRequestSrsp.class); - zstackFrameMap.put(ZSTACK_AF + AF_INCOMING_MSG, ZstackAfIncomingMsgAreq.class); - zstackFrameMap.put(ZSTACK_AF + AF_REGISTER, ZstackAfRegisterSrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_ADD_INSTALLCODE, ZstackAppCnfBdbAddInstallcodeSrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_COMMISSIONING_NOTIFICATION, ZstackAppCnfBdbCommissioningNotificationAreq.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_CHANNEL, ZstackAppCnfBdbSetChannelSrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY, ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); - zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_SET_ALLOWREJOIN_TC_POLICY, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); - zstackFrameMap.put(ZSTACK_MAC + MAC_SCAN_REQ, ZstackMacScanReqSrsp.class); - zstackFrameMap.put(ZSTACK_RPC + RPC_SREQ_ERROR, ZstackRpcSreqErrorSrsp.class); - zstackFrameMap.put(ZSTACK_SBL + SB_HANDSHAKE_CMD, ZstackSbHandshakeCmdSrsp.class); - zstackFrameMap.put(ZSTACK_SBL + SB_WRITE_CMD, ZstackSbWriteCmdSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_GET_EXT_ADDR, ZstackSysGetExtAddrSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_NV_READ, ZstackSysNvReadSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_READ, ZstackSysOsalNvReadSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_WRITE, ZstackSysOsalNvWriteSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_PING, ZstackSysPingSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_RESET_IND, ZstackSysResetIndAreq.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_SET_EXT_ADDR, ZstackSysSetExtAddrSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_SET_TX_POWER, ZstackSysSetTxPowerSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_VERSION, ZstackSysVersionSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_CLEAR_STATS, ZstackSysZdiagsClearStatsSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_GET_STATS, ZstackSysZdiagsGetStatsSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_INIT_STATS, ZstackSysZdiagsInitStatsSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_RESTORE_STATS_NV, ZstackSysZdiagsRestoreStatsNvSrsp.class); - zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_SAVE_STATS_TO_NV, ZstackSysZdiagsSaveStatsToNvSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_DATA_GET, ZstackUtilApsmeLinkKeyDataGetSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_NV_ID_GET, ZstackUtilApsmeLinkKeyNvIdGetSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_DEVICE_INFO, ZstackUtilGetDeviceInfoSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_NV_INFO, ZstackUtilGetNvInfoSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_LED_CONTROL, ZstackUtilLedControlSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_CHANNELS, ZstackUtilSetChannelsSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PANID, ZstackUtilSetPanidSrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PRECFGKEY, ZstackUtilSetPrecfgkeySrsp.class); - zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_SECLEVEL, ZstackUtilSetSeclevelSrsp.class); - zstackFrameMap.put(ZSTACK_SAPI + ZB_GET_DEVICE_INFO, ZstackZbGetDeviceInfoSrsp.class); - zstackFrameMap.put(ZSTACK_SAPI + ZB_READ_CONFIGURATION, ZstackZbReadConfigurationSrsp.class); - zstackFrameMap.put(ZSTACK_SAPI + ZB_WRITE_CONFIGURATION, ZstackZbWriteConfigurationSrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_EXT_NWK_INFO, ZstackZdoExtNwkInfoSrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_GET_LINK_KEY, ZstackZdoGetLinkKeySrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_LEAVE_IND, ZstackZdoLeaveIndAreq.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_INCOMING, ZstackZdoMsgCbIncomingAreq.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_REGISTER, ZstackZdoMsgCbRegisterSrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_NWK_DISCOVERY_REQ, ZstackZdoNwkDiscoveryReqSrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_REMOVE_LINK_KEY, ZstackZdoRemoveLinkKeySrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_SET_LINK_KEY, ZstackZdoSetLinkKeySrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_STARTUP_FROM_APP, ZstackZdoStartupFromAppSrsp.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_STATE_CHANGE_IND, ZstackZdoStateChangeIndAreq.class); - zstackFrameMap.put(ZSTACK_ZDO + ZDO_TC_DEV_IND, ZstackZdoTcDevIndAreq.class); - } - - /** - * Creates and {@link ZstackFrameResponse} from the incoming data. - * - * @param data the int[] containing the ZStack data from which to generate the frame - * @return the {@link ZstackFrameResponse} or null if the response can't be created. - */ - public static ZstackFrameResponse createFrame(int[] data) { - if (data.length < 2) { - return null; - } - - int cmdId = ((data[0] & ZSTACK_SUBSYSTEM_MASK) << 8) + data[1]; - Class zstackClass = zstackFrameMap.get(cmdId); - - if (zstackClass == null) { - return null; - } - - Constructor ctor; - try { - ctor = zstackClass.getConstructor(int[].class); - return (ZstackFrameResponse) ctor.newInstance(data); - } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | InstantiationException - | IllegalAccessException | InvocationTargetException e) { - logger.debug("Error creating instance of ZstackCommand", e); - } - - return null; - } - - -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataConfirmAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfDataRequestSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfIncomingMsgAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.ZstackAfRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbAddInstallcodeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbCommissioningNotificationAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetChannelSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAppCnfSetAllowrejoinTcPolicySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.mac.ZstackMacScanReqSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbReadConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sapi.ZstackZbWriteConfigurationSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbHandshakeCmdSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sbl.ZstackSbWriteCmdSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysGetExtAddrSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysNvReadSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvReadSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysOsalNvWriteSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysPingSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysResetIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetExtAddrSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysSetTxPowerSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysVersionSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsClearStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsGetStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsInitStatsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsRestoreStatsNvSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackSysZdiagsSaveStatsToNvSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyDataGetSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilApsmeLinkKeyNvIdGetSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetDeviceInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilGetNvInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilLedControlSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetChannelsSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPanidSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetPrecfgkeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.util.ZstackUtilSetSeclevelSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoExtNwkInfoSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoGetLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoLeaveIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbIncomingAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoMsgCbRegisterSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoNwkDiscoveryReqSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoRemoveLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoSetLinkKeySrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStartupFromAppSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoStateChangeIndAreq; +import com.zsmartsystems.zigbee.dongle.zstack.api.zdo.ZstackZdoTcDevIndAreq; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Factory class to create Z-Stack commands from incoming data. This will only create {@link ZstackFrameResponse}s. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackFrameFactory { + /** + * Logger + */ + private static Logger logger = LoggerFactory.getLogger(ZstackFrameFactory.class); + + /* + * Subsystem definitions + */ + public static int ZSTACK_RPC = 0x0000; + public static int ZSTACK_SYS = 0x0100; + public static int ZSTACK_MAC = 0x0200; + public static int ZSTACK_AF = 0x0400; + public static int ZSTACK_ZDO = 0x0500; + public static int ZSTACK_SAPI = 0x0600; + public static int ZSTACK_UTIL = 0x0700; + public static int ZSTACK_APP_CNF = 0x0F00; + public static int ZSTACK_SBL = 0x0D00; + + /** + * Subsystem definition mask + */ + private static int ZSTACK_SUBSYSTEM_MASK = 0x1F; + + private static final int AF_DATA_CONFIRM = 0x80; + private static final int AF_DATA_REQUEST = 0x01; + private static final int AF_INCOMING_MSG = 0x81; + private static final int AF_REGISTER = 0x00; + private static final int APP_CNF_BDB_ADD_INSTALLCODE = 0x04; + private static final int APP_CNF_BDB_COMMISSIONING_NOTIFICATION = 0x80; + private static final int APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY = 0x07; + private static final int APP_CNF_BDB_SET_CHANNEL = 0x08; + private static final int APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY = 0x06; + private static final int APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE = 0x09; + private static final int APP_CNF_SET_ALLOWREJOIN_TC_POLICY = 0x03; + private static final int MAC_SCAN_REQ = 0x0C; + private static final int RPC_SREQ_ERROR = 0x00; + private static final int SB_HANDSHAKE_CMD = 0x04; + private static final int SB_WRITE_CMD = 0x00; + private static final int SYS_GET_EXT_ADDR = 0x04; + private static final int SYS_NV_READ = 0x33; + private static final int SYS_OSAL_NV_READ = 0x08; + private static final int SYS_OSAL_NV_WRITE = 0x09; + private static final int SYS_PING = 0x01; + private static final int SYS_RESET_IND = 0x80; + private static final int SYS_SET_EXT_ADDR = 0x03; + private static final int SYS_SET_TX_POWER = 0x14; + private static final int SYS_VERSION = 0x02; + private static final int SYS_ZDIAGS_CLEAR_STATS = 0x18; + private static final int SYS_ZDIAGS_GET_STATS = 0x19; + private static final int SYS_ZDIAGS_INIT_STATS = 0x17; + private static final int SYS_ZDIAGS_RESTORE_STATS_NV = 0x1A; + private static final int SYS_ZDIAGS_SAVE_STATS_TO_NV = 0x1B; + private static final int UTIL_APSME_LINK_KEY_DATA_GET = 0x44; + private static final int UTIL_APSME_LINK_KEY_NV_ID_GET = 0x45; + private static final int UTIL_GET_DEVICE_INFO = 0x00; + private static final int UTIL_GET_NV_INFO = 0x01; + private static final int UTIL_LED_CONTROL = 0x09; + private static final int UTIL_SET_CHANNELS = 0x03; + private static final int UTIL_SET_PANID = 0x02; + private static final int UTIL_SET_PRECFGKEY = 0x05; + private static final int UTIL_SET_SECLEVEL = 0x04; + private static final int ZB_GET_DEVICE_INFO = 0x06; + private static final int ZB_READ_CONFIGURATION = 0x04; + private static final int ZB_WRITE_CONFIGURATION = 0x05; + private static final int ZDO_EXT_NWK_INFO = 0x50; + private static final int ZDO_GET_LINK_KEY = 0x25; + private static final int ZDO_LEAVE_IND = 0xC9; + private static final int ZDO_MSG_CB_INCOMING = 0xFF; + private static final int ZDO_MSG_CB_REGISTER = 0x3E; + private static final int ZDO_NWK_DISCOVERY_REQ = 0x26; + private static final int ZDO_REMOVE_LINK_KEY = 0x24; + private static final int ZDO_SET_LINK_KEY = 0x23; + private static final int ZDO_STARTUP_FROM_APP = 0x40; + private static final int ZDO_STATE_CHANGE_IND = 0xC0; + private static final int ZDO_TC_DEV_IND = 0xCA; + + private static Map> zstackFrameMap = new HashMap>(); + + static { + zstackFrameMap.put(ZSTACK_AF + AF_DATA_CONFIRM, ZstackAfDataConfirmAreq.class); + zstackFrameMap.put(ZSTACK_AF + AF_DATA_REQUEST, ZstackAfDataRequestSrsp.class); + zstackFrameMap.put(ZSTACK_AF + AF_INCOMING_MSG, ZstackAfIncomingMsgAreq.class); + zstackFrameMap.put(ZSTACK_AF + AF_REGISTER, ZstackAfRegisterSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_ADD_INSTALLCODE, ZstackAppCnfBdbAddInstallcodeSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_COMMISSIONING_NOTIFICATION, ZstackAppCnfBdbCommissioningNotificationAreq.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY, ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_CHANNEL, ZstackAppCnfBdbSetChannelSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY, ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE, ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.class); + zstackFrameMap.put(ZSTACK_APP_CNF + APP_CNF_SET_ALLOWREJOIN_TC_POLICY, ZstackAppCnfSetAllowrejoinTcPolicySrsp.class); + zstackFrameMap.put(ZSTACK_MAC + MAC_SCAN_REQ, ZstackMacScanReqSrsp.class); + zstackFrameMap.put(ZSTACK_RPC + RPC_SREQ_ERROR, ZstackRpcSreqErrorSrsp.class); + zstackFrameMap.put(ZSTACK_SBL + SB_HANDSHAKE_CMD, ZstackSbHandshakeCmdSrsp.class); + zstackFrameMap.put(ZSTACK_SBL + SB_WRITE_CMD, ZstackSbWriteCmdSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_GET_EXT_ADDR, ZstackSysGetExtAddrSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_NV_READ, ZstackSysNvReadSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_READ, ZstackSysOsalNvReadSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_OSAL_NV_WRITE, ZstackSysOsalNvWriteSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_PING, ZstackSysPingSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_RESET_IND, ZstackSysResetIndAreq.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_SET_EXT_ADDR, ZstackSysSetExtAddrSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_SET_TX_POWER, ZstackSysSetTxPowerSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_VERSION, ZstackSysVersionSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_CLEAR_STATS, ZstackSysZdiagsClearStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_GET_STATS, ZstackSysZdiagsGetStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_INIT_STATS, ZstackSysZdiagsInitStatsSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_RESTORE_STATS_NV, ZstackSysZdiagsRestoreStatsNvSrsp.class); + zstackFrameMap.put(ZSTACK_SYS + SYS_ZDIAGS_SAVE_STATS_TO_NV, ZstackSysZdiagsSaveStatsToNvSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_DATA_GET, ZstackUtilApsmeLinkKeyDataGetSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_APSME_LINK_KEY_NV_ID_GET, ZstackUtilApsmeLinkKeyNvIdGetSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_DEVICE_INFO, ZstackUtilGetDeviceInfoSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_GET_NV_INFO, ZstackUtilGetNvInfoSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_LED_CONTROL, ZstackUtilLedControlSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_CHANNELS, ZstackUtilSetChannelsSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PANID, ZstackUtilSetPanidSrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_PRECFGKEY, ZstackUtilSetPrecfgkeySrsp.class); + zstackFrameMap.put(ZSTACK_UTIL + UTIL_SET_SECLEVEL, ZstackUtilSetSeclevelSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_GET_DEVICE_INFO, ZstackZbGetDeviceInfoSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_READ_CONFIGURATION, ZstackZbReadConfigurationSrsp.class); + zstackFrameMap.put(ZSTACK_SAPI + ZB_WRITE_CONFIGURATION, ZstackZbWriteConfigurationSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_EXT_NWK_INFO, ZstackZdoExtNwkInfoSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_GET_LINK_KEY, ZstackZdoGetLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_LEAVE_IND, ZstackZdoLeaveIndAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_INCOMING, ZstackZdoMsgCbIncomingAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_MSG_CB_REGISTER, ZstackZdoMsgCbRegisterSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_NWK_DISCOVERY_REQ, ZstackZdoNwkDiscoveryReqSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_REMOVE_LINK_KEY, ZstackZdoRemoveLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_SET_LINK_KEY, ZstackZdoSetLinkKeySrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_STARTUP_FROM_APP, ZstackZdoStartupFromAppSrsp.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_STATE_CHANGE_IND, ZstackZdoStateChangeIndAreq.class); + zstackFrameMap.put(ZSTACK_ZDO + ZDO_TC_DEV_IND, ZstackZdoTcDevIndAreq.class); + } + + /** + * Creates and {@link ZstackFrameResponse} from the incoming data. + * + * @param data the int[] containing the ZStack data from which to generate the frame + * @return the {@link ZstackFrameResponse} or null if the response can't be created. + */ + public static ZstackFrameResponse createFrame(int[] data) { + if (data.length < 2) { + return null; + } + + int cmdId = ((data[0] & ZSTACK_SUBSYSTEM_MASK) << 8) + data[1]; + Class zstackClass = zstackFrameMap.get(cmdId); + + if (zstackClass == null) { + return null; + } + + Constructor ctor; + try { + ctor = zstackClass.getConstructor(int[].class); + return (ZstackFrameResponse) ctor.newInstance(data); + } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | InstantiationException + | IllegalAccessException | InvocationTargetException e) { + logger.debug("Error creating instance of ZstackCommand", e); + } + + return null; + } + + +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java index 7ff62ee6ea..c74b6589db 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/ZstackResponseCode.java @@ -1,129 +1,129 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackResponseCode. - *

    - * Global response codes - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackResponseCode { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - SUCCESS(0x0000), - - /** - * - */ - FAILURE(0x0001), - - /** - * - */ - AF_INVALID_PARAMETER(0x0002), - - /** - * Security manager key table full - */ - AF_MEM_FAIL(0x0010), - - /** - * Security manager key table full - */ - KEY_TABLE_FULL(0x0011), - - /** - * The operation could not be completed because no memory resources were available - */ - MAC_NO_RESOURCES(0x001A), - - /** - * Invalid Request - */ - INVALID_REQUEST(0x00C2), - - /** - * Not Permitted - */ - NOT_PERMITTED(0x00C3), - - /** - * Unknown Device - */ - UNKNOWN_DEVICE(0x00C8), - - /** - * - */ - AF_NO_ROUTE(0x00CD), - - /** - * The scan request failed because a scan is already in progress - */ - MAC_SCAN_IN_PROGRESS(0x00FC), - - /** - * The outstanding transaction has expired - */ - MAC_TRANSACTION_EXPIRED(0x00F0); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackResponseCode s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackResponseCode(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackResponseCode valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResponseCode. + *

    + * Global response codes + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResponseCode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + SUCCESS(0x0000), + + /** + * + */ + FAILURE(0x0001), + + /** + * + */ + AF_INVALID_PARAMETER(0x0002), + + /** + * Security manager key table full + */ + AF_MEM_FAIL(0x0010), + + /** + * Security manager key table full + */ + KEY_TABLE_FULL(0x0011), + + /** + * The operation could not be completed because no memory resources were available + */ + MAC_NO_RESOURCES(0x001A), + + /** + * Invalid Request + */ + INVALID_REQUEST(0x00C2), + + /** + * Not Permitted + */ + NOT_PERMITTED(0x00C3), + + /** + * Unknown Device + */ + UNKNOWN_DEVICE(0x00C8), + + /** + * + */ + AF_NO_ROUTE(0x00CD), + + /** + * The scan request failed because a scan is already in progress + */ + MAC_SCAN_IN_PROGRESS(0x00FC), + + /** + * The outstanding transaction has expired + */ + MAC_TRANSACTION_EXPIRED(0x00F0); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResponseCode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResponseCode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResponseCode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java index d53716698e..d385f2e5fe 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/AfDataOptions.java @@ -1,82 +1,82 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration AfDataOptions. - *

    - * Options applied when sending frames - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum AfDataOptions { - - /** - * Set this bit to request APS acknowledgement for this packet - */ - AF_ACK_REQUEST(0x0010), - - /** - * Set this bit to force route discovery if a routing table entry doesn’t exist - */ - AF_DISCV_ROUTE(0x0020), - - /** - * Set this bit to enable APS security for this packet. - */ - AF_EN_SECURITY(0x0040), - - /** - * Skip routing. - */ - AF_NO_ROUTING(0x0080); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (AfDataOptions s : values()) { - codeMapping.put(s.key, s); - } - } - - private AfDataOptions(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static AfDataOptions valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration AfDataOptions. + *

    + * Options applied when sending frames + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum AfDataOptions { + + /** + * Set this bit to request APS acknowledgement for this packet + */ + AF_ACK_REQUEST(0x0010), + + /** + * Set this bit to force route discovery if a routing table entry doesn’t exist + */ + AF_DISCV_ROUTE(0x0020), + + /** + * Set this bit to enable APS security for this packet. + */ + AF_EN_SECURITY(0x0040), + + /** + * Skip routing. + */ + AF_NO_ROUTING(0x0080); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (AfDataOptions s : values()) { + codeMapping.put(s.key, s); + } + } + + private AfDataOptions(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static AfDataOptions valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java index e0680b3c9c..bda5a24c79 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataConfirmAreq.java @@ -1,124 +1,125 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command AF_DATA_CONFIRM. - *

    - * This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a - * AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status - * of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm - * carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This - * also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of - * the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS - * acknowledgement is received. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfDataConfirmAreq extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Endpoint of the device. - */ - private int endpoint; - - /** - * Specifies the transaction sequence number of the message. - */ - private int transId; - - /** - * Response and Handler constructor - */ - public ZstackAfDataConfirmAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - endpoint = deserializer.deserializeUInt8(); - transId = deserializer.deserializeUInt8(); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * Endpoint of the device. - * - * @return the current endpoint as {@link int} - */ - public int getEndpoint() { - return endpoint; - } - - /** - * Endpoint of the device. - * - * @param endpoint the Endpoint to set as {@link int} - */ - public void setEndpoint(int endpoint) { - this.endpoint = endpoint; - } - - /** - * Specifies the transaction sequence number of the message. - * - * @return the current transId as {@link int} - */ - public int getTransId() { - return transId; - } - - /** - * Specifies the transaction sequence number of the message. - * - * @param transId the TransId to set as {@link int} - */ - public void setTransId(int transId) { - this.transId = transId; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(101); - builder.append("ZstackAfDataConfirmAreq [status="); - builder.append(status); - builder.append(", endpoint="); - builder.append(String.format("%02X", endpoint)); - builder.append(", transId="); - builder.append(String.format("%02X", transId)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_DATA_CONFIRM. + *

    + * This command is sent by the device to the user after it receives an AF_DATA_REQUEST. For each AF_DATA_REQUEST, a + * AF_DATA_CONFIRM is always returned. If APS acknowledgement was used for the AF_DATA_REQUEST, the confirm carries the status + * of whether the APS acknowledgement was received or not (ZApsNoAck – 0xb7). If APS acknowledgement was not used, then the confirm + * carries the status of whether the MAC acknowledgement (“next hop” acknowledgment) was received or not (ZMacNoACK – 0xe9). This + * also applies to packets that are sent using AF_DATA_REQUEST_EXT and AF_DATA_STORE. For APS fragmented packets, the value of + * the configuration item ZCD_NV_APSF_WINDOW_SIZE determines when an AF_DATA_CONFIRM that carries the status of the APS + * acknowledgement is received. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfDataConfirmAreq extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Endpoint of the device. + */ + private int endpoint; + + /** + * Specifies the transaction sequence number of the message. + */ + private int transId; + + /** + * Response and Handler constructor + */ + public ZstackAfDataConfirmAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + endpoint = deserializer.deserializeUInt8(); + transId = deserializer.deserializeUInt8(); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Endpoint of the device. + * + * @return the current endpoint as {@link int} + */ + public int getEndpoint() { + return endpoint; + } + + /** + * Endpoint of the device. + * + * @param endpoint the Endpoint to set as {@link int} + */ + public void setEndpoint(int endpoint) { + this.endpoint = endpoint; + } + + /** + * Specifies the transaction sequence number of the message. + * + * @return the current transId as {@link int} + */ + public int getTransId() { + return transId; + } + + /** + * Specifies the transaction sequence number of the message. + * + * @param transId the TransId to set as {@link int} + */ + public void setTransId(int transId) { + this.transId = transId; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackAfDataConfirmAreq [status="); + builder.append(status); + builder.append(", endpoint="); + builder.append(String.format("%02X", endpoint)); + builder.append(", transId="); + builder.append(String.format("%02X", transId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java index fc19d27a90..7b8fa96d11 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSreq.java @@ -1,290 +1,291 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import java.util.HashSet; -import java.util.Set; - -/** - * Class to implement the Z-Stack command AF_DATA_REQUEST. - *

    - * This command is used by the App processor to build and send a message through AF layer. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfDataRequestSreq extends ZstackFrameRequest { - - /** - * Short address of the destination device. - */ - private int dstAddr; - - /** - * Endpoint of the destination device. - */ - private int destEndpoint; - - /** - * Endpoint of the source device. - */ - private int srcEndpoint; - - /** - * Specifies the cluster ID. - */ - private int clusterId; - - /** - * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This - * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. - */ - private int transId; - - /** - * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. - * For example, a value of 0x10 means that bit 4 is set. - *

    - * Parameter allows multiple options so implemented as a {@link Set}. - */ - private Set options = new HashSet<>(); - - /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). - */ - private int radius; - - /** - * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). - */ - private int[] data; - - /** - * Request constructor - */ - public ZstackAfDataRequestSreq() { - synchronousCommand = true; - } - - /** - * Short address of the destination device. - * - * @return the current dstAddr as {@link int} - */ - public int getDstAddr() { - return dstAddr; - } - - /** - * Short address of the destination device. - * - * @param dstAddr the DstAddr to set as {@link int} - */ - public void setDstAddr(int dstAddr) { - this.dstAddr = dstAddr; - } - - /** - * Endpoint of the destination device. - * - * @return the current destEndpoint as {@link int} - */ - public int getDestEndpoint() { - return destEndpoint; - } - - /** - * Endpoint of the destination device. - * - * @param destEndpoint the DestEndpoint to set as {@link int} - */ - public void setDestEndpoint(int destEndpoint) { - this.destEndpoint = destEndpoint; - } - - /** - * Endpoint of the source device. - * - * @return the current srcEndpoint as {@link int} - */ - public int getSrcEndpoint() { - return srcEndpoint; - } - - /** - * Endpoint of the source device. - * - * @param srcEndpoint the SrcEndpoint to set as {@link int} - */ - public void setSrcEndpoint(int srcEndpoint) { - this.srcEndpoint = srcEndpoint; - } - - /** - * Specifies the cluster ID. - * - * @return the current clusterId as {@link int} - */ - public int getClusterID() { - return clusterId; - } - - /** - * Specifies the cluster ID. - * - * @param clusterId the ClusterID to set as {@link int} - */ - public void setClusterID(int clusterId) { - this.clusterId = clusterId; - } - - /** - * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This - * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. - * - * @return the current transId as {@link int} - */ - public int getTransID() { - return transId; - } - - /** - * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This - * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. - * - * @param transId the TransID to set as {@link int} - */ - public void setTransID(int transId) { - this.transId = transId; - } - - /** - * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. - * For example, a value of 0x10 means that bit 4 is set. - * - * @return the current options as {@link Set} of {@link AfDataOptions} - */ - public Set getOptions() { - return options; - } - - /** - * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. - * For example, a value of 0x10 means that bit 4 is set. - * - * @param options the Options to add to the {@link Set} as {@link AfDataOptions} - */ - public void addOptions(AfDataOptions options) { - this.options.add(options); - } - - /** - * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. - * For example, a value of 0x10 means that bit 4 is set. - * - * @param options the Options to remove to the {@link Set} as {@link AfDataOptions} - */ - public void removeOptions(AfDataOptions options) { - this.options.remove(options); - } - - /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). - * - * @return the current radius as {@link int} - */ - public int getRadius() { - return radius; - } - - /** - * Specifies the list of Input Cluster Ids ( 2bytes each ). - * - * @param radius the Radius to set as {@link int} - */ - public void setRadius(int radius) { - this.radius = radius; - } - - /** - * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). - * - * @return the current data as {@link int[]} - */ - public int[] getData() { - return data; - } - - /** - * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). - * - * @param data the Data to set as {@link int[]} - */ - public void setData(int[] data) { - this.data = data; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x01)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x01); - - // Serialize the fields - serializer.serializeUInt16(dstAddr); - serializer.serializeUInt8(destEndpoint); - serializer.serializeUInt8(srcEndpoint); - serializer.serializeUInt16(clusterId); - serializer.serializeUInt8(transId); - int tmpOptions = 0; - for (AfDataOptions value : options) { - tmpOptions += value.getKey(); - } - serializer.serializeUInt8(tmpOptions); - serializer.serializeUInt8(radius); - serializer.serializeUInt8(data.length); - serializer.serializeUInt8Array(data); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(251); - builder.append("ZstackAfDataRequestSreq [dstAddr="); - builder.append(String.format("%04X", dstAddr)); - builder.append(", destEndpoint="); - builder.append(String.format("%02X", destEndpoint)); - builder.append(", srcEndpoint="); - builder.append(String.format("%02X", srcEndpoint)); - builder.append(", clusterId="); - builder.append(String.format("%04X", clusterId)); - builder.append(", transId="); - builder.append(String.format("%02X", transId)); - builder.append(", options="); - builder.append(options); - builder.append(", radius="); - builder.append(radius); - builder.append(", data="); - for (int c = 0; c < data.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", data[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.af.AfDataOptions; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import java.util.HashSet; +import java.util.Set; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_DATA_REQUEST. + *

    + * This command is used by the App processor to build and send a message through AF layer. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfDataRequestSreq extends ZstackFrameRequest { + + /** + * Short address of the destination device. + */ + private int dstAddr; + + /** + * Endpoint of the destination device. + */ + private int destEndpoint; + + /** + * Endpoint of the source device. + */ + private int srcEndpoint; + + /** + * Specifies the cluster ID. + */ + private int clusterId; + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + */ + private int transId; + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + *

    + * Parameter allows multiple options so implemented as a {@link Set}. + */ + private Set options = new HashSet<>(); + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + */ + private int radius; + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + */ + private int[] data; + + /** + * Request constructor + */ + public ZstackAfDataRequestSreq() { + synchronousCommand = true; + } + + /** + * Short address of the destination device. + * + * @return the current dstAddr as {@link int} + */ + public int getDstAddr() { + return dstAddr; + } + + /** + * Short address of the destination device. + * + * @param dstAddr the DstAddr to set as {@link int} + */ + public void setDstAddr(int dstAddr) { + this.dstAddr = dstAddr; + } + + /** + * Endpoint of the destination device. + * + * @return the current destEndpoint as {@link int} + */ + public int getDestEndpoint() { + return destEndpoint; + } + + /** + * Endpoint of the destination device. + * + * @param destEndpoint the DestEndpoint to set as {@link int} + */ + public void setDestEndpoint(int destEndpoint) { + this.destEndpoint = destEndpoint; + } + + /** + * Endpoint of the source device. + * + * @return the current srcEndpoint as {@link int} + */ + public int getSrcEndpoint() { + return srcEndpoint; + } + + /** + * Endpoint of the source device. + * + * @param srcEndpoint the SrcEndpoint to set as {@link int} + */ + public void setSrcEndpoint(int srcEndpoint) { + this.srcEndpoint = srcEndpoint; + } + + /** + * Specifies the cluster ID. + * + * @return the current clusterId as {@link int} + */ + public int getClusterID() { + return clusterId; + } + + /** + * Specifies the cluster ID. + * + * @param clusterId the ClusterID to set as {@link int} + */ + public void setClusterID(int clusterId) { + this.clusterId = clusterId; + } + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + * + * @return the current transId as {@link int} + */ + public int getTransID() { + return transId; + } + + /** + * Specifies the transaction sequence number of the message. The corresponding AF_DATA_CONFIRM will have the same TransID. This + * can be useful if the application wishes to match up AF_DATA_REQUESTs with AF_DATA_CONFIRMs. + * + * @param transId the TransID to set as {@link int} + */ + public void setTransID(int transId) { + this.transId = transId; + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @return the current options as {@link Set} of {@link AfDataOptions} + */ + public Set getOptions() { + return options; + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @param options the Options to add to the {@link Set} as {@link AfDataOptions} + */ + public void addOptions(AfDataOptions options) { + this.options.add(options); + } + + /** + * The transmit options field is organized as a bitmask. The following enumerates the values for the various supported bitmasks. + * For example, a value of 0x10 means that bit 4 is set. + * + * @param options the Options to remove to the {@link Set} as {@link AfDataOptions} + */ + public void removeOptions(AfDataOptions options) { + this.options.remove(options); + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @return the current radius as {@link int} + */ + public int getRadius() { + return radius; + } + + /** + * Specifies the list of Input Cluster Ids ( 2bytes each ). + * + * @param radius the Radius to set as {@link int} + */ + public void setRadius(int radius) { + this.radius = radius; + } + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * 0-99 bytes data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 bytes). + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x01); + + // Serialize the fields + serializer.serializeUInt16(dstAddr); + serializer.serializeUInt8(destEndpoint); + serializer.serializeUInt8(srcEndpoint); + serializer.serializeUInt16(clusterId); + serializer.serializeUInt8(transId); + int tmpOptions = 0; + for (AfDataOptions value : options) { + tmpOptions += value.getKey(); + } + serializer.serializeUInt8(tmpOptions); + serializer.serializeUInt8(radius); + serializer.serializeUInt8(data.length); + serializer.serializeUInt8Array(data); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(251); + builder.append("ZstackAfDataRequestSreq [dstAddr="); + builder.append(String.format("%04X", dstAddr)); + builder.append(", destEndpoint="); + builder.append(String.format("%02X", destEndpoint)); + builder.append(", srcEndpoint="); + builder.append(String.format("%02X", srcEndpoint)); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", transId="); + builder.append(String.format("%02X", transId)); + builder.append(", options="); + builder.append(options); + builder.append(", radius="); + builder.append(radius); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java index afcc1c3180..bf404068a6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfDataRequestSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command AF_DATA_REQUEST. - *

    - * This command is used by the App processor to build and send a message through AF layer. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfDataRequestSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAfDataRequestSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackAfDataRequestSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_DATA_REQUEST. + *

    + * This command is used by the App processor to build and send a message through AF layer. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfDataRequestSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAfDataRequestSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackAfDataRequestSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java index d985a7e389..b461d84ec4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfIncomingMsgAreq.java @@ -1,334 +1,335 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command AF_INCOMING_MSG. - *

    - * This callback message is in response to incoming data to any of the registered endpoints on this device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfIncomingMsgAreq extends ZstackFrameResponse { - - /** - * Specifies the group ID of the device. - */ - private int groupId; - - /** - * Specifies the cluster ID. - */ - private int clusterId; - - /** - * Specifies the ZigBee network address of the source device sending the message. - */ - private int srcAddr; - - /** - * Specifies the source endpoint of the message. - */ - private int srcEndpoint; - - /** - * Specifies the destination endpoint of the message. - */ - private int destEndpoint; - - /** - * Specifies if the message was a broadcast or not. - */ - private boolean wasBroadcast; - - /** - * Indicates the link quality measured during reception. - */ - private int linkQuality; - - /** - * Specifies if the security is used or not. - */ - private boolean securityUse; - - /** - * Specifies the timestamp of the message. - */ - private int timeStamp; - - /** - * Specifies transaction sequence number of the message. - */ - private int seqNumber; - - /** - * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 - * bytes). - */ - private int[] data; - - /** - * Response and Handler constructor - */ - public ZstackAfIncomingMsgAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - groupId = deserializer.deserializeUInt16(); - clusterId = deserializer.deserializeUInt16(); - srcAddr = deserializer.deserializeUInt16(); - srcEndpoint = deserializer.deserializeUInt8(); - destEndpoint = deserializer.deserializeUInt8(); - wasBroadcast = deserializer.deserializeBoolean(); - linkQuality = deserializer.deserializeUInt8(); - securityUse = deserializer.deserializeBoolean(); - timeStamp = deserializer.deserializeUInt32(); - seqNumber = deserializer.deserializeUInt8(); - int len = deserializer.deserializeUInt8(); - data = deserializer.deserializeUInt8Array(len); - } - - /** - * Specifies the group ID of the device. - * - * @return the current groupId as {@link int} - */ - public int getGroupId() { - return groupId; - } - - /** - * Specifies the group ID of the device. - * - * @param groupId the GroupId to set as {@link int} - */ - public void setGroupId(int groupId) { - this.groupId = groupId; - } - - /** - * Specifies the cluster ID. - * - * @return the current clusterId as {@link int} - */ - public int getClusterId() { - return clusterId; - } - - /** - * Specifies the cluster ID. - * - * @param clusterId the ClusterId to set as {@link int} - */ - public void setClusterId(int clusterId) { - this.clusterId = clusterId; - } - - /** - * Specifies the ZigBee network address of the source device sending the message. - * - * @return the current srcAddr as {@link int} - */ - public int getSrcAddr() { - return srcAddr; - } - - /** - * Specifies the ZigBee network address of the source device sending the message. - * - * @param srcAddr the SrcAddr to set as {@link int} - */ - public void setSrcAddr(int srcAddr) { - this.srcAddr = srcAddr; - } - - /** - * Specifies the source endpoint of the message. - * - * @return the current srcEndpoint as {@link int} - */ - public int getSrcEndpoint() { - return srcEndpoint; - } - - /** - * Specifies the source endpoint of the message. - * - * @param srcEndpoint the SrcEndpoint to set as {@link int} - */ - public void setSrcEndpoint(int srcEndpoint) { - this.srcEndpoint = srcEndpoint; - } - - /** - * Specifies the destination endpoint of the message. - * - * @return the current destEndpoint as {@link int} - */ - public int getDestEndpoint() { - return destEndpoint; - } - - /** - * Specifies the destination endpoint of the message. - * - * @param destEndpoint the DestEndpoint to set as {@link int} - */ - public void setDestEndpoint(int destEndpoint) { - this.destEndpoint = destEndpoint; - } - - /** - * Specifies if the message was a broadcast or not. - * - * @return the current wasBroadcast as {@link boolean} - */ - public boolean getWasBroadcast() { - return wasBroadcast; - } - - /** - * Specifies if the message was a broadcast or not. - * - * @param wasBroadcast the WasBroadcast to set as {@link boolean} - */ - public void setWasBroadcast(boolean wasBroadcast) { - this.wasBroadcast = wasBroadcast; - } - - /** - * Indicates the link quality measured during reception. - * - * @return the current linkQuality as {@link int} - */ - public int getLinkQuality() { - return linkQuality; - } - - /** - * Indicates the link quality measured during reception. - * - * @param linkQuality the LinkQuality to set as {@link int} - */ - public void setLinkQuality(int linkQuality) { - this.linkQuality = linkQuality; - } - - /** - * Specifies if the security is used or not. - * - * @return the current securityUse as {@link boolean} - */ - public boolean getSecurityUse() { - return securityUse; - } - - /** - * Specifies if the security is used or not. - * - * @param securityUse the SecurityUse to set as {@link boolean} - */ - public void setSecurityUse(boolean securityUse) { - this.securityUse = securityUse; - } - - /** - * Specifies the timestamp of the message. - * - * @return the current timeStamp as {@link int} - */ - public int getTimeStamp() { - return timeStamp; - } - - /** - * Specifies the timestamp of the message. - * - * @param timeStamp the TimeStamp to set as {@link int} - */ - public void setTimeStamp(int timeStamp) { - this.timeStamp = timeStamp; - } - - /** - * Specifies transaction sequence number of the message. - * - * @return the current seqNumber as {@link int} - */ - public int getSeqNumber() { - return seqNumber; - } - - /** - * Specifies transaction sequence number of the message. - * - * @param seqNumber the SeqNumber to set as {@link int} - */ - public void setSeqNumber(int seqNumber) { - this.seqNumber = seqNumber; - } - - /** - * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 - * bytes). - * - * @return the current data as {@link int[]} - */ - public int[] getData() { - return data; - } - - /** - * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 - * bytes). - * - * @param data the Data to set as {@link int[]} - */ - public void setData(int[] data) { - this.data = data; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(326); - builder.append("ZstackAfIncomingMsgAreq [groupId="); - builder.append(String.format("%04X", groupId)); - builder.append(", clusterId="); - builder.append(String.format("%04X", clusterId)); - builder.append(", srcAddr="); - builder.append(String.format("%04X", srcAddr)); - builder.append(", srcEndpoint="); - builder.append(String.format("%02X", srcEndpoint)); - builder.append(", destEndpoint="); - builder.append(String.format("%02X", destEndpoint)); - builder.append(", wasBroadcast="); - builder.append(wasBroadcast); - builder.append(", linkQuality="); - builder.append(linkQuality); - builder.append(", securityUse="); - builder.append(securityUse); - builder.append(", timeStamp="); - builder.append(String.format("%08X", timeStamp)); - builder.append(", seqNumber="); - builder.append(String.format("%02X", seqNumber)); - builder.append(", data="); - for (int c = 0; c < data.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", data[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_INCOMING_MSG. + *

    + * This callback message is in response to incoming data to any of the registered endpoints on this device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfIncomingMsgAreq extends ZstackFrameResponse { + + /** + * Specifies the group ID of the device. + */ + private int groupId; + + /** + * Specifies the cluster ID. + */ + private int clusterId; + + /** + * Specifies the ZigBee network address of the source device sending the message. + */ + private int srcAddr; + + /** + * Specifies the source endpoint of the message. + */ + private int srcEndpoint; + + /** + * Specifies the destination endpoint of the message. + */ + private int destEndpoint; + + /** + * Specifies if the message was a broadcast or not. + */ + private boolean wasBroadcast; + + /** + * Indicates the link quality measured during reception. + */ + private int linkQuality; + + /** + * Specifies if the security is used or not. + */ + private boolean securityUse; + + /** + * Specifies the timestamp of the message. + */ + private int timeStamp; + + /** + * Specifies transaction sequence number of the message. + */ + private int seqNumber; + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + */ + private int[] data; + + /** + * Response and Handler constructor + */ + public ZstackAfIncomingMsgAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + groupId = deserializer.deserializeUInt16(); + clusterId = deserializer.deserializeUInt16(); + srcAddr = deserializer.deserializeUInt16(); + srcEndpoint = deserializer.deserializeUInt8(); + destEndpoint = deserializer.deserializeUInt8(); + wasBroadcast = deserializer.deserializeBoolean(); + linkQuality = deserializer.deserializeUInt8(); + securityUse = deserializer.deserializeBoolean(); + timeStamp = deserializer.deserializeUInt32(); + seqNumber = deserializer.deserializeUInt8(); + int len = deserializer.deserializeUInt8(); + data = deserializer.deserializeUInt8Array(len); + } + + /** + * Specifies the group ID of the device. + * + * @return the current groupId as {@link int} + */ + public int getGroupId() { + return groupId; + } + + /** + * Specifies the group ID of the device. + * + * @param groupId the GroupId to set as {@link int} + */ + public void setGroupId(int groupId) { + this.groupId = groupId; + } + + /** + * Specifies the cluster ID. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * Specifies the cluster ID. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + /** + * Specifies the ZigBee network address of the source device sending the message. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Specifies the ZigBee network address of the source device sending the message. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * Specifies the source endpoint of the message. + * + * @return the current srcEndpoint as {@link int} + */ + public int getSrcEndpoint() { + return srcEndpoint; + } + + /** + * Specifies the source endpoint of the message. + * + * @param srcEndpoint the SrcEndpoint to set as {@link int} + */ + public void setSrcEndpoint(int srcEndpoint) { + this.srcEndpoint = srcEndpoint; + } + + /** + * Specifies the destination endpoint of the message. + * + * @return the current destEndpoint as {@link int} + */ + public int getDestEndpoint() { + return destEndpoint; + } + + /** + * Specifies the destination endpoint of the message. + * + * @param destEndpoint the DestEndpoint to set as {@link int} + */ + public void setDestEndpoint(int destEndpoint) { + this.destEndpoint = destEndpoint; + } + + /** + * Specifies if the message was a broadcast or not. + * + * @return the current wasBroadcast as {@link boolean} + */ + public boolean getWasBroadcast() { + return wasBroadcast; + } + + /** + * Specifies if the message was a broadcast or not. + * + * @param wasBroadcast the WasBroadcast to set as {@link boolean} + */ + public void setWasBroadcast(boolean wasBroadcast) { + this.wasBroadcast = wasBroadcast; + } + + /** + * Indicates the link quality measured during reception. + * + * @return the current linkQuality as {@link int} + */ + public int getLinkQuality() { + return linkQuality; + } + + /** + * Indicates the link quality measured during reception. + * + * @param linkQuality the LinkQuality to set as {@link int} + */ + public void setLinkQuality(int linkQuality) { + this.linkQuality = linkQuality; + } + + /** + * Specifies if the security is used or not. + * + * @return the current securityUse as {@link boolean} + */ + public boolean getSecurityUse() { + return securityUse; + } + + /** + * Specifies if the security is used or not. + * + * @param securityUse the SecurityUse to set as {@link boolean} + */ + public void setSecurityUse(boolean securityUse) { + this.securityUse = securityUse; + } + + /** + * Specifies the timestamp of the message. + * + * @return the current timeStamp as {@link int} + */ + public int getTimeStamp() { + return timeStamp; + } + + /** + * Specifies the timestamp of the message. + * + * @param timeStamp the TimeStamp to set as {@link int} + */ + public void setTimeStamp(int timeStamp) { + this.timeStamp = timeStamp; + } + + /** + * Specifies transaction sequence number of the message. + * + * @return the current seqNumber as {@link int} + */ + public int getSeqNumber() { + return seqNumber; + } + + /** + * Specifies transaction sequence number of the message. + * + * @param seqNumber the SeqNumber to set as {@link int} + */ + public void setSeqNumber(int seqNumber) { + this.seqNumber = seqNumber; + } + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * Contains 0 to 99 bytes of data. Without any security (99 bytes), with NWK security (81 bytes), with NWK and APS security (64 + * bytes). + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(326); + builder.append("ZstackAfIncomingMsgAreq [groupId="); + builder.append(String.format("%04X", groupId)); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", srcEndpoint="); + builder.append(String.format("%02X", srcEndpoint)); + builder.append(", destEndpoint="); + builder.append(String.format("%02X", destEndpoint)); + builder.append(", wasBroadcast="); + builder.append(wasBroadcast); + builder.append(", linkQuality="); + builder.append(linkQuality); + builder.append(", securityUse="); + builder.append(securityUse); + builder.append(", timeStamp="); + builder.append(String.format("%08X", timeStamp)); + builder.append(", seqNumber="); + builder.append(String.format("%02X", seqNumber)); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java index f9941b60b4..1b45701a82 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSreq.java @@ -1,248 +1,249 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command AF_REGISTER. - *

    - * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). - * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where - * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint - * description per application profile. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfRegisterSreq extends ZstackFrameRequest { - - /** - * Specifies the endpoint of this simple descriptor. - */ - private int endPoint; - - /** - * Specifies the profile id of the application. - */ - private int appProfId; - - /** - * Specifies the device description id for this endpoint. - */ - private int appDeviceId; - - /** - * Specifies the device version number. - */ - private int appDevVer; - - /** - * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons - */ - private int latencyReq; - - /** - * Specifies the list of Input Cluster Ids (2 bytes each). - */ - private int[] appInClusterList; - - /** - * Specifies the list of Output Cluster Ids (2 bytes each) - */ - private int[] appOutClusterList; - - /** - * Request constructor - */ - public ZstackAfRegisterSreq() { - synchronousCommand = true; - } - - /** - * Specifies the endpoint of this simple descriptor. - * - * @return the current endPoint as {@link int} - */ - public int getEndPoint() { - return endPoint; - } - - /** - * Specifies the endpoint of this simple descriptor. - * - * @param endPoint the EndPoint to set as {@link int} - */ - public void setEndPoint(int endPoint) { - this.endPoint = endPoint; - } - - /** - * Specifies the profile id of the application. - * - * @return the current appProfId as {@link int} - */ - public int getAppProfId() { - return appProfId; - } - - /** - * Specifies the profile id of the application. - * - * @param appProfId the AppProfId to set as {@link int} - */ - public void setAppProfId(int appProfId) { - this.appProfId = appProfId; - } - - /** - * Specifies the device description id for this endpoint. - * - * @return the current appDeviceId as {@link int} - */ - public int getAppDeviceId() { - return appDeviceId; - } - - /** - * Specifies the device description id for this endpoint. - * - * @param appDeviceId the AppDeviceId to set as {@link int} - */ - public void setAppDeviceId(int appDeviceId) { - this.appDeviceId = appDeviceId; - } - - /** - * Specifies the device version number. - * - * @return the current appDevVer as {@link int} - */ - public int getAppDevVer() { - return appDevVer; - } - - /** - * Specifies the device version number. - * - * @param appDevVer the AppDevVer to set as {@link int} - */ - public void setAppDevVer(int appDevVer) { - this.appDevVer = appDevVer; - } - - /** - * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons - * - * @return the current latencyReq as {@link int} - */ - public int getLatencyReq() { - return latencyReq; - } - - /** - * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons - * - * @param latencyReq the LatencyReq to set as {@link int} - */ - public void setLatencyReq(int latencyReq) { - this.latencyReq = latencyReq; - } - - /** - * Specifies the list of Input Cluster Ids (2 bytes each). - * - * @return the current appInClusterList as {@link int[]} - */ - public int[] getAppInClusterList() { - return appInClusterList; - } - - /** - * Specifies the list of Input Cluster Ids (2 bytes each). - * - * @param appInClusterList the AppInClusterList to set as {@link int[]} - */ - public void setAppInClusterList(int[] appInClusterList) { - this.appInClusterList = appInClusterList; - } - - /** - * Specifies the list of Output Cluster Ids (2 bytes each) - * - * @return the current appOutClusterList as {@link int[]} - */ - public int[] getAppOutClusterList() { - return appOutClusterList; - } - - /** - * Specifies the list of Output Cluster Ids (2 bytes each) - * - * @param appOutClusterList the AppOutClusterList to set as {@link int[]} - */ - public void setAppOutClusterList(int[] appOutClusterList) { - this.appOutClusterList = appOutClusterList; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x00)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x00); - - // Serialize the fields - serializer.serializeUInt8(endPoint); - serializer.serializeUInt16(appProfId); - serializer.serializeUInt16(appDeviceId); - serializer.serializeUInt8(appDevVer); - serializer.serializeUInt8(latencyReq); - serializer.serializeUInt8(appInClusterList.length); - serializer.serializeUInt16Array(appInClusterList); - serializer.serializeUInt8(appOutClusterList.length); - serializer.serializeUInt16Array(appOutClusterList); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(248); - builder.append("ZstackAfRegisterSreq [endPoint="); - builder.append(String.format("%02X", endPoint)); - builder.append(", appProfId="); - builder.append(String.format("%04X", appProfId)); - builder.append(", appDeviceId="); - builder.append(appDeviceId); - builder.append(", appDevVer="); - builder.append(appDevVer); - builder.append(", latencyReq="); - builder.append(latencyReq); - builder.append(", appInClusterList="); - for (int c = 0; c < appInClusterList.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%04X", appInClusterList[c])); - } - builder.append(", appOutClusterList="); - for (int c = 0; c < appOutClusterList.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%04X", appOutClusterList[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_REGISTER. + *

    + * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where + * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint + * description per application profile. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfRegisterSreq extends ZstackFrameRequest { + + /** + * Specifies the endpoint of this simple descriptor. + */ + private int endPoint; + + /** + * Specifies the profile id of the application. + */ + private int appProfId; + + /** + * Specifies the device description id for this endpoint. + */ + private int appDeviceId; + + /** + * Specifies the device version number. + */ + private int appDevVer; + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + */ + private int latencyReq; + + /** + * Specifies the list of Input Cluster Ids (2 bytes each). + */ + private int[] appInClusterList; + + /** + * Specifies the list of Output Cluster Ids (2 bytes each) + */ + private int[] appOutClusterList; + + /** + * Request constructor + */ + public ZstackAfRegisterSreq() { + synchronousCommand = true; + } + + /** + * Specifies the endpoint of this simple descriptor. + * + * @return the current endPoint as {@link int} + */ + public int getEndPoint() { + return endPoint; + } + + /** + * Specifies the endpoint of this simple descriptor. + * + * @param endPoint the EndPoint to set as {@link int} + */ + public void setEndPoint(int endPoint) { + this.endPoint = endPoint; + } + + /** + * Specifies the profile id of the application. + * + * @return the current appProfId as {@link int} + */ + public int getAppProfId() { + return appProfId; + } + + /** + * Specifies the profile id of the application. + * + * @param appProfId the AppProfId to set as {@link int} + */ + public void setAppProfId(int appProfId) { + this.appProfId = appProfId; + } + + /** + * Specifies the device description id for this endpoint. + * + * @return the current appDeviceId as {@link int} + */ + public int getAppDeviceId() { + return appDeviceId; + } + + /** + * Specifies the device description id for this endpoint. + * + * @param appDeviceId the AppDeviceId to set as {@link int} + */ + public void setAppDeviceId(int appDeviceId) { + this.appDeviceId = appDeviceId; + } + + /** + * Specifies the device version number. + * + * @return the current appDevVer as {@link int} + */ + public int getAppDevVer() { + return appDevVer; + } + + /** + * Specifies the device version number. + * + * @param appDevVer the AppDevVer to set as {@link int} + */ + public void setAppDevVer(int appDevVer) { + this.appDevVer = appDevVer; + } + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + * + * @return the current latencyReq as {@link int} + */ + public int getLatencyReq() { + return latencyReq; + } + + /** + * Specifies latency. For ZigBee the only applicable value is 0x00. 0x00-No latency 0x01-fast beacons 0x02-slow beacons + * + * @param latencyReq the LatencyReq to set as {@link int} + */ + public void setLatencyReq(int latencyReq) { + this.latencyReq = latencyReq; + } + + /** + * Specifies the list of Input Cluster Ids (2 bytes each). + * + * @return the current appInClusterList as {@link int[]} + */ + public int[] getAppInClusterList() { + return appInClusterList; + } + + /** + * Specifies the list of Input Cluster Ids (2 bytes each). + * + * @param appInClusterList the AppInClusterList to set as {@link int[]} + */ + public void setAppInClusterList(int[] appInClusterList) { + this.appInClusterList = appInClusterList; + } + + /** + * Specifies the list of Output Cluster Ids (2 bytes each) + * + * @return the current appOutClusterList as {@link int[]} + */ + public int[] getAppOutClusterList() { + return appOutClusterList; + } + + /** + * Specifies the list of Output Cluster Ids (2 bytes each) + * + * @param appOutClusterList the AppOutClusterList to set as {@link int[]} + */ + public void setAppOutClusterList(int[] appOutClusterList) { + this.appOutClusterList = appOutClusterList; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_AF) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_AF, 0x00); + + // Serialize the fields + serializer.serializeUInt8(endPoint); + serializer.serializeUInt16(appProfId); + serializer.serializeUInt16(appDeviceId); + serializer.serializeUInt8(appDevVer); + serializer.serializeUInt8(latencyReq); + serializer.serializeUInt8(appInClusterList.length); + serializer.serializeUInt16Array(appInClusterList); + serializer.serializeUInt8(appOutClusterList.length); + serializer.serializeUInt16Array(appOutClusterList); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(248); + builder.append("ZstackAfRegisterSreq [endPoint="); + builder.append(String.format("%02X", endPoint)); + builder.append(", appProfId="); + builder.append(String.format("%04X", appProfId)); + builder.append(", appDeviceId="); + builder.append(appDeviceId); + builder.append(", appDevVer="); + builder.append(appDevVer); + builder.append(", latencyReq="); + builder.append(latencyReq); + builder.append(", appInClusterList="); + for (int c = 0; c < appInClusterList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%04X", appInClusterList[c])); + } + builder.append(", appOutClusterList="); + for (int c = 0; c < appOutClusterList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%04X", appOutClusterList[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java index 4d9a261d27..2ae478fb92 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/af/ZstackAfRegisterSrsp.java @@ -1,71 +1,72 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.af; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command AF_REGISTER. - *

    - * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). - * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where - * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint - * description per application profile. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAfRegisterSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAfRegisterSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(48); - builder.append("ZstackAfRegisterSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.af; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command AF_REGISTER. + *

    + * This command enables the host processor to register an application’s endpoint description (and its simple descriptor). + * Multiple endpoints may be registered with the AF by making multiple calls to AF_REGISTER. This could be useful in the case where + * the device needs to support multiple application profiles, where each AF_REGISTER call would register a unique endpoint + * description per application profile. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackAfRegisterSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAfRegisterSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(48); + builder.append("ZstackAfRegisterSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java index f86dc6f756..5aff8234c5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSreq.java @@ -1,134 +1,135 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. - *

    - * Add a preconfigured key (plain key or IC) to Trust Center device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbAddInstallcodeSreq extends ZstackFrameRequest { - - /** - * This value specifies the format in which the install code is being added. The following list contains the values corresponding - * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code - */ - private ZstackInstallCodeFormat installCodeFormat; - - /** - * Full IEEE address for the device joining the network - */ - private IeeeAddress ieeeAddress; - - /** - * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC - */ - private ZigBeeKey installCode; - - /** - * Request constructor - */ - public ZstackAppCnfBdbAddInstallcodeSreq() { - synchronousCommand = true; - } - - /** - * This value specifies the format in which the install code is being added. The following list contains the values corresponding - * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code - * - * @return the current installCodeFormat as {@link ZstackInstallCodeFormat} - */ - public ZstackInstallCodeFormat getInstallCodeFormat() { - return installCodeFormat; - } - - /** - * This value specifies the format in which the install code is being added. The following list contains the values corresponding - * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code - * - * @param installCodeFormat the InstallCodeFormat to set as {@link ZstackInstallCodeFormat} - */ - public void setInstallCodeFormat(ZstackInstallCodeFormat installCodeFormat) { - this.installCodeFormat = installCodeFormat; - } - - /** - * Full IEEE address for the device joining the network - * - * @return the current ieeeAddress as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddress() { - return ieeeAddress; - } - - /** - * Full IEEE address for the device joining the network - * - * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} - */ - public void setIeeeAddress(IeeeAddress ieeeAddress) { - this.ieeeAddress = ieeeAddress; - } - - /** - * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC - * - * @return the current installCode as {@link ZigBeeKey} - */ - public ZigBeeKey getInstallCode() { - return installCode; - } - - /** - * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC - * - * @param installCode the InstallCode to set as {@link ZigBeeKey} - */ - public void setInstallCode(ZigBeeKey installCode) { - this.installCode = installCode; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x04)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x04); - - // Serialize the fields - serializer.serializeUInt8(installCodeFormat.getKey()); - serializer.serializeIeeeAddress(ieeeAddress); - serializer.serializeZigBeeKey(installCode); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(111); - builder.append("ZstackAppCnfBdbAddInstallcodeSreq [installCodeFormat="); - builder.append(installCodeFormat); - builder.append(", ieeeAddress="); - builder.append(ieeeAddress); - builder.append(", installCode="); - builder.append(installCode); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. + *

    + * Add a preconfigured key (plain key or IC) to Trust Center device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbAddInstallcodeSreq extends ZstackFrameRequest { + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + */ + private ZstackInstallCodeFormat installCodeFormat; + + /** + * Full IEEE address for the device joining the network + */ + private IeeeAddress ieeeAddress; + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + */ + private ZigBeeKey installCode; + + /** + * Request constructor + */ + public ZstackAppCnfBdbAddInstallcodeSreq() { + synchronousCommand = true; + } + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + * + * @return the current installCodeFormat as {@link ZstackInstallCodeFormat} + */ + public ZstackInstallCodeFormat getInstallCodeFormat() { + return installCodeFormat; + } + + /** + * This value specifies the format in which the install code is being added. The following list contains the values corresponding + * to the supported formats: 0x01 Install Code + CRC 0x02 Key derived from Install Code + * + * @param installCodeFormat the InstallCodeFormat to set as {@link ZstackInstallCodeFormat} + */ + public void setInstallCodeFormat(ZstackInstallCodeFormat installCodeFormat) { + this.installCodeFormat = installCodeFormat; + } + + /** + * Full IEEE address for the device joining the network + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * Full IEEE address for the device joining the network + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + * + * @return the current installCode as {@link ZigBeeKey} + */ + public ZigBeeKey getInstallCode() { + return installCode; + } + + /** + * 16 Bytes for the Key derived from the IC. 18 Bytes for the Install Code +CRC + * + * @param installCode the InstallCode to set as {@link ZigBeeKey} + */ + public void setInstallCode(ZigBeeKey installCode) { + this.installCode = installCode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x04); + + // Serialize the fields + serializer.serializeUInt8(installCodeFormat.getKey()); + serializer.serializeIeeeAddress(ieeeAddress); + serializer.serializeZigBeeKey(installCode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(111); + builder.append("ZstackAppCnfBdbAddInstallcodeSreq [installCodeFormat="); + builder.append(installCodeFormat); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", installCode="); + builder.append(installCode); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java index a09d940512..ab85ac1f78 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbAddInstallcodeSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. - *

    - * Add a preconfigured key (plain key or IC) to Trust Center device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbAddInstallcodeSrsp extends ZstackFrameResponse { - - /** - * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbAddInstallcodeSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(61); - builder.append("ZstackAppCnfBdbAddInstallcodeSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_ADD_INSTALLCODE. + *

    + * Add a preconfigured key (plain key or IC) to Trust Center device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbAddInstallcodeSrsp extends ZstackFrameResponse { + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbAddInstallcodeSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status values: 0x00 Success. 0x01 Failure (IC not supported) 0x02 Invalid parameter (bad CRC). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackAppCnfBdbAddInstallcodeSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java index ca7866fe4c..2e28f0105d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbCommissioningNotificationAreq.java @@ -1,136 +1,137 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackBdbRemainingCommissioningModes; -import java.util.HashSet; -import java.util.Set; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_COMMISSIONING_NOTIFICATION. - *

    - * Callback to receive notifications from BDB process. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbCommissioningNotificationAreq extends ZstackFrameResponse { - - /** - * Status of the commissioning mode being notified - */ - private ZstackBdbStatus status; - - /** - * Commissioning mode for which the notification is done and to which the status is related - */ - private ZstackBdbCommissioningMode commissioningMode; - - /** - * Bitmask of the remaining commissioning modes after this notification. - *

    - * Parameter allows multiple options so implemented as a {@link Set}. - */ - private Set remainingCommissioningModes = new HashSet<>(); - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbCommissioningNotificationAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - status = ZstackBdbStatus.valueOf(deserializer.deserializeUInt8()); - commissioningMode = ZstackBdbCommissioningMode.valueOf(deserializer.deserializeUInt8()); - int tmpRemainingCommissioningModes = deserializer.deserializeUInt8(); - for (ZstackBdbRemainingCommissioningModes value : ZstackBdbRemainingCommissioningModes.values()) { - if ((tmpRemainingCommissioningModes & value.getKey()) != 0) { - remainingCommissioningModes.add(value); - } - } - } - - /** - * Status of the commissioning mode being notified - * - * @return the current status as {@link ZstackBdbStatus} - */ - public ZstackBdbStatus getStatus() { - return status; - } - - /** - * Status of the commissioning mode being notified - * - * @param status the Status to set as {@link ZstackBdbStatus} - */ - public void setStatus(ZstackBdbStatus status) { - this.status = status; - } - - /** - * Commissioning mode for which the notification is done and to which the status is related - * - * @return the current commissioningMode as {@link ZstackBdbCommissioningMode} - */ - public ZstackBdbCommissioningMode getCommissioningMode() { - return commissioningMode; - } - - /** - * Commissioning mode for which the notification is done and to which the status is related - * - * @param commissioningMode the CommissioningMode to set as {@link ZstackBdbCommissioningMode} - */ - public void setCommissioningMode(ZstackBdbCommissioningMode commissioningMode) { - this.commissioningMode = commissioningMode; - } - - /** - * Bitmask of the remaining commissioning modes after this notification. - * - * @return the current remainingCommissioningModes as {@link Set} of {@link ZstackBdbRemainingCommissioningModes} - */ - public Set getRemainingCommissioningModes() { - return remainingCommissioningModes; - } - - /** - * Bitmask of the remaining commissioning modes after this notification. - * - * @param remainingCommissioningModes the RemainingCommissioningModes to add to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} - */ - public void addRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { - this.remainingCommissioningModes.add(remainingCommissioningModes); - } - - /** - * Bitmask of the remaining commissioning modes after this notification. - * - * @param remainingCommissioningModes the RemainingCommissioningModes to remove to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} - */ - public void removeRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { - this.remainingCommissioningModes.remove(remainingCommissioningModes); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(122); - builder.append("ZstackAppCnfBdbCommissioningNotificationAreq [status="); - builder.append(status); - builder.append(", commissioningMode="); - builder.append(commissioningMode); - builder.append(", remainingCommissioningModes="); - builder.append(remainingCommissioningModes); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackBdbRemainingCommissioningModes; +import java.util.HashSet; +import java.util.Set; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_COMMISSIONING_NOTIFICATION. + *

    + * Callback to receive notifications from BDB process. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbCommissioningNotificationAreq extends ZstackFrameResponse { + + /** + * Status of the commissioning mode being notified + */ + private ZstackBdbStatus status; + + /** + * Commissioning mode for which the notification is done and to which the status is related + */ + private ZstackBdbCommissioningMode commissioningMode; + + /** + * Bitmask of the remaining commissioning modes after this notification. + *

    + * Parameter allows multiple options so implemented as a {@link Set}. + */ + private Set remainingCommissioningModes = new HashSet<>(); + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbCommissioningNotificationAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + status = ZstackBdbStatus.valueOf(deserializer.deserializeUInt8()); + commissioningMode = ZstackBdbCommissioningMode.valueOf(deserializer.deserializeUInt8()); + int tmpRemainingCommissioningModes = deserializer.deserializeUInt8(); + for (ZstackBdbRemainingCommissioningModes value : ZstackBdbRemainingCommissioningModes.values()) { + if ((tmpRemainingCommissioningModes & value.getKey()) != 0) { + remainingCommissioningModes.add(value); + } + } + } + + /** + * Status of the commissioning mode being notified + * + * @return the current status as {@link ZstackBdbStatus} + */ + public ZstackBdbStatus getStatus() { + return status; + } + + /** + * Status of the commissioning mode being notified + * + * @param status the Status to set as {@link ZstackBdbStatus} + */ + public void setStatus(ZstackBdbStatus status) { + this.status = status; + } + + /** + * Commissioning mode for which the notification is done and to which the status is related + * + * @return the current commissioningMode as {@link ZstackBdbCommissioningMode} + */ + public ZstackBdbCommissioningMode getCommissioningMode() { + return commissioningMode; + } + + /** + * Commissioning mode for which the notification is done and to which the status is related + * + * @param commissioningMode the CommissioningMode to set as {@link ZstackBdbCommissioningMode} + */ + public void setCommissioningMode(ZstackBdbCommissioningMode commissioningMode) { + this.commissioningMode = commissioningMode; + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @return the current remainingCommissioningModes as {@link Set} of {@link ZstackBdbRemainingCommissioningModes} + */ + public Set getRemainingCommissioningModes() { + return remainingCommissioningModes; + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @param remainingCommissioningModes the RemainingCommissioningModes to add to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} + */ + public void addRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { + this.remainingCommissioningModes.add(remainingCommissioningModes); + } + + /** + * Bitmask of the remaining commissioning modes after this notification. + * + * @param remainingCommissioningModes the RemainingCommissioningModes to remove to the {@link Set} as {@link ZstackBdbRemainingCommissioningModes} + */ + public void removeRemainingCommissioningModes(ZstackBdbRemainingCommissioningModes remainingCommissioningModes) { + this.remainingCommissioningModes.remove(remainingCommissioningModes); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(122); + builder.append("ZstackAppCnfBdbCommissioningNotificationAreq [status="); + builder.append(status); + builder.append(", commissioningMode="); + builder.append(commissioningMode); + builder.append(", remainingCommissioningModes="); + builder.append(remainingCommissioningModes); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java index d363ca876a..c6c472cc9f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq.java @@ -1,108 +1,109 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. - *

    - * Sets the policy to mandate or not the usage of an Install Code upon joining. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq extends ZstackFrameRequest { - - /** - * This parameter controls which key will be used when performing association to a centralized network. - */ - private ZstackCentralizedLinkKeyMode centralizedLinkKeyMode; - - /** - * Buffer with the key in any of its formats. - */ - private int[] installCode; - - /** - * Request constructor - */ - public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq() { - synchronousCommand = true; - } - - /** - * This parameter controls which key will be used when performing association to a centralized network. - * - * @return the current centralizedLinkKeyMode as {@link ZstackCentralizedLinkKeyMode} - */ - public ZstackCentralizedLinkKeyMode getCentralizedLinkKeyMode() { - return centralizedLinkKeyMode; - } - - /** - * This parameter controls which key will be used when performing association to a centralized network. - * - * @param centralizedLinkKeyMode the CentralizedLinkKeyMode to set as {@link ZstackCentralizedLinkKeyMode} - */ - public void setCentralizedLinkKeyMode(ZstackCentralizedLinkKeyMode centralizedLinkKeyMode) { - this.centralizedLinkKeyMode = centralizedLinkKeyMode; - } - - /** - * Buffer with the key in any of its formats. - * - * @return the current installCode as {@link int[]} - */ - public int[] getInstallCode() { - return installCode; - } - - /** - * Buffer with the key in any of its formats. - * - * @param installCode the InstallCode to set as {@link int[]} - */ - public void setInstallCode(int[] installCode) { - this.installCode = installCode; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x07)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x07); - - // Serialize the fields - serializer.serializeUInt8(centralizedLinkKeyMode.getKey()); - serializer.serializeUInt8Array(installCode); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(102); - builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq [centralizedLinkKeyMode="); - builder.append(centralizedLinkKeyMode); - builder.append(", installCode="); - for (int c = 0; c < installCode.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", installCode[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. + *

    + * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq extends ZstackFrameRequest { + + /** + * This parameter controls which key will be used when performing association to a centralized network. + */ + private ZstackCentralizedLinkKeyMode centralizedLinkKeyMode; + + /** + * Buffer with the key in any of its formats. + */ + private int[] installCode; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq() { + synchronousCommand = true; + } + + /** + * This parameter controls which key will be used when performing association to a centralized network. + * + * @return the current centralizedLinkKeyMode as {@link ZstackCentralizedLinkKeyMode} + */ + public ZstackCentralizedLinkKeyMode getCentralizedLinkKeyMode() { + return centralizedLinkKeyMode; + } + + /** + * This parameter controls which key will be used when performing association to a centralized network. + * + * @param centralizedLinkKeyMode the CentralizedLinkKeyMode to set as {@link ZstackCentralizedLinkKeyMode} + */ + public void setCentralizedLinkKeyMode(ZstackCentralizedLinkKeyMode centralizedLinkKeyMode) { + this.centralizedLinkKeyMode = centralizedLinkKeyMode; + } + + /** + * Buffer with the key in any of its formats. + * + * @return the current installCode as {@link int[]} + */ + public int[] getInstallCode() { + return installCode; + } + + /** + * Buffer with the key in any of its formats. + * + * @param installCode the InstallCode to set as {@link int[]} + */ + public void setInstallCode(int[] installCode) { + this.installCode = installCode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x07)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x07); + + // Serialize the fields + serializer.serializeUInt8(centralizedLinkKeyMode.getKey()); + serializer.serializeUInt8Array(installCode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(102); + builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySreq [centralizedLinkKeyMode="); + builder.append(centralizedLinkKeyMode); + builder.append(", installCode="); + for (int c = 0; c < installCode.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", installCode[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java index 3cd012b121..2ebcc7dc4f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. - *

    - * Sets the policy to mandate or not the usage of an Install Code upon joining. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp extends ZstackFrameResponse { - - /** - * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(77); - builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_ACTIVE_DEFAULT_CENTRALIZED_KEY. + *

    + * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 Success 0x01 Failure (IC not supported) 0x02 Invalid Parameters (bad CRC). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(77); + builder.append("ZstackAppCnfBdbSetActiveDefaultCentralizedKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java index 31106ec45e..fe98126d5f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSreq.java @@ -1,103 +1,104 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. - *

    - * This command is used to store a channel select bit-mask to be used in commissioning. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetChannelSreq extends ZstackFrameRequest { - - /** - * Mask is used for primary channel selection. - */ - private boolean isPrimary; - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - */ - private int channels; - - /** - * Request constructor - */ - public ZstackAppCnfBdbSetChannelSreq() { - synchronousCommand = true; - } - - /** - * Mask is used for primary channel selection. - * - * @return the current isPrimary as {@link boolean} - */ - public boolean getIsPrimary() { - return isPrimary; - } - - /** - * Mask is used for primary channel selection. - * - * @param isPrimary the IsPrimary to set as {@link boolean} - */ - public void setIsPrimary(boolean isPrimary) { - this.isPrimary = isPrimary; - } - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - * - * @return the current channels as {@link int} - */ - public int getChannels() { - return channels; - } - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - * - * @param channels the Channels to set as {@link int} - */ - public void setChannels(int channels) { - this.channels = channels; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x08)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x08); - - // Serialize the fields - serializer.serializeBoolean(isPrimary); - serializer.serializeUInt32(channels); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(82); - builder.append("ZstackAppCnfBdbSetChannelSreq [isPrimary="); - builder.append(isPrimary); - builder.append(", channels="); - builder.append(channels); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. + *

    + * This command is used to store a channel select bit-mask to be used in commissioning. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetChannelSreq extends ZstackFrameRequest { + + /** + * Mask is used for primary channel selection. + */ + private boolean isPrimary; + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + */ + private int channels; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetChannelSreq() { + synchronousCommand = true; + } + + /** + * Mask is used for primary channel selection. + * + * @return the current isPrimary as {@link boolean} + */ + public boolean getIsPrimary() { + return isPrimary; + } + + /** + * Mask is used for primary channel selection. + * + * @param isPrimary the IsPrimary to set as {@link boolean} + */ + public void setIsPrimary(boolean isPrimary) { + this.isPrimary = isPrimary; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @return the current channels as {@link int} + */ + public int getChannels() { + return channels; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @param channels the Channels to set as {@link int} + */ + public void setChannels(int channels) { + this.channels = channels; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x08)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x08); + + // Serialize the fields + serializer.serializeBoolean(isPrimary); + serializer.serializeUInt32(channels); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(82); + builder.append("ZstackAppCnfBdbSetChannelSreq [isPrimary="); + builder.append(isPrimary); + builder.append(", channels="); + builder.append(channels); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java index e94a18a7f0..197e3b04cf 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetChannelSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. - *

    - * This command is used to store a channel select bit-mask to be used in commissioning. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetChannelSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbSetChannelSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(57); - builder.append("ZstackAppCnfBdbSetChannelSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_CHANNEL. + *

    + * This command is used to store a channel select bit-mask to be used in commissioning. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetChannelSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetChannelSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackAppCnfBdbSetChannelSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java index fa0dbec4ea..5f6c76ef11 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySreq.java @@ -1,101 +1,102 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. - *

    - * Sets the policy to mandate or not the usage of an Install Code upon joining. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetJoinusesinstallcodekeySreq extends ZstackFrameRequest { - - /** - * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for - * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is - * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then - * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. - * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If - * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that - * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the - * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set - * IncomingFrameCounter to 0. - */ - private boolean joinUsesInstallCodeKey; - - /** - * Request constructor - */ - public ZstackAppCnfBdbSetJoinusesinstallcodekeySreq() { - synchronousCommand = true; - } - - /** - * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for - * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is - * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then - * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. - * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If - * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that - * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the - * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set - * IncomingFrameCounter to 0. - * - * @return the current joinUsesInstallCodeKey as {@link boolean} - */ - public boolean getJoinUsesInstallCodeKey() { - return joinUsesInstallCodeKey; - } - - /** - * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for - * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is - * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then - * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. - * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If - * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that - * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the - * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set - * IncomingFrameCounter to 0. - * - * @param joinUsesInstallCodeKey the JoinUsesInstallCodeKey to set as {@link boolean} - */ - public void setJoinUsesInstallCodeKey(boolean joinUsesInstallCodeKey) { - this.joinUsesInstallCodeKey = joinUsesInstallCodeKey; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x06)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x06); - - // Serialize the fields - serializer.serializeBoolean(joinUsesInstallCodeKey); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(72); - builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySreq [joinUsesInstallCodeKey="); - builder.append(joinUsesInstallCodeKey); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. + *

    + * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetJoinusesinstallcodekeySreq extends ZstackFrameRequest { + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + */ + private boolean joinUsesInstallCodeKey; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetJoinusesinstallcodekeySreq() { + synchronousCommand = true; + } + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + * + * @return the current joinUsesInstallCodeKey as {@link boolean} + */ + public boolean getJoinUsesInstallCodeKey() { + return joinUsesInstallCodeKey; + } + + /** + * If it is equal to TRUE and the installation code derived link key is not stored, the Trust Center SHALL terminate the procedure for + * adding a new node into the network. If bdbJoinUsesInstall- CodeKey is equal to TRUE and the installation code derived link key is + * stored, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that corresponds to the joining node and then + * overwrite the LinkKey entry with the installation code derived link key and set the KeyAttributes field to PROVISIONAL_KEY. + * The Trust Center MAY then set OutgoingFrame- Counter to 0 and SHALL set IncomingFrameCounter to 0. If + * bdbJoinUsesInstallCodeKey is equal to FALSE, the Trust Center SHALL first find the entry in apsDeviceKeyPairSet that + * corresponds to the joining node and then overwrite the LinkKey entry with the default global Trust Center link key and set the + * KeyAttributes field to PROVISIONAL_KEY. The Trust Center MAY then set OutgoingFrameCounter to 0 and SHALL set + * IncomingFrameCounter to 0. + * + * @param joinUsesInstallCodeKey the JoinUsesInstallCodeKey to set as {@link boolean} + */ + public void setJoinUsesInstallCodeKey(boolean joinUsesInstallCodeKey) { + this.joinUsesInstallCodeKey = joinUsesInstallCodeKey; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x06)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x06); + + // Serialize the fields + serializer.serializeBoolean(joinUsesInstallCodeKey); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(72); + builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySreq [joinUsesInstallCodeKey="); + builder.append(joinUsesInstallCodeKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java index 3c21ebd0b2..a2c435eb1d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. - *

    - * Sets the policy to mandate or not the usage of an Install Code upon joining. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(72); - builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_JOINUSESINSTALLCODEKEY. + *

    + * Sets the policy to mandate or not the usage of an Install Code upon joining. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(72); + builder.append("ZstackAppCnfBdbSetJoinusesinstallcodekeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java index c044654085..ed90c12f9b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSreq.java @@ -1,89 +1,90 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. - *

    - * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetTcRequireKeyExchangeSreq extends ZstackFrameRequest { - - /** - * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange - * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, - * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being - * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining - * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. - */ - private boolean trustCenterRequireKeyExchange; - - /** - * Request constructor - */ - public ZstackAppCnfBdbSetTcRequireKeyExchangeSreq() { - synchronousCommand = true; - } - - /** - * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange - * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, - * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being - * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining - * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. - * - * @return the current trustCenterRequireKeyExchange as {@link boolean} - */ - public boolean getTrustCenterRequireKeyExchange() { - return trustCenterRequireKeyExchange; - } - - /** - * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange - * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, - * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being - * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining - * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. - * - * @param trustCenterRequireKeyExchange the TrustCenterRequireKeyExchange to set as {@link boolean} - */ - public void setTrustCenterRequireKeyExchange(boolean trustCenterRequireKeyExchange) { - this.trustCenterRequireKeyExchange = trustCenterRequireKeyExchange; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x09)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x09); - - // Serialize the fields - serializer.serializeBoolean(trustCenterRequireKeyExchange); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(70); - builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSreq [trustCenterRequireKeyExchange="); - builder.append(trustCenterRequireKeyExchange); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. + *

    + * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetTcRequireKeyExchangeSreq extends ZstackFrameRequest { + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + */ + private boolean trustCenterRequireKeyExchange; + + /** + * Request constructor + */ + public ZstackAppCnfBdbSetTcRequireKeyExchangeSreq() { + synchronousCommand = true; + } + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + * + * @return the current trustCenterRequireKeyExchange as {@link boolean} + */ + public boolean getTrustCenterRequireKeyExchange() { + return trustCenterRequireKeyExchange; + } + + /** + * The bdbTrustCenterRequireKeyExchange attribute specifies whether the Trust Center requires a joining device to exchange + * its initial link key with a new link key generated by the Trust Center. If bdbTrustCenterRequireKeyExchange is equal to TRUE, + * the joining node must undergo the link key exchange procedure; failure to exchange the link key will result in the node being + * removed from the network. If bdbTrustCenterRequireKeyExchange is equal to FALSE, the Trust Center will permit the joining + * node to remain on the network without exchanging its initial link key. This attribute is used by ZigBee coordinator nodes. + * + * @param trustCenterRequireKeyExchange the TrustCenterRequireKeyExchange to set as {@link boolean} + */ + public void setTrustCenterRequireKeyExchange(boolean trustCenterRequireKeyExchange) { + this.trustCenterRequireKeyExchange = trustCenterRequireKeyExchange; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x09); + + // Serialize the fields + serializer.serializeBoolean(trustCenterRequireKeyExchange); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(70); + builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSreq [trustCenterRequireKeyExchange="); + builder.append(trustCenterRequireKeyExchange); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java index dd76b30872..07a3e806c4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. - *

    - * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(70); - builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_BDB_SET_TC_REQUIRE_KEY_EXCHANGE. + *

    + * Sets the policy flag on Trust Center device to mandate or not the TCLK exchange procedure. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(70); + builder.append("ZstackAppCnfBdbSetTcRequireKeyExchangeSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java index fc64e1449f..16c1267155 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. - *

    - * Sets the AllowRejoin TC policy. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfSetAllowrejoinTcPolicySreq extends ZstackFrameRequest { - - /** - * This value specifies whether or not the Trust Center allows devices to rejoin. - */ - private boolean allowRejoin; - - /** - * Request constructor - */ - public ZstackAppCnfSetAllowrejoinTcPolicySreq() { - synchronousCommand = true; - } - - /** - * This value specifies whether or not the Trust Center allows devices to rejoin. - * - * @return the current allowRejoin as {@link boolean} - */ - public boolean getAllowRejoin() { - return allowRejoin; - } - - /** - * This value specifies whether or not the Trust Center allows devices to rejoin. - * - * @param allowRejoin the AllowRejoin to set as {@link boolean} - */ - public void setAllowRejoin(boolean allowRejoin) { - this.allowRejoin = allowRejoin; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x03)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x03); - - // Serialize the fields - serializer.serializeBoolean(allowRejoin); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(66); - builder.append("ZstackAppCnfSetAllowrejoinTcPolicySreq [allowRejoin="); - builder.append(allowRejoin); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. + *

    + * Sets the AllowRejoin TC policy. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfSetAllowrejoinTcPolicySreq extends ZstackFrameRequest { + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + */ + private boolean allowRejoin; + + /** + * Request constructor + */ + public ZstackAppCnfSetAllowrejoinTcPolicySreq() { + synchronousCommand = true; + } + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + * + * @return the current allowRejoin as {@link boolean} + */ + public boolean getAllowRejoin() { + return allowRejoin; + } + + /** + * This value specifies whether or not the Trust Center allows devices to rejoin. + * + * @param allowRejoin the AllowRejoin to set as {@link boolean} + */ + public void setAllowRejoin(boolean allowRejoin) { + this.allowRejoin = allowRejoin; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_APP_CNF) && (response.getReqCmd1() == 0x03)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_APP_CNF, 0x03); + + // Serialize the fields + serializer.serializeBoolean(allowRejoin); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(66); + builder.append("ZstackAppCnfSetAllowrejoinTcPolicySreq [allowRejoin="); + builder.append(allowRejoin); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java index 847b181d21..e4c948a9e4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAppCnfSetAllowrejoinTcPolicySrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. - *

    - * Sets the AllowRejoin TC policy. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackAppCnfSetAllowrejoinTcPolicySrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackAppCnfSetAllowrejoinTcPolicySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(66); - builder.append("ZstackAppCnfSetAllowrejoinTcPolicySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command APP_CNF_SET_ALLOWREJOIN_TC_POLICY. + *

    + * Sets the AllowRejoin TC policy. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackAppCnfSetAllowrejoinTcPolicySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackAppCnfSetAllowrejoinTcPolicySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(66); + builder.append("ZstackAppCnfSetAllowrejoinTcPolicySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java index 5eb88d198b..a07bd1864f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackAuthenticationOption.java @@ -1,75 +1,75 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackAuthenticationOption. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackAuthenticationOption { - - /** - * The device has not been authenticated - */ - NOT_AUTHENTICATED(0x0000), - - /** - * The device has been authenticated using CBKE - */ - AUTHENTICATED_CBCK(0x0001), - - /** - * The device has been authenticated using EA - */ - AUTHENTICATED_EA(0x0002); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackAuthenticationOption s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackAuthenticationOption(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackAuthenticationOption valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackAuthenticationOption. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackAuthenticationOption { + + /** + * The device has not been authenticated + */ + NOT_AUTHENTICATED(0x0000), + + /** + * The device has been authenticated using CBKE + */ + AUTHENTICATED_CBCK(0x0001), + + /** + * The device has been authenticated using EA + */ + AUTHENTICATED_EA(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackAuthenticationOption s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackAuthenticationOption(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackAuthenticationOption valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java index ce8ece91cb..f87ca80287 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbCommissioningMode.java @@ -1,90 +1,90 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackBdbCommissioningMode. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackBdbCommissioningMode { - - /** - * - */ - BDB_COMMISSIONING_INITIALIZATION(0x0000), - - /** - * - */ - BDB_COMMISSIONING_NWK_STEERING(0x0001), - - /** - * - */ - BDB_COMMISSIONING_FORMATION(0x0002), - - /** - * - */ - BDB_COMMISSIONING_FINDING_BINDING(0x0003), - - /** - * - */ - BDB_COMMISSIONING_TOUCHLINK(0x0004), - - /** - * - */ - BDB_COMMISSIONING_PARENT_LOST(0x0005); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackBdbCommissioningMode s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackBdbCommissioningMode(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackBdbCommissioningMode valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbCommissioningMode. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbCommissioningMode { + + /** + * + */ + BDB_COMMISSIONING_INITIALIZATION(0x0000), + + /** + * + */ + BDB_COMMISSIONING_NWK_STEERING(0x0001), + + /** + * + */ + BDB_COMMISSIONING_FORMATION(0x0002), + + /** + * + */ + BDB_COMMISSIONING_FINDING_BINDING(0x0003), + + /** + * + */ + BDB_COMMISSIONING_TOUCHLINK(0x0004), + + /** + * + */ + BDB_COMMISSIONING_PARENT_LOST(0x0005); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbCommissioningMode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbCommissioningMode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbCommissioningMode valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java index c81ea2358c..b89081285d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbRemainingCommissioningModes.java @@ -1,90 +1,90 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackBdbRemainingCommissioningModes. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackBdbRemainingCommissioningModes { - - /** - * - */ - BDB_COMMISSIONING_MODE_INITIATOR_TL(0x0001), - - /** - * - */ - BDB_COMMISSIONING_MODE_NWK_STEERING(0x0002), - - /** - * - */ - BDB_COMMISSIONING_MODE_NWK_FORMATION(0x0004), - - /** - * - */ - BDB_COMMISSIONING_MODE_FINDING_BINDING(0x0008), - - /** - * - */ - BDB_COMMISSIONING_MODE_INITIALIZATION(0x0010), - - /** - * - */ - BDB_COMMISSIONING_MODE_PARENT_LOST(0x0020); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackBdbRemainingCommissioningModes s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackBdbRemainingCommissioningModes(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackBdbRemainingCommissioningModes valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbRemainingCommissioningModes. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbRemainingCommissioningModes { + + /** + * + */ + BDB_COMMISSIONING_MODE_INITIATOR_TL(0x0001), + + /** + * + */ + BDB_COMMISSIONING_MODE_NWK_STEERING(0x0002), + + /** + * + */ + BDB_COMMISSIONING_MODE_NWK_FORMATION(0x0004), + + /** + * + */ + BDB_COMMISSIONING_MODE_FINDING_BINDING(0x0008), + + /** + * + */ + BDB_COMMISSIONING_MODE_INITIALIZATION(0x0010), + + /** + * + */ + BDB_COMMISSIONING_MODE_PARENT_LOST(0x0020); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbRemainingCommissioningModes s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbRemainingCommissioningModes(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbRemainingCommissioningModes valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java index 5164503bdc..69f557c8ae 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackBdbStatus.java @@ -1,135 +1,135 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackBdbStatus. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackBdbStatus { - - /** - * - */ - BDB_COMMISSIONING_SUCCESS(0x0000), - - /** - * - */ - BDB_COMMISSIONING_IN_PROGRESS(0x0001), - - /** - * - */ - BDB_COMMISSIONING_NO_NETWORK(0x0002), - - /** - * - */ - BDB_COMMISSIONING_TL_TARGET_FAILURE(0x0003), - - /** - * - */ - BDB_COMMISSIONING_TL_NOT_AA_CAPABLE(0x0004), - - /** - * - */ - BDB_COMMISSIONING_TL_NO_SCAN_RESPONSE(0x0005), - - /** - * - */ - BDB_COMMISSIONING_TL_NOT_PERMITTED(0x0006), - - /** - * - */ - BDB_COMMISSIONING_TCLK_EX_FAILURE(0x0007), - - /** - * - */ - BDB_COMMISSIONING_FORMATION_FAILURE(0x0008), - - /** - * - */ - BDB_COMMISSIONING_FB_TARGET_IN_PROGRESS(0x0009), - - /** - * - */ - BDB_COMMISSIONING_FB_INITIATOR_IN_PROGRESS(0x000A), - - /** - * - */ - BDB_COMMISSIONING_FB_NO_IDENTIFY_QUERY_RESPONSE(0x000B), - - /** - * - */ - BDB_COMMISSIONING_FB_BINDING_TABLE_FULL(0x000C), - - /** - * - */ - BDB_COMMISSIONING_NETWORK_RESTORED(0x000D), - - /** - * - */ - BDB_COMMISSIONING_FAILURE(0x000E); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackBdbStatus s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackBdbStatus(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackBdbStatus valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackBdbStatus. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackBdbStatus { + + /** + * + */ + BDB_COMMISSIONING_SUCCESS(0x0000), + + /** + * + */ + BDB_COMMISSIONING_IN_PROGRESS(0x0001), + + /** + * + */ + BDB_COMMISSIONING_NO_NETWORK(0x0002), + + /** + * + */ + BDB_COMMISSIONING_TL_TARGET_FAILURE(0x0003), + + /** + * + */ + BDB_COMMISSIONING_TL_NOT_AA_CAPABLE(0x0004), + + /** + * + */ + BDB_COMMISSIONING_TL_NO_SCAN_RESPONSE(0x0005), + + /** + * + */ + BDB_COMMISSIONING_TL_NOT_PERMITTED(0x0006), + + /** + * + */ + BDB_COMMISSIONING_TCLK_EX_FAILURE(0x0007), + + /** + * + */ + BDB_COMMISSIONING_FORMATION_FAILURE(0x0008), + + /** + * + */ + BDB_COMMISSIONING_FB_TARGET_IN_PROGRESS(0x0009), + + /** + * + */ + BDB_COMMISSIONING_FB_INITIATOR_IN_PROGRESS(0x000A), + + /** + * + */ + BDB_COMMISSIONING_FB_NO_IDENTIFY_QUERY_RESPONSE(0x000B), + + /** + * + */ + BDB_COMMISSIONING_FB_BINDING_TABLE_FULL(0x000C), + + /** + * + */ + BDB_COMMISSIONING_NETWORK_RESTORED(0x000D), + + /** + * + */ + BDB_COMMISSIONING_FAILURE(0x000E); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackBdbStatus s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackBdbStatus(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackBdbStatus valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java index 4cd9080415..3345fbf485 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackCentralizedLinkKeyMode.java @@ -1,96 +1,96 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackCentralizedLinkKeyMode. - *

    - * Central link key policies - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackCentralizedLinkKeyMode { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * Instruct joining node to use Default Global Trust Center link key. No key buffer required - */ - DEFAULT_GLOBAL_KEY(0x0000), - - /** - * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining - */ - PROVIDED_INSTALL_CODE(0x0001), - - /** - * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining. - * If it fails to decrypt Transport Key, it will automatically try Default Global Trust Center Link Key - */ - PROVIDED_INSTALL_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0002), - - /** - * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes) - */ - PROVIDED_APS_KEY(0x0003), - - /** - * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes). If it fails to decrypt - * Transport Key, it will automatically try Default Global Trust Center Link Key - */ - PROVIDED_APS_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0004); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackCentralizedLinkKeyMode s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackCentralizedLinkKeyMode(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackCentralizedLinkKeyMode valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackCentralizedLinkKeyMode. + *

    + * Central link key policies + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackCentralizedLinkKeyMode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * Instruct joining node to use Default Global Trust Center link key. No key buffer required + */ + DEFAULT_GLOBAL_KEY(0x0000), + + /** + * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining + */ + PROVIDED_INSTALL_CODE(0x0001), + + /** + * Instruct the joining node to use the provided install code (16 bytes + 2 CRC bytes) to derive APS Link key to be used during joining. + * If it fails to decrypt Transport Key, it will automatically try Default Global Trust Center Link Key + */ + PROVIDED_INSTALL_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0002), + + /** + * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes) + */ + PROVIDED_APS_KEY(0x0003), + + /** + * Instruct the joining node to use the provided APS Link key to be used during joining (key size is 16 bytes). If it fails to decrypt + * Transport Key, it will automatically try Default Global Trust Center Link Key + */ + PROVIDED_APS_CODE_THEN_DEFAULT_GLOBAL_KEY(0x0004); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackCentralizedLinkKeyMode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackCentralizedLinkKeyMode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackCentralizedLinkKeyMode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java index 9d059278e1..ad421512e3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/appcnf/ZstackInstallCodeFormat.java @@ -1,70 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackInstallCodeFormat. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackInstallCodeFormat { - - /** - * - */ - INSTALL_CODE(0x0001), - - /** - * - */ - DERIVED_KEY(0x0002); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackInstallCodeFormat s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackInstallCodeFormat(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackInstallCodeFormat valueOf(int code) { - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.appcnf; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackInstallCodeFormat. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackInstallCodeFormat { + + /** + * + */ + INSTALL_CODE(0x0001), + + /** + * + */ + DERIVED_KEY(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackInstallCodeFormat s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackInstallCodeFormat(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackInstallCodeFormat valueOf(int code) { + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java index 186387c43e..074e19442b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSreq.java @@ -1,271 +1,272 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.mac; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command MAC_SCAN_REQ. - *

    - * This command is used to send a request to the device to perform a network scan. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackMacScanReqSreq extends ZstackFrameRequest { - - /** - * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, - * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, - * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, - * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, - * CHANNEL 26 = 0x04000000 - */ - private int scanChannels; - - /** - * Specifies the scan type: - */ - private int scanType; - - /** - * Duration of the scan - The exponent used in the scan duration calculation. - */ - private int scanDuration; - - /** - * The channel page on which to perform the scan. - */ - private int channelPage; - - /** - * Key Source of this data frame. - */ - private int keySource; - - /** - * Security Level of this data frame: - */ - private int securityLevel; - - /** - * Key Id Mode of this data frame: - */ - private int keyIdMode; - - /** - * Key Index of this data frame. - */ - private int keyIndex; - - /** - * Request constructor - */ - public ZstackMacScanReqSreq() { - synchronousCommand = true; - } - - /** - * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, - * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, - * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, - * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, - * CHANNEL 26 = 0x04000000 - * - * @return the current scanChannels as {@link int} - */ - public int getScanChannels() { - return scanChannels; - } - - /** - * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, - * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, - * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, - * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, - * CHANNEL 26 = 0x04000000 - * - * @param scanChannels the ScanChannels to set as {@link int} - */ - public void setScanChannels(int scanChannels) { - this.scanChannels = scanChannels; - } - - /** - * Specifies the scan type: - * - * @return the current scanType as {@link int} - */ - public int getScanType() { - return scanType; - } - - /** - * Specifies the scan type: - * - * @param scanType the ScanType to set as {@link int} - */ - public void setScanType(int scanType) { - this.scanType = scanType; - } - - /** - * Duration of the scan - The exponent used in the scan duration calculation. - * - * @return the current scanDuration as {@link int} - */ - public int getScanDuration() { - return scanDuration; - } - - /** - * Duration of the scan - The exponent used in the scan duration calculation. - * - * @param scanDuration the ScanDuration to set as {@link int} - */ - public void setScanDuration(int scanDuration) { - this.scanDuration = scanDuration; - } - - /** - * The channel page on which to perform the scan. - * - * @return the current channelPage as {@link int} - */ - public int getChannelPage() { - return channelPage; - } - - /** - * The channel page on which to perform the scan. - * - * @param channelPage the ChannelPage to set as {@link int} - */ - public void setChannelPage(int channelPage) { - this.channelPage = channelPage; - } - - /** - * Key Source of this data frame. - * - * @return the current keySource as {@link int} - */ - public int getKeySource() { - return keySource; - } - - /** - * Key Source of this data frame. - * - * @param keySource the KeySource to set as {@link int} - */ - public void setKeySource(int keySource) { - this.keySource = keySource; - } - - /** - * Security Level of this data frame: - * - * @return the current securityLevel as {@link int} - */ - public int getSecurityLevel() { - return securityLevel; - } - - /** - * Security Level of this data frame: - * - * @param securityLevel the SecurityLevel to set as {@link int} - */ - public void setSecurityLevel(int securityLevel) { - this.securityLevel = securityLevel; - } - - /** - * Key Id Mode of this data frame: - * - * @return the current keyIdMode as {@link int} - */ - public int getKeyIdMode() { - return keyIdMode; - } - - /** - * Key Id Mode of this data frame: - * - * @param keyIdMode the KeyIdMode to set as {@link int} - */ - public void setKeyIdMode(int keyIdMode) { - this.keyIdMode = keyIdMode; - } - - /** - * Key Index of this data frame. - * - * @return the current keyIndex as {@link int} - */ - public int getKeyIndex() { - return keyIndex; - } - - /** - * Key Index of this data frame. - * - * @param keyIndex the KeyIndex to set as {@link int} - */ - public void setKeyIndex(int keyIndex) { - this.keyIndex = keyIndex; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_MAC) && (response.getReqCmd1() == 0x0C)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_MAC, 0x0C); - - // Serialize the fields - serializer.serializeUInt32(scanChannels); - serializer.serializeUInt8(scanType); - serializer.serializeUInt8(scanDuration); - serializer.serializeUInt8(channelPage); - serializer.serializeUInt8(keySource); - serializer.serializeUInt8(securityLevel); - serializer.serializeUInt8(keyIdMode); - serializer.serializeUInt8(keyIndex); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(223); - builder.append("ZstackMacScanReqSreq [scanChannels="); - builder.append(scanChannels); - builder.append(", scanType="); - builder.append(scanType); - builder.append(", scanDuration="); - builder.append(scanDuration); - builder.append(", channelPage="); - builder.append(channelPage); - builder.append(", keySource="); - builder.append(keySource); - builder.append(", securityLevel="); - builder.append(securityLevel); - builder.append(", keyIdMode="); - builder.append(keyIdMode); - builder.append(", keyIndex="); - builder.append(keyIndex); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.mac; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command MAC_SCAN_REQ. + *

    + * This command is used to send a request to the device to perform a network scan. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackMacScanReqSreq extends ZstackFrameRequest { + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + */ + private int scanChannels; + + /** + * Specifies the scan type: + */ + private int scanType; + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + */ + private int scanDuration; + + /** + * The channel page on which to perform the scan. + */ + private int channelPage; + + /** + * Key Source of this data frame. + */ + private int keySource; + + /** + * Security Level of this data frame: + */ + private int securityLevel; + + /** + * Key Id Mode of this data frame: + */ + private int keyIdMode; + + /** + * Key Index of this data frame. + */ + private int keyIndex; + + /** + * Request constructor + */ + public ZstackMacScanReqSreq() { + synchronousCommand = true; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device: NONE = 0x00000000, ALL_CHANNELS = 0x07FFF800, + * CHANNEL 11 = 0x00000800, CHANNEL 12 = 0x00001000, CHANNEL 13 = 0x00002000, CHANNEL 14 = 0x00004000, CHANNEL 15 = 0x00008000, + * CHANNEL 16 = 0x00010000, CHANNEL 17 = 0x00020000, CHANNEL 18 = 0x00040000, CHANNEL_19 = 0x00080000, CHANNEL 20 = 0x00100000, + * CHANNEL 21 = 0x00200000, CHANNEL 22 = 0x00400000, CHANNEL 23 = 0x00800000, CHANNEL 24 = 0x01000000 CHANNEL 25 = 0x02000000, + * CHANNEL 26 = 0x04000000 + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * Specifies the scan type: + * + * @return the current scanType as {@link int} + */ + public int getScanType() { + return scanType; + } + + /** + * Specifies the scan type: + * + * @param scanType the ScanType to set as {@link int} + */ + public void setScanType(int scanType) { + this.scanType = scanType; + } + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + * + * @return the current scanDuration as {@link int} + */ + public int getScanDuration() { + return scanDuration; + } + + /** + * Duration of the scan - The exponent used in the scan duration calculation. + * + * @param scanDuration the ScanDuration to set as {@link int} + */ + public void setScanDuration(int scanDuration) { + this.scanDuration = scanDuration; + } + + /** + * The channel page on which to perform the scan. + * + * @return the current channelPage as {@link int} + */ + public int getChannelPage() { + return channelPage; + } + + /** + * The channel page on which to perform the scan. + * + * @param channelPage the ChannelPage to set as {@link int} + */ + public void setChannelPage(int channelPage) { + this.channelPage = channelPage; + } + + /** + * Key Source of this data frame. + * + * @return the current keySource as {@link int} + */ + public int getKeySource() { + return keySource; + } + + /** + * Key Source of this data frame. + * + * @param keySource the KeySource to set as {@link int} + */ + public void setKeySource(int keySource) { + this.keySource = keySource; + } + + /** + * Security Level of this data frame: + * + * @return the current securityLevel as {@link int} + */ + public int getSecurityLevel() { + return securityLevel; + } + + /** + * Security Level of this data frame: + * + * @param securityLevel the SecurityLevel to set as {@link int} + */ + public void setSecurityLevel(int securityLevel) { + this.securityLevel = securityLevel; + } + + /** + * Key Id Mode of this data frame: + * + * @return the current keyIdMode as {@link int} + */ + public int getKeyIdMode() { + return keyIdMode; + } + + /** + * Key Id Mode of this data frame: + * + * @param keyIdMode the KeyIdMode to set as {@link int} + */ + public void setKeyIdMode(int keyIdMode) { + this.keyIdMode = keyIdMode; + } + + /** + * Key Index of this data frame. + * + * @return the current keyIndex as {@link int} + */ + public int getKeyIndex() { + return keyIndex; + } + + /** + * Key Index of this data frame. + * + * @param keyIndex the KeyIndex to set as {@link int} + */ + public void setKeyIndex(int keyIndex) { + this.keyIndex = keyIndex; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_MAC) && (response.getReqCmd1() == 0x0C)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_MAC, 0x0C); + + // Serialize the fields + serializer.serializeUInt32(scanChannels); + serializer.serializeUInt8(scanType); + serializer.serializeUInt8(scanDuration); + serializer.serializeUInt8(channelPage); + serializer.serializeUInt8(keySource); + serializer.serializeUInt8(securityLevel); + serializer.serializeUInt8(keyIdMode); + serializer.serializeUInt8(keyIndex); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(223); + builder.append("ZstackMacScanReqSreq [scanChannels="); + builder.append(scanChannels); + builder.append(", scanType="); + builder.append(scanType); + builder.append(", scanDuration="); + builder.append(scanDuration); + builder.append(", channelPage="); + builder.append(channelPage); + builder.append(", keySource="); + builder.append(keySource); + builder.append(", securityLevel="); + builder.append(securityLevel); + builder.append(", keyIdMode="); + builder.append(keyIdMode); + builder.append(", keyIndex="); + builder.append(keyIndex); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java index e0ea6b5da9..0ecc68682a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/mac/ZstackMacScanReqSrsp.java @@ -1,39 +1,40 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.mac; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command MAC_SCAN_REQ. - *

    - * This command is used to send a request to the device to perform a network scan. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackMacScanReqSrsp extends ZstackFrameResponse { - - /** - * Response and Handler constructor - */ - public ZstackMacScanReqSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - } - - @Override - public String toString() { - return "ZstackMacScanReqSrsp []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.mac; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command MAC_SCAN_REQ. + *

    + * This command is used to send a request to the device to perform a network scan. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackMacScanReqSrsp extends ZstackFrameResponse { + + /** + * Response and Handler constructor + */ + public ZstackMacScanReqSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + } + + @Override + public String toString() { + return "ZstackMacScanReqSrsp []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java index 0d4194c3ab..3b713f2da6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackRpcSreqErrorSrsp.java @@ -1,119 +1,120 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command RPC_SREQ_ERROR. - *

    - * When the ZNP cannot recognize an SREQ command from the host processor, the following SRSP is returned. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackRpcSreqErrorSrsp extends ZstackFrameResponse { - - /** - * The error code maps to one of the enumerated values. - */ - private ZstackSreqErrorCode errorCode; - - /** - * The Cmd0 value of the processed SREQ - */ - private int reqCmd0; - - /** - * The Cmd1 value of the processed SREQ - */ - private int reqCmd1; - - /** - * Response and Handler constructor - */ - public ZstackRpcSreqErrorSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - errorCode = ZstackSreqErrorCode.valueOf(deserializer.deserializeUInt8()); - reqCmd0 = deserializer.deserializeUInt8(); - reqCmd1 = deserializer.deserializeUInt8(); - } - - /** - * The error code maps to one of the enumerated values. - * - * @return the current errorCode as {@link ZstackSreqErrorCode} - */ - public ZstackSreqErrorCode getErrorCode() { - return errorCode; - } - - /** - * The error code maps to one of the enumerated values. - * - * @param errorCode the ErrorCode to set as {@link ZstackSreqErrorCode} - */ - public void setErrorCode(ZstackSreqErrorCode errorCode) { - this.errorCode = errorCode; - } - - /** - * The Cmd0 value of the processed SREQ - * - * @return the current reqCmd0 as {@link int} - */ - public int getReqCmd0() { - return reqCmd0; - } - - /** - * The Cmd0 value of the processed SREQ - * - * @param reqCmd0 the ReqCmd0 to set as {@link int} - */ - public void setReqCmd0(int reqCmd0) { - this.reqCmd0 = reqCmd0; - } - - /** - * The Cmd1 value of the processed SREQ - * - * @return the current reqCmd1 as {@link int} - */ - public int getReqCmd1() { - return reqCmd1; - } - - /** - * The Cmd1 value of the processed SREQ - * - * @param reqCmd1 the ReqCmd1 to set as {@link int} - */ - public void setReqCmd1(int reqCmd1) { - this.reqCmd1 = reqCmd1; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(100); - builder.append("ZstackRpcSreqErrorSrsp [errorCode="); - builder.append(errorCode); - builder.append(", reqCmd0="); - builder.append(String.format("%02X", reqCmd0)); - builder.append(", reqCmd1="); - builder.append(String.format("%02X", reqCmd1)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command RPC_SREQ_ERROR. + *

    + * When the ZNP cannot recognize an SREQ command from the host processor, the following SRSP is returned. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackRpcSreqErrorSrsp extends ZstackFrameResponse { + + /** + * The error code maps to one of the enumerated values. + */ + private ZstackSreqErrorCode errorCode; + + /** + * The Cmd0 value of the processed SREQ + */ + private int reqCmd0; + + /** + * The Cmd1 value of the processed SREQ + */ + private int reqCmd1; + + /** + * Response and Handler constructor + */ + public ZstackRpcSreqErrorSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + errorCode = ZstackSreqErrorCode.valueOf(deserializer.deserializeUInt8()); + reqCmd0 = deserializer.deserializeUInt8(); + reqCmd1 = deserializer.deserializeUInt8(); + } + + /** + * The error code maps to one of the enumerated values. + * + * @return the current errorCode as {@link ZstackSreqErrorCode} + */ + public ZstackSreqErrorCode getErrorCode() { + return errorCode; + } + + /** + * The error code maps to one of the enumerated values. + * + * @param errorCode the ErrorCode to set as {@link ZstackSreqErrorCode} + */ + public void setErrorCode(ZstackSreqErrorCode errorCode) { + this.errorCode = errorCode; + } + + /** + * The Cmd0 value of the processed SREQ + * + * @return the current reqCmd0 as {@link int} + */ + public int getReqCmd0() { + return reqCmd0; + } + + /** + * The Cmd0 value of the processed SREQ + * + * @param reqCmd0 the ReqCmd0 to set as {@link int} + */ + public void setReqCmd0(int reqCmd0) { + this.reqCmd0 = reqCmd0; + } + + /** + * The Cmd1 value of the processed SREQ + * + * @return the current reqCmd1 as {@link int} + */ + public int getReqCmd1() { + return reqCmd1; + } + + /** + * The Cmd1 value of the processed SREQ + * + * @param reqCmd1 the ReqCmd1 to set as {@link int} + */ + public void setReqCmd1(int reqCmd1) { + this.reqCmd1 = reqCmd1; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(100); + builder.append("ZstackRpcSreqErrorSrsp [errorCode="); + builder.append(errorCode); + builder.append(", reqCmd0="); + builder.append(String.format("%02X", reqCmd0)); + builder.append(", reqCmd1="); + builder.append(String.format("%02X", reqCmd1)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java index 1d36c1fa05..1c9a4ed1d8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/rpc/ZstackSreqErrorCode.java @@ -1,89 +1,89 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackSreqErrorCode. - *

    - * SREQ RPC Error code - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackSreqErrorCode { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - INVALID_SUBSYSTEM(0x0001), - - /** - * - */ - INVALID_COMMAND_ID(0x0002), - - /** - * - */ - INVALID_PARAMETER(0x0003), - - /** - * - */ - INVALID_LENGTH(0x0003); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackSreqErrorCode s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackSreqErrorCode(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackSreqErrorCode valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.rpc; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackSreqErrorCode. + *

    + * SREQ RPC Error code + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackSreqErrorCode { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + INVALID_SUBSYSTEM(0x0001), + + /** + * + */ + INVALID_COMMAND_ID(0x0002), + + /** + * + */ + INVALID_PARAMETER(0x0003), + + /** + * + */ + INVALID_LENGTH(0x0003); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackSreqErrorCode s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackSreqErrorCode(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackSreqErrorCode valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java index 3a90139c0c..651e217e5d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackDeviceInformation.java @@ -1,109 +1,109 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackDeviceInformation. - *

    - * Device Info Constants - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackDeviceInformation { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - ZB_INFO_DEV_STATE(0x0000), - - /** - * - */ - ZB_INFO_IEEE_ADDR(0x0001), - - /** - * - */ - ZB_INFO_SHORT_ADDR(0x0002), - - /** - * - */ - ZB_INFO_PARENT_SHORT_ADDR(0x0003), - - /** - * - */ - ZB_INFO_PARENT_IEEE_ADDR(0x0004), - - /** - * - */ - ZB_INFO_CHANNEL(0x0005), - - /** - * - */ - ZB_INFO_PAN_ID(0x0006), - - /** - * - */ - ZB_INFO_EXT_PAN_ID(0x0007); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackDeviceInformation s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackDeviceInformation(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackDeviceInformation valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackDeviceInformation. + *

    + * Device Info Constants + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackDeviceInformation { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + ZB_INFO_DEV_STATE(0x0000), + + /** + * + */ + ZB_INFO_IEEE_ADDR(0x0001), + + /** + * + */ + ZB_INFO_SHORT_ADDR(0x0002), + + /** + * + */ + ZB_INFO_PARENT_SHORT_ADDR(0x0003), + + /** + * + */ + ZB_INFO_PARENT_IEEE_ADDR(0x0004), + + /** + * + */ + ZB_INFO_CHANNEL(0x0005), + + /** + * + */ + ZB_INFO_PAN_ID(0x0006), + + /** + * + */ + ZB_INFO_EXT_PAN_ID(0x0007); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackDeviceInformation s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackDeviceInformation(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackDeviceInformation valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java index 98e79a6faf..176c2bd787 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. - *

    - * This command retrieves a Device Information Property. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbGetDeviceInfoSreq extends ZstackFrameRequest { - - /** - * The Identifier for the device information. - */ - private int param; - - /** - * Request constructor - */ - public ZstackZbGetDeviceInfoSreq() { - synchronousCommand = true; - } - - /** - * The Identifier for the device information. - * - * @return the current param as {@link int} - */ - public int getParam() { - return param; - } - - /** - * The Identifier for the device information. - * - * @param param the Param to set as {@link int} - */ - public void setParam(int param) { - this.param = param; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x06)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x06); - - // Serialize the fields - serializer.serializeUInt8(param); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(53); - builder.append("ZstackZbGetDeviceInfoSreq [param="); - builder.append(param); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. + *

    + * This command retrieves a Device Information Property. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbGetDeviceInfoSreq extends ZstackFrameRequest { + + /** + * The Identifier for the device information. + */ + private int param; + + /** + * Request constructor + */ + public ZstackZbGetDeviceInfoSreq() { + synchronousCommand = true; + } + + /** + * The Identifier for the device information. + * + * @return the current param as {@link int} + */ + public int getParam() { + return param; + } + + /** + * The Identifier for the device information. + * + * @param param the Param to set as {@link int} + */ + public void setParam(int param) { + this.param = param; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x06)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x06); + + // Serialize the fields + serializer.serializeUInt8(param); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackZbGetDeviceInfoSreq [param="); + builder.append(param); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java index 3509ea390a..1810fe370e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbGetDeviceInfoSrsp.java @@ -1,93 +1,94 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. - *

    - * This command retrieves a Device Information Property. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbGetDeviceInfoSrsp extends ZstackFrameResponse { - - /** - * The Identifier for the device information. - */ - private int param; - - /** - * A buffer to hold the device information - */ - private int value; - - /** - * Response and Handler constructor - */ - public ZstackZbGetDeviceInfoSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - param = deserializer.deserializeUInt8(); - value = deserializer.deserializeUInt16(); - } - - /** - * The Identifier for the device information. - * - * @return the current param as {@link int} - */ - public int getParam() { - return param; - } - - /** - * The Identifier for the device information. - * - * @param param the Param to set as {@link int} - */ - public void setParam(int param) { - this.param = param; - } - - /** - * A buffer to hold the device information - * - * @return the current value as {@link int} - */ - public int getValue() { - return value; - } - - /** - * A buffer to hold the device information - * - * @param value the Value to set as {@link int} - */ - public void setValue(int value) { - this.value = value; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(78); - builder.append("ZstackZbGetDeviceInfoSrsp [param="); - builder.append(param); - builder.append(", value="); - builder.append(value); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_GET_DEVICE_INFO. + *

    + * This command retrieves a Device Information Property. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbGetDeviceInfoSrsp extends ZstackFrameResponse { + + /** + * The Identifier for the device information. + */ + private int param; + + /** + * A buffer to hold the device information + */ + private int value; + + /** + * Response and Handler constructor + */ + public ZstackZbGetDeviceInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + param = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt16(); + } + + /** + * The Identifier for the device information. + * + * @return the current param as {@link int} + */ + public int getParam() { + return param; + } + + /** + * The Identifier for the device information. + * + * @param param the Param to set as {@link int} + */ + public void setParam(int param) { + this.param = param; + } + + /** + * A buffer to hold the device information + * + * @return the current value as {@link int} + */ + public int getValue() { + return value; + } + + /** + * A buffer to hold the device information + * + * @param value the Value to set as {@link int} + */ + public void setValue(int value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(78); + builder.append("ZstackZbGetDeviceInfoSrsp [param="); + builder.append(param); + builder.append(", value="); + builder.append(value); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java index e46404313e..c560bcccd7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; - -/** - * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. - *

    - * This command is used to get a configuration property from non-volatile memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbReadConfigurationSreq extends ZstackFrameRequest { - - /** - * Specifies the Identifier for the configuration property. - */ - private ZstackConfigId configId; - - /** - * Request constructor - */ - public ZstackZbReadConfigurationSreq() { - synchronousCommand = true; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @return the current configId as {@link ZstackConfigId} - */ - public ZstackConfigId getConfigId() { - return configId; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @param configId the ConfigId to set as {@link ZstackConfigId} - */ - public void setConfigId(ZstackConfigId configId) { - this.configId = configId; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x04)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x04); - - // Serialize the fields - serializer.serializeUInt16(configId.getKey()); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(57); - builder.append("ZstackZbReadConfigurationSreq [configId="); - builder.append(configId); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. + *

    + * This command is used to get a configuration property from non-volatile memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbReadConfigurationSreq extends ZstackFrameRequest { + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Request constructor + */ + public ZstackZbReadConfigurationSreq() { + synchronousCommand = true; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x04); + + // Serialize the fields + serializer.serializeUInt16(configId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackZbReadConfigurationSreq [configId="); + builder.append(configId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java index f82e1bd7d1..e8f250afd7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbReadConfigurationSrsp.java @@ -1,127 +1,128 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; - -/** - * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. - *

    - * This command is used to get a configuration property from non-volatile memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbReadConfigurationSrsp extends ZstackFrameResponse { - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - */ - private ZstackResponseCode status; - - /** - * Specifies the Identifier for the configuration property. - */ - private ZstackConfigId configId; - - /** - * Buffer to hold the configuration property. - */ - private int[] value; - - /** - * Response and Handler constructor - */ - public ZstackZbReadConfigurationSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - configId = ZstackConfigId.valueOf(deserializer.deserializeUInt16()); - int len = deserializer.deserializeUInt8(); - value = deserializer.deserializeUInt8Array(len); - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @return the current configId as {@link ZstackConfigId} - */ - public ZstackConfigId getConfigId() { - return configId; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @param configId the ConfigId to set as {@link ZstackConfigId} - */ - public void setConfigId(ZstackConfigId configId) { - this.configId = configId; - } - - /** - * Buffer to hold the configuration property. - * - * @return the current value as {@link int[]} - */ - public int[] getValue() { - return value; - } - - /** - * Buffer to hold the configuration property. - * - * @param value the Value to set as {@link int[]} - */ - public void setValue(int[] value) { - this.value = value; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(132); - builder.append("ZstackZbReadConfigurationSrsp [status="); - builder.append(status); - builder.append(", configId="); - builder.append(configId); - builder.append(", value="); - for (int c = 0; c < value.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", value[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_READ_CONFIGURATION. + *

    + * This command is used to get a configuration property from non-volatile memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbReadConfigurationSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Buffer to hold the configuration property. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackZbReadConfigurationSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + configId = ZstackConfigId.valueOf(deserializer.deserializeUInt16()); + int len = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(len); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + /** + * Buffer to hold the configuration property. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Buffer to hold the configuration property. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(132); + builder.append("ZstackZbReadConfigurationSrsp [status="); + builder.append(status); + builder.append(", configId="); + builder.append(configId); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java index b70e631f44..d8eda56e24 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSreq.java @@ -1,110 +1,111 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; - -/** - * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. - *

    - * This command is used to write a configuration property to nonvolatile memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbWriteConfigurationSreq extends ZstackFrameRequest { - - /** - * Specifies the Identifier for the configuration property. - */ - private ZstackConfigId configId; - - /** - * Buffer to hold the configuration property. - */ - private int[] value; - - /** - * Request constructor - */ - public ZstackZbWriteConfigurationSreq() { - synchronousCommand = true; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @return the current configId as {@link ZstackConfigId} - */ - public ZstackConfigId getConfigId() { - return configId; - } - - /** - * Specifies the Identifier for the configuration property. - * - * @param configId the ConfigId to set as {@link ZstackConfigId} - */ - public void setConfigId(ZstackConfigId configId) { - this.configId = configId; - } - - /** - * Buffer to hold the configuration property. - * - * @return the current value as {@link int[]} - */ - public int[] getValue() { - return value; - } - - /** - * Buffer to hold the configuration property. - * - * @param value the Value to set as {@link int[]} - */ - public void setValue(int[] value) { - this.value = value; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x05)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x05); - - // Serialize the fields - serializer.serializeUInt16(configId.getKey()); - serializer.serializeUInt8(value.length); - serializer.serializeUInt8Array(value); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(108); - builder.append("ZstackZbWriteConfigurationSreq [configId="); - builder.append(configId); - builder.append(", value="); - for (int c = 0; c < value.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", value[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackConfigId; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. + *

    + * This command is used to write a configuration property to nonvolatile memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbWriteConfigurationSreq extends ZstackFrameRequest { + + /** + * Specifies the Identifier for the configuration property. + */ + private ZstackConfigId configId; + + /** + * Buffer to hold the configuration property. + */ + private int[] value; + + /** + * Request constructor + */ + public ZstackZbWriteConfigurationSreq() { + synchronousCommand = true; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @return the current configId as {@link ZstackConfigId} + */ + public ZstackConfigId getConfigId() { + return configId; + } + + /** + * Specifies the Identifier for the configuration property. + * + * @param configId the ConfigId to set as {@link ZstackConfigId} + */ + public void setConfigId(ZstackConfigId configId) { + this.configId = configId; + } + + /** + * Buffer to hold the configuration property. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Buffer to hold the configuration property. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SAPI) && (response.getReqCmd1() == 0x05)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SAPI, 0x05); + + // Serialize the fields + serializer.serializeUInt16(configId.getKey()); + serializer.serializeUInt8(value.length); + serializer.serializeUInt8Array(value); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(108); + builder.append("ZstackZbWriteConfigurationSreq [configId="); + builder.append(configId); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java index 9c54fe2488..5f6b240139 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sapi/ZstackZbWriteConfigurationSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. - *

    - * This command is used to write a configuration property to nonvolatile memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZbWriteConfigurationSrsp extends ZstackFrameResponse { - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZbWriteConfigurationSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(58); - builder.append("ZstackZbWriteConfigurationSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sapi; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZB_WRITE_CONFIGURATION. + *

    + * This command is used to write a configuration property to nonvolatile memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZbWriteConfigurationSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZbWriteConfigurationSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(58); + builder.append("ZstackZbWriteConfigurationSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java index 86be7f9db2..2f6fd7cc8d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSreq.java @@ -1,47 +1,48 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSbHandshakeCmdSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSbHandshakeCmdSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x04)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x04); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSbHandshakeCmdSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackSbHandshakeCmdSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSbHandshakeCmdSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x04); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSbHandshakeCmdSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java index 664318705a..0c64230295 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbHandshakeCmdSrsp.java @@ -1,168 +1,169 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSbHandshakeCmdSrsp extends ZstackFrameResponse { - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - */ - private ZstackResponseCode status; - - /** - */ - private int bootloaderRevision; - - /** - */ - private int deviceType; - - /** - * The maximum data size to use with Read / Write command - */ - private int bufferLength; - - /** - * 0x800 – CC2538 flash page size - */ - private int pageSize; - - /** - * Response and Handler constructor - */ - public ZstackSbHandshakeCmdSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - bootloaderRevision = deserializer.deserializeUInt32(); - deviceType = deserializer.deserializeUInt8(); - bufferLength = deserializer.deserializeUInt32(); - pageSize = deserializer.deserializeUInt32(); - } - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * - * - * @return the current bootloaderRevision as {@link int} - */ - public int getBootloaderRevision() { - return bootloaderRevision; - } - - /** - * - * - * @param bootloaderRevision the BootloaderRevision to set as {@link int} - */ - public void setBootloaderRevision(int bootloaderRevision) { - this.bootloaderRevision = bootloaderRevision; - } - - /** - * - * - * @return the current deviceType as {@link int} - */ - public int getDeviceType() { - return deviceType; - } - - /** - * - * - * @param deviceType the DeviceType to set as {@link int} - */ - public void setDeviceType(int deviceType) { - this.deviceType = deviceType; - } - - /** - * The maximum data size to use with Read / Write command - * - * @return the current bufferLength as {@link int} - */ - public int getBufferLength() { - return bufferLength; - } - - /** - * The maximum data size to use with Read / Write command - * - * @param bufferLength the BufferLength to set as {@link int} - */ - public void setBufferLength(int bufferLength) { - this.bufferLength = bufferLength; - } - - /** - * 0x800 – CC2538 flash page size - * - * @return the current pageSize as {@link int} - */ - public int getPageSize() { - return pageSize; - } - - /** - * 0x800 – CC2538 flash page size - * - * @param pageSize the PageSize to set as {@link int} - */ - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(152); - builder.append("ZstackSbHandshakeCmdSrsp [status="); - builder.append(status); - builder.append(", bootloaderRevision="); - builder.append(bootloaderRevision); - builder.append(", deviceType="); - builder.append(deviceType); - builder.append(", bufferLength="); - builder.append(bufferLength); - builder.append(", pageSize="); - builder.append(pageSize); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SB_HANDSHAKE_CMD. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackSbHandshakeCmdSrsp extends ZstackFrameResponse { + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + */ + private ZstackResponseCode status; + + /** + */ + private int bootloaderRevision; + + /** + */ + private int deviceType; + + /** + * The maximum data size to use with Read / Write command + */ + private int bufferLength; + + /** + * 0x800 – CC2538 flash page size + */ + private int pageSize; + + /** + * Response and Handler constructor + */ + public ZstackSbHandshakeCmdSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + bootloaderRevision = deserializer.deserializeUInt32(); + deviceType = deserializer.deserializeUInt8(); + bufferLength = deserializer.deserializeUInt32(); + pageSize = deserializer.deserializeUInt32(); + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * + * + * @return the current bootloaderRevision as {@link int} + */ + public int getBootloaderRevision() { + return bootloaderRevision; + } + + /** + * + * + * @param bootloaderRevision the BootloaderRevision to set as {@link int} + */ + public void setBootloaderRevision(int bootloaderRevision) { + this.bootloaderRevision = bootloaderRevision; + } + + /** + * + * + * @return the current deviceType as {@link int} + */ + public int getDeviceType() { + return deviceType; + } + + /** + * + * + * @param deviceType the DeviceType to set as {@link int} + */ + public void setDeviceType(int deviceType) { + this.deviceType = deviceType; + } + + /** + * The maximum data size to use with Read / Write command + * + * @return the current bufferLength as {@link int} + */ + public int getBufferLength() { + return bufferLength; + } + + /** + * The maximum data size to use with Read / Write command + * + * @param bufferLength the BufferLength to set as {@link int} + */ + public void setBufferLength(int bufferLength) { + this.bufferLength = bufferLength; + } + + /** + * 0x800 – CC2538 flash page size + * + * @return the current pageSize as {@link int} + */ + public int getPageSize() { + return pageSize; + } + + /** + * 0x800 – CC2538 flash page size + * + * @param pageSize the PageSize to set as {@link int} + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(152); + builder.append("ZstackSbHandshakeCmdSrsp [status="); + builder.append(status); + builder.append(", bootloaderRevision="); + builder.append(bootloaderRevision); + builder.append(", deviceType="); + builder.append(deviceType); + builder.append(", bufferLength="); + builder.append(bufferLength); + builder.append(", pageSize="); + builder.append(pageSize); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java index e10b22b581..2becfbb9b4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSreq.java @@ -1,81 +1,82 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SB_WRITE_CMD. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSbWriteCmdSreq extends ZstackFrameRequest { - - /** - * Payload data. - */ - private int[] payload; - - /** - * Request constructor - */ - public ZstackSbWriteCmdSreq() { - synchronousCommand = true; - } - - /** - * Payload data. - * - * @return the current payload as {@link int[]} - */ - public int[] getPayload() { - return payload; - } - - /** - * Payload data. - * - * @param payload the Payload to set as {@link int[]} - */ - public void setPayload(int[] payload) { - this.payload = payload; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x00)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x00); - - // Serialize the fields - serializer.serializeUInt32(payload.length); - serializer.serializeUInt8Array(payload); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(73); - builder.append("ZstackSbWriteCmdSreq [payload="); - for (int c = 0; c < payload.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", payload[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SB_WRITE_CMD. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackSbWriteCmdSreq extends ZstackFrameRequest { + + /** + * Payload data. + */ + private int[] payload; + + /** + * Request constructor + */ + public ZstackSbWriteCmdSreq() { + synchronousCommand = true; + } + + /** + * Payload data. + * + * @return the current payload as {@link int[]} + */ + public int[] getPayload() { + return payload; + } + + /** + * Payload data. + * + * @param payload the Payload to set as {@link int[]} + */ + public void setPayload(int[] payload) { + this.payload = payload; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SBL) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SBL, 0x00); + + // Serialize the fields + serializer.serializeUInt32(payload.length); + serializer.serializeUInt8Array(payload); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(73); + builder.append("ZstackSbWriteCmdSreq [payload="); + for (int c = 0; c < payload.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", payload[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java index 7f2dba54a1..b4a09e3e9f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sbl/ZstackSbWriteCmdSrsp.java @@ -1,66 +1,67 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SB_WRITE_CMD. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSbWriteCmdSrsp extends ZstackFrameResponse { - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSbWriteCmdSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 - SUCCESS 0x01 - FAILURE - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(48); - builder.append("ZstackSbWriteCmdSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sbl; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SB_WRITE_CMD. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackSbWriteCmdSrsp extends ZstackFrameResponse { + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSbWriteCmdSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 - SUCCESS 0x01 - FAILURE + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(48); + builder.append("ZstackSbWriteCmdSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java index 962e6ae573..65f43f4955 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackConfigId.java @@ -1,663 +1,663 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackConfigId. - *

    - * Device specific configuration parameters. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackConfigId { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - ZCD_NV_EXTADDR(0x0000), - - /** - * - */ - ZCD_NV_BOOTCOUNTER(0x0001), - - /** - * This parameter controls the device startup options. Size: 1 byte; Default value: 0 - */ - ZCD_NV_STARTUP_OPTION(0x0003), - - /** - * - */ - ZCD_NV_START_DELAY(0x0004), - - /** - * This item holds all kinds of network information. - */ - ZCD_NV_NIB(0x0021), - - /** - * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically - * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. - * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an - * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 - */ - ZCD_NV_POLL_RATE_OLD16(0x0035), - - /** - * When an end-device polls for data with its parent and finds that it does have data, it can poll again with a shorter duration in case - * there is more data queued for it at its parent device. This value is specified in milliseconds. This feature can be turned off by - * setting this value to zero. Size: 2 bytes; Default value: 100 - */ - ZCD_NV_QUEUED_POLL_RATE(0x0025), - - /** - * When an end-device sends a data packet, it can poll again with a shorter duration, specified by this parameter, if the - * application is expecting to receive an application level packet in response. This value is specified in milliseconds. This - * feature can be turned off by setting the value to zero. - *

    - * Note: The setting of the queued and response poll rates has to be done with caution if the device is sending and receiving - * at the same time or if the device is sending data too fast. If the device is sending data too fast, setting a queued poll rate with a - * higher duration than the sending rate will cause the poll event to be continuously rescheduled to the future. Then the device - * will never poll for data with its parent and consequently it may miss any packets destined for it. Size: 2 bytes; Default value: - * 100 - */ - ZCD_NV_RESPONSE_POLL_RATE(0x0026), - - /** - * - */ - ZCD_NV_REJOIN_POLL_RATE(0x0027), - - /** - * - */ - ZCD_NV_DATA_RETRIES(0x0028), - - /** - * The number of times an end-device will fail when communicating with its parent before invoking the rejoin mechanism to find and - * join a new parent. Size: 1 byte; Default value: 2. - */ - ZCD_NV_POLL_FAILURE_RETRIES(0x0029), - - /** - * - */ - ZCD_NV_STACK_PROFILE(0x002A), - - /** - * The amount of time (in seconds) that a router or coordinator device will buffer messages destined to their end-device child - * nodes. It is recommended that this is at least greater than the poll rate (ZCD_NV_POLL_RATE) to ensure that end-device will have - * a chance to wakeup and poll for the data. Size: 1 byte; Default value: 7 - */ - ZCD_NV_INDIRECT_MSG_TIMEOUT(0x002B), - - /** - * The amount of time (in seconds) for which a route must be idle (i.e. no packets are transmitted on that route) before that routing - * entry is marked as expired. An expired entry may be deleted if the table is full and the space is needed for another new routing - * entry. This can be set to a special value of 0 to turn off route expiry. In this case, route entries are not expired. Size: 1 byte; - * Default value: 60. - */ - ZCD_NV_ROUTE_EXPIRY_TIME(0x002C), - - /** - * This parameter configures the EXTENDED PAN ID in Z-Stack. The extended pan id is used to further segregate the sub network(s) - * among a bigger PAN network. - */ - ZCD_NV_EXTPANID(0x002D), - - /** - * The maximum number of retransmissions that a device will attempt when trying to transmit a broadcast packet. The typical range - * is from 1 through 3. Size: 1 byte; Default value: 2. - */ - ZCD_NV_BCAST_RETRIES(0x002E), - - /** - * The amount of time (in units of 100milliseconds) a device will wait before retransmitting a broadcast packet. The - * retransmission will not happen if the node hears that each of its neighbor nodes have all transmitted that packet. Size: 1 byte; - * Default value: 5 - */ - ZCD_NV_PASSIVE_ACK_TIMEOUT(0x002F), - - /** - * The maximum amount of time (in units of 100ms) that it can take for a broadcast packet to propagate through the entire network. - * This includes time for all retransmissions. - *

    - * Note: This parameter must be set with caution. It must be set to a value of at least (ZCD_NV_BCAST_RETRIES + 1) * - * ZCD_NV_PASSIVE_ACK_TIMEOUT To be safe, the actual value should be higher than the above minimum by about 500ms or more. Size: 1 - * byte; Default value: 30. - */ - ZCD_NV_BCAST_DELIVERY_TIME(0x0030), - - /** - * Holds the value of the network operational mode. The default value is NWK_MODE_MESH and must not be modified. - */ - ZCD_NV_NWK_MODE(0x0031), - - /** - * - */ - ZCD_NV_CONCENTRATOR_ENABLE(0x0032), - - /** - * - */ - ZCD_NV_CONCENTRATOR_DISCOVERY(0x0033), - - /** - * - */ - ZCD_NV_CONCENTRATOR_RADIUS(0x0034), - - /** - * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically - * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. - * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an - * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 - */ - ZCD_NV_POLL_RATE(0x0035), - - /** - * Holds the value of route cache flag. This enables or disables the route cache for coordinator and is FALSE by default. - */ - ZCD_NV_CONCENTRATOR_RC(0x0036), - - /** - * - */ - ZCD_NV_NWK_MGR_MODE(0x0037), - - /** - * - */ - ZCD_NV_SRC_RTG_EXPIRY_TIME(0x0038), - - /** - * - */ - ZCD_NV_ROUTE_DISCOVERY_TIME(0x0039), - - /** - * - */ - ZCD_NV_NWK_ACTIVE_KEY_INFO(0x003A), - - /** - * - */ - ZCD_NV_NWK_ALTERN_KEY_INFO(0x003B), - - /** - * - */ - ZCD_NV_ROUTER_OFF_ASSOC_CLEANUP(0x003C), - - /** - * - */ - ZCD_NV_NWK_LEAVE_REQ_ALLOWED(0x003D), - - /** - * Holds the value of Child Aging capability flag. This enables or disables child aging and must be set to TRUE for Zigbee 3.0 - * compliance. - */ - ZCD_NV_NWK_CHILD_AGE_ENABLE(0x003E), - - /** - * - */ - ZCD_NV_DEVICE_LIST_KA_TIMEOUT(0x003F), - - /** - * - */ - ZCD_NV_BINDING_TABLE(0x0041), - - /** - * - */ - ZCD_NV_GROUP_TABLE(0x0042), - - /** - * The number of retransmissions performed on a data packet at the application layer if the packet was transmitted with the - * end-to-end acknowledgement option enabled. Size: 1 byte; Default value: 3 - */ - ZCD_NV_APS_FRAME_RETRIES(0x0043), - - /** - * The amount of time (in milliseconds) a device will wait before re-transmitting a packet that used the APS acknowledgement - * option. If the APS acknowledgement is not received by this time, the sending device will assume a failure and attempt a - * re-transmission. - *

    - * Note: This is recommended to be set to approximately the expected round trip time for the packet. Note that if the - * destination (or source) device is an end-device, the round trip time for the packet will include an additional delay up to the - * poll duration. This is in addition to the delay normally caused by the network. Size: 2 bytes; Default value: 3000 - */ - ZCD_NV_APS_ACK_WAIT_DURATION(0x0044), - - /** - * - */ - ZCD_NV_APS_ACK_WAIT_MULTIPLIER(0x0045), - - /** - * The amount of time (in milliseconds) a device will wait for a response to a binding request. Size: 2 bytes; Default value: 8000 - */ - ZCD_NV_BINDING_TIME(0x0046), - - /** - * - */ - ZCD_NV_APS_USE_EXT_PANID(0x0047), - - /** - * - */ - ZCD_NV_COMMISSIONED_NWK_ADDR(0x0049), - - /** - * - */ - ZCD_NV_APS_NONMEMBER_RADIUS(0x004B), - - /** - * Holds the security manager entries of type ZDSecMgrEntry_t to store the TCKL used to talk with devices in the network that - * require APS security. The number of entries is controled by ZDSECMGR_DEVICE_MAX=3 by default. - */ - ZCD_NV_APS_LINK_KEY_TABLE(0x004C), - - /** - * - */ - ZCD_NV_APS_DUPREJ_TIMEOUT_INC(0x004D), - - /** - * - */ - ZCD_NV_APS_DUPREJ_TIMEOUT_COUNT(0x004E), - - /** - * - */ - ZCD_NV_APS_DUPREJ_TABLE_SIZE(0x004F), - - /** - * - */ - ZCD_NV_DIAGNOSTIC_STATS(0x0050), - - /** - * - */ - ZCD_NV_NWK_PARENT_INFO(0x0051), - - /** - * - */ - ZCD_NV_NWK_ENDDEV_TIMEOUT_DEF(0x0052), - - /** - * Holds the value of Child Aging Timeout. This is the time in seconds used by END DEVICE when sending End Device Timeout Request that - * tells a COORDINATOR the timeout to remove this END DEVICE after no data poll is received. - */ - ZCD_NV_END_DEV_TIMEOUT_VALUE(0x0053), - - /** - * Holds the value of End Device Configuration field when END DEVICE when sending End Device Timeout Request. Is set to 0x00 by - * default which is the only valid value accourding to Zigbee Core spec R21. - */ - ZCD_NV_END_DEV_CONFIGURATION(0x0054), - - /** - * - */ - ZCD_NV_BDBNODEISONANETWORK(0x0055), - - /** - * - */ - ZCD_NV_BDBREPORTINGCONFIG(0x0056), - - /** - * holds the value of network key that is generated by default. The key can be set to a fixed value by setting DEFAULT_KEY macro. This - * is used for securing and un-securing packets in the network, if security is enabled for the network. - *

    - * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 16 bytes; - * Default value: [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F] - */ - ZCD_NV_PRECFGKEY(0x0062), - - /** - * If security functionality is enabled, there are two options to distribute the security key to all devices in the network. If this - * parameter is true, the same security key is assumed to be pre-configured in all devices in the network.If it is set to false, then - * the key only needs to be configured on the coordinator device. In this case, the key is distributed to each device upon joining by - * the coordinator. This key distribution will happen in the “clear” on the last hop of the packet transmission and this - * constitutes a brief “period of vulnerability” during which a malicious device can capture the key. Hence it is not recommended - * unless it can be ensured that there are no malicious devices in the vicinity at the time of network formation. - *

    - * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 1 byte; - * Default value: TRUE - */ - ZCD_NV_PRECFGKEYS_ENABLE(0x0063), - - /** - * This parameter determines if security is used or not in this network. It can be set to 0 (to turn off NWK security) or 1 (to turn on NWK - * security). Size: 1 byte; Default value: 0. - */ - ZCD_NV_SECURITY_MODE(0x0064), - - /** - * This value tells if only secure joins are allowed. Set to TRUE by default which is the only valid value according to Zigbee Core - * spec R21. - */ - ZCD_NV_SECURE_PERMIT_JOIN(0x0065), - - /** - * Is equal to ZG_GLOBAL_LINK_KEY=1 and must not be modified according to Zigbee Core spec R21. - */ - ZCD_NV_APS_LINK_KEY_TYPE(0x0066), - - /** - * - */ - ZCD_NV_APS_ALLOW_R19_SECURITY(0x0067), - - /** - * Default distributed nwk key Id. Nv ID not in use - */ - ZCD_NV_DISTRIBUTED_KEY(0x0068), - - /** - * - */ - ZCD_NV_IMPLICIT_CERTIFICATE(0x0069), - - /** - * - */ - ZCD_NV_DEVICE_PRIVATE_KEY(0x006A), - - /** - * - */ - ZCD_NV_CA_PUBLIC_KEY(0x006B), - - /** - * - */ - ZCD_NV_KE_MAX_DEVICES(0x006C), - - /** - * Controls whether a single pre-configured trust center link key is used or whether multiple pre- configured trust center link - * keys are used, hereby referred to as Single Key Mode and Multiple Key Mode, respectively. In multiple key mode, unique - * pre-configured trust center link keys are used between the trust center and each individual device joining the network. - * Multiple key mode is required by the recommended secure procedure in ZigBeeSE profile Specification. In single key mode, all - * devices are using the same pre-configured trust center link key to join the network. The single key mode provides a simplified - * alternative procedure to set up the network. It can be used for testing and debugging purpose. Size: 1 byte; Default value: TRUE - */ - ZCD_NV_USE_DEFAULT_TCLK(0x006D), - - /** - * - */ - ZCD_NV_RNG_COUNTER(0x006F), - - /** - * - */ - ZCD_NV_RANDOM_SEED(0x0070), - - /** - * - */ - ZCD_NV_TRUSTCENTER_ADDR(0x0071), - - /** - * - */ - ZCD_NV_CERT_283(0x0072), - - /** - * - */ - ZCD_NV_PRIVATE_KEY_283(0x0073), - - /** - * - */ - ZCD_NV_PUBLIC_KEY_283(0x0074), - - /** - * - */ - ZCD_NV_NWK_SEC_MATERIAL_TABLE_START(0x0075), - - /** - * - */ - ZCD_NV_NWK_SEC_MATERIAL_TABLE_END(0x0080), - - /** - * An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it can easily identified or - * described later. The first byte is the length of the user descriptor data and must not be greater than 16. Size: 17 bytes; Default - * value: “CC2530-ZNP x......” (dots represent the device IEEE address) - */ - ZCD_NV_USERDESC(0x0081), - - /** - * This holds the value of nwkActiveKeyItems structure and restores the NWK key counter after power cycles. - */ - ZCD_NV_NWKKEY(0x0082), - - /** - * This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. Networks that exist in the same - * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate “don’t care”. Size: - * 2 bytes; Default value: 0xFFFF - */ - ZCD_NV_PANID(0x0083), - - /** - * This parameter is a bit mask of the channels on which this network can operate (note that multiple channels can be selected). See - * section 4.5.16 for a table of the bitmap representation that maps to each channel. Multiple networks that exist in the same - * vicinity are encouraged to have different values. If multiple channels are selected, the coordinator will pick one of the - * channels for network operation. First, an energy scan is performed on each channel and those channels with a high energy level - * are discarded. Then, the coordinator determines the number of existing ZigBee networks on each of the remaining channels and - * picks the one with the fewest networks. For routers and end-devices, the device will simply scan all the selected channels until - * it finds the ZigBee network. Size: 4 bytes; Default value: 0x00000800 - */ - ZCD_NV_CHANLIST(0x0084), - - /** - * - */ - ZCD_NV_SCAN_DURATION(0x0086), - - /** - * This is the logical type of the device in the ZigBee network. This can be set to a COORDINATOR (0x00), ROUTER (0x01) or ENDDEVICE - * (0x02). - *

    - * Note: This parameter is read by the CC2530-ZNP device immediately when it powers up after a reset. Size: 1 byte; Default - * value: 0x00 - */ - ZCD_NV_LOGICAL_TYPE(0x0087), - - /** - * - */ - ZCD_NV_NWKMGR_MIN_TX(0x0088), - - /** - * - */ - ZCD_NV_NWKMGR_ADDR(0x0089), - - /** - * This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the host processor. By - * default, this item is set to FALSE, which means that the host processor must use the ZDO_MSG_CB_REGISTER command to subscribe to - * a specific ZDO callback in order to receive it. The ZDO callback is then conveyed as part of the ZDO_MSG_CB_INCOMING command. If - * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the “verbose” response. For example, the host - * processor would receive the ZDO_IEEE_ADDR_RSP command in response to ZDO_IEEE_ADDR_REQ. Size: 1 byte; Default value: FALSE - */ - ZCD_NV_ZDO_DIRECT_CB(0x008F), - - /** - * - */ - ZCD_NV_SAS_SHORT_ADDR(0x00B1), - - /** - * - */ - ZCD_NV_SAS_EXT_PANID(0x00B2), - - /** - * - */ - ZCD_NV_SAS_PANID(0x00B3), - - /** - * - */ - ZCD_NV_SAS_CHANNEL_MASK(0x00B4), - - /** - * - */ - ZCD_NV_SAS_PROTOCOL_VER(0x00B5), - - /** - * - */ - ZCD_NV_SAS_STACK_PROFILE(0x00B6), - - /** - * - */ - ZCD_NV_SAS_STARTUP_CTRL(0x00B7), - - /** - * - */ - ZCD_NV_SAS_TC_ADDR(0x00C1), - - /** - * - */ - ZCD_NV_SAS_TC_MASTER_KEY(0x00C2), - - /** - * - */ - ZCD_NV_SAS_NWK_KEY(0x00C3), - - /** - * - */ - ZCD_NV_SAS_USE_INSEC_JOIN(0x00C4), - - /** - * - */ - ZCD_NV_SAS_PRECFG_LINK_KEY(0x00C5), - - /** - * - */ - ZCD_NV_SAS_NWK_KEY_SEQ_NUM(0x00C6), - - /** - * - */ - ZCD_NV_SAS_NWK_KEY_TYPE(0x00C7), - - /** - * - */ - ZCD_NV_SAS_NWK_MGR_ADDR(0x00C8), - - /** - * - */ - ZCD_NV_SAS_CURR_TC_MASTER_KEY(0x00D1), - - /** - * - */ - ZCD_NV_SAS_CURR_NWK_KEY(0x00D2), - - /** - * - */ - ZCD_NV_TCLK_TABLE_START(0x0101), - - /** - * - */ - ZCD_NV_TCLK_TABLE_END(0x01FF), - - /** - * - */ - ZCD_NV_APS_LINK_KEY_DATA_START(0x0201), - - /** - * - */ - ZCD_NV_APS_LINK_KEY_DATA_END(0x02FF); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackConfigId s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackConfigId(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackConfigId valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackConfigId. + *

    + * Device specific configuration parameters. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackConfigId { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + ZCD_NV_EXTADDR(0x0000), + + /** + * + */ + ZCD_NV_BOOTCOUNTER(0x0001), + + /** + * This parameter controls the device startup options. Size: 1 byte; Default value: 0 + */ + ZCD_NV_STARTUP_OPTION(0x0003), + + /** + * + */ + ZCD_NV_START_DELAY(0x0004), + + /** + * This item holds all kinds of network information. + */ + ZCD_NV_NIB(0x0021), + + /** + * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically + * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. + * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an + * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 + */ + ZCD_NV_POLL_RATE_OLD16(0x0035), + + /** + * When an end-device polls for data with its parent and finds that it does have data, it can poll again with a shorter duration in case + * there is more data queued for it at its parent device. This value is specified in milliseconds. This feature can be turned off by + * setting this value to zero. Size: 2 bytes; Default value: 100 + */ + ZCD_NV_QUEUED_POLL_RATE(0x0025), + + /** + * When an end-device sends a data packet, it can poll again with a shorter duration, specified by this parameter, if the + * application is expecting to receive an application level packet in response. This value is specified in milliseconds. This + * feature can be turned off by setting the value to zero. + *

    + * Note: The setting of the queued and response poll rates has to be done with caution if the device is sending and receiving + * at the same time or if the device is sending data too fast. If the device is sending data too fast, setting a queued poll rate with a + * higher duration than the sending rate will cause the poll event to be continuously rescheduled to the future. Then the device + * will never poll for data with its parent and consequently it may miss any packets destined for it. Size: 2 bytes; Default value: + * 100 + */ + ZCD_NV_RESPONSE_POLL_RATE(0x0026), + + /** + * + */ + ZCD_NV_REJOIN_POLL_RATE(0x0027), + + /** + * + */ + ZCD_NV_DATA_RETRIES(0x0028), + + /** + * The number of times an end-device will fail when communicating with its parent before invoking the rejoin mechanism to find and + * join a new parent. Size: 1 byte; Default value: 2. + */ + ZCD_NV_POLL_FAILURE_RETRIES(0x0029), + + /** + * + */ + ZCD_NV_STACK_PROFILE(0x002A), + + /** + * The amount of time (in seconds) that a router or coordinator device will buffer messages destined to their end-device child + * nodes. It is recommended that this is at least greater than the poll rate (ZCD_NV_POLL_RATE) to ensure that end-device will have + * a chance to wakeup and poll for the data. Size: 1 byte; Default value: 7 + */ + ZCD_NV_INDIRECT_MSG_TIMEOUT(0x002B), + + /** + * The amount of time (in seconds) for which a route must be idle (i.e. no packets are transmitted on that route) before that routing + * entry is marked as expired. An expired entry may be deleted if the table is full and the space is needed for another new routing + * entry. This can be set to a special value of 0 to turn off route expiry. In this case, route entries are not expired. Size: 1 byte; + * Default value: 60. + */ + ZCD_NV_ROUTE_EXPIRY_TIME(0x002C), + + /** + * This parameter configures the EXTENDED PAN ID in Z-Stack. The extended pan id is used to further segregate the sub network(s) + * among a bigger PAN network. + */ + ZCD_NV_EXTPANID(0x002D), + + /** + * The maximum number of retransmissions that a device will attempt when trying to transmit a broadcast packet. The typical range + * is from 1 through 3. Size: 1 byte; Default value: 2. + */ + ZCD_NV_BCAST_RETRIES(0x002E), + + /** + * The amount of time (in units of 100milliseconds) a device will wait before retransmitting a broadcast packet. The + * retransmission will not happen if the node hears that each of its neighbor nodes have all transmitted that packet. Size: 1 byte; + * Default value: 5 + */ + ZCD_NV_PASSIVE_ACK_TIMEOUT(0x002F), + + /** + * The maximum amount of time (in units of 100ms) that it can take for a broadcast packet to propagate through the entire network. + * This includes time for all retransmissions. + *

    + * Note: This parameter must be set with caution. It must be set to a value of at least (ZCD_NV_BCAST_RETRIES + 1) * + * ZCD_NV_PASSIVE_ACK_TIMEOUT To be safe, the actual value should be higher than the above minimum by about 500ms or more. Size: 1 + * byte; Default value: 30. + */ + ZCD_NV_BCAST_DELIVERY_TIME(0x0030), + + /** + * Holds the value of the network operational mode. The default value is NWK_MODE_MESH and must not be modified. + */ + ZCD_NV_NWK_MODE(0x0031), + + /** + * + */ + ZCD_NV_CONCENTRATOR_ENABLE(0x0032), + + /** + * + */ + ZCD_NV_CONCENTRATOR_DISCOVERY(0x0033), + + /** + * + */ + ZCD_NV_CONCENTRATOR_RADIUS(0x0034), + + /** + * If this parameter is set to a non-zero value, a CC2530-ZNP device that is configured as an end- device will wake up periodically + * with this duration to check for data with its parent device. This value is specified in milliseconds and can range from 1 to 65000. + * If this parameter is set to zero, the device will not automatically wake up to poll for data. Instead, an external trigger or an + * internal event (for example, via a software timer event) can be used to wake up the device. Size: 4 bytes; Default value: 2000 + */ + ZCD_NV_POLL_RATE(0x0035), + + /** + * Holds the value of route cache flag. This enables or disables the route cache for coordinator and is FALSE by default. + */ + ZCD_NV_CONCENTRATOR_RC(0x0036), + + /** + * + */ + ZCD_NV_NWK_MGR_MODE(0x0037), + + /** + * + */ + ZCD_NV_SRC_RTG_EXPIRY_TIME(0x0038), + + /** + * + */ + ZCD_NV_ROUTE_DISCOVERY_TIME(0x0039), + + /** + * + */ + ZCD_NV_NWK_ACTIVE_KEY_INFO(0x003A), + + /** + * + */ + ZCD_NV_NWK_ALTERN_KEY_INFO(0x003B), + + /** + * + */ + ZCD_NV_ROUTER_OFF_ASSOC_CLEANUP(0x003C), + + /** + * + */ + ZCD_NV_NWK_LEAVE_REQ_ALLOWED(0x003D), + + /** + * Holds the value of Child Aging capability flag. This enables or disables child aging and must be set to TRUE for Zigbee 3.0 + * compliance. + */ + ZCD_NV_NWK_CHILD_AGE_ENABLE(0x003E), + + /** + * + */ + ZCD_NV_DEVICE_LIST_KA_TIMEOUT(0x003F), + + /** + * + */ + ZCD_NV_BINDING_TABLE(0x0041), + + /** + * + */ + ZCD_NV_GROUP_TABLE(0x0042), + + /** + * The number of retransmissions performed on a data packet at the application layer if the packet was transmitted with the + * end-to-end acknowledgement option enabled. Size: 1 byte; Default value: 3 + */ + ZCD_NV_APS_FRAME_RETRIES(0x0043), + + /** + * The amount of time (in milliseconds) a device will wait before re-transmitting a packet that used the APS acknowledgement + * option. If the APS acknowledgement is not received by this time, the sending device will assume a failure and attempt a + * re-transmission. + *

    + * Note: This is recommended to be set to approximately the expected round trip time for the packet. Note that if the + * destination (or source) device is an end-device, the round trip time for the packet will include an additional delay up to the + * poll duration. This is in addition to the delay normally caused by the network. Size: 2 bytes; Default value: 3000 + */ + ZCD_NV_APS_ACK_WAIT_DURATION(0x0044), + + /** + * + */ + ZCD_NV_APS_ACK_WAIT_MULTIPLIER(0x0045), + + /** + * The amount of time (in milliseconds) a device will wait for a response to a binding request. Size: 2 bytes; Default value: 8000 + */ + ZCD_NV_BINDING_TIME(0x0046), + + /** + * + */ + ZCD_NV_APS_USE_EXT_PANID(0x0047), + + /** + * + */ + ZCD_NV_COMMISSIONED_NWK_ADDR(0x0049), + + /** + * + */ + ZCD_NV_APS_NONMEMBER_RADIUS(0x004B), + + /** + * Holds the security manager entries of type ZDSecMgrEntry_t to store the TCKL used to talk with devices in the network that + * require APS security. The number of entries is controled by ZDSECMGR_DEVICE_MAX=3 by default. + */ + ZCD_NV_APS_LINK_KEY_TABLE(0x004C), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TIMEOUT_INC(0x004D), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TIMEOUT_COUNT(0x004E), + + /** + * + */ + ZCD_NV_APS_DUPREJ_TABLE_SIZE(0x004F), + + /** + * + */ + ZCD_NV_DIAGNOSTIC_STATS(0x0050), + + /** + * + */ + ZCD_NV_NWK_PARENT_INFO(0x0051), + + /** + * + */ + ZCD_NV_NWK_ENDDEV_TIMEOUT_DEF(0x0052), + + /** + * Holds the value of Child Aging Timeout. This is the time in seconds used by END DEVICE when sending End Device Timeout Request that + * tells a COORDINATOR the timeout to remove this END DEVICE after no data poll is received. + */ + ZCD_NV_END_DEV_TIMEOUT_VALUE(0x0053), + + /** + * Holds the value of End Device Configuration field when END DEVICE when sending End Device Timeout Request. Is set to 0x00 by + * default which is the only valid value accourding to Zigbee Core spec R21. + */ + ZCD_NV_END_DEV_CONFIGURATION(0x0054), + + /** + * + */ + ZCD_NV_BDBNODEISONANETWORK(0x0055), + + /** + * + */ + ZCD_NV_BDBREPORTINGCONFIG(0x0056), + + /** + * holds the value of network key that is generated by default. The key can be set to a fixed value by setting DEFAULT_KEY macro. This + * is used for securing and un-securing packets in the network, if security is enabled for the network. + *

    + * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 16 bytes; + * Default value: [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F] + */ + ZCD_NV_PRECFGKEY(0x0062), + + /** + * If security functionality is enabled, there are two options to distribute the security key to all devices in the network. If this + * parameter is true, the same security key is assumed to be pre-configured in all devices in the network.If it is set to false, then + * the key only needs to be configured on the coordinator device. In this case, the key is distributed to each device upon joining by + * the coordinator. This key distribution will happen in the “clear” on the last hop of the packet transmission and this + * constitutes a brief “period of vulnerability” during which a malicious device can capture the key. Hence it is not recommended + * unless it can be ensured that there are no malicious devices in the vicinity at the time of network formation. + *

    + * Note: Use of this configuration item requires the ZNP code to be built with the SECURE=1 compile option. Size: 1 byte; + * Default value: TRUE + */ + ZCD_NV_PRECFGKEYS_ENABLE(0x0063), + + /** + * This parameter determines if security is used or not in this network. It can be set to 0 (to turn off NWK security) or 1 (to turn on NWK + * security). Size: 1 byte; Default value: 0. + */ + ZCD_NV_SECURITY_MODE(0x0064), + + /** + * This value tells if only secure joins are allowed. Set to TRUE by default which is the only valid value according to Zigbee Core + * spec R21. + */ + ZCD_NV_SECURE_PERMIT_JOIN(0x0065), + + /** + * Is equal to ZG_GLOBAL_LINK_KEY=1 and must not be modified according to Zigbee Core spec R21. + */ + ZCD_NV_APS_LINK_KEY_TYPE(0x0066), + + /** + * + */ + ZCD_NV_APS_ALLOW_R19_SECURITY(0x0067), + + /** + * Default distributed nwk key Id. Nv ID not in use + */ + ZCD_NV_DISTRIBUTED_KEY(0x0068), + + /** + * + */ + ZCD_NV_IMPLICIT_CERTIFICATE(0x0069), + + /** + * + */ + ZCD_NV_DEVICE_PRIVATE_KEY(0x006A), + + /** + * + */ + ZCD_NV_CA_PUBLIC_KEY(0x006B), + + /** + * + */ + ZCD_NV_KE_MAX_DEVICES(0x006C), + + /** + * Controls whether a single pre-configured trust center link key is used or whether multiple pre- configured trust center link + * keys are used, hereby referred to as Single Key Mode and Multiple Key Mode, respectively. In multiple key mode, unique + * pre-configured trust center link keys are used between the trust center and each individual device joining the network. + * Multiple key mode is required by the recommended secure procedure in ZigBeeSE profile Specification. In single key mode, all + * devices are using the same pre-configured trust center link key to join the network. The single key mode provides a simplified + * alternative procedure to set up the network. It can be used for testing and debugging purpose. Size: 1 byte; Default value: TRUE + */ + ZCD_NV_USE_DEFAULT_TCLK(0x006D), + + /** + * + */ + ZCD_NV_RNG_COUNTER(0x006F), + + /** + * + */ + ZCD_NV_RANDOM_SEED(0x0070), + + /** + * + */ + ZCD_NV_TRUSTCENTER_ADDR(0x0071), + + /** + * + */ + ZCD_NV_CERT_283(0x0072), + + /** + * + */ + ZCD_NV_PRIVATE_KEY_283(0x0073), + + /** + * + */ + ZCD_NV_PUBLIC_KEY_283(0x0074), + + /** + * + */ + ZCD_NV_NWK_SEC_MATERIAL_TABLE_START(0x0075), + + /** + * + */ + ZCD_NV_NWK_SEC_MATERIAL_TABLE_END(0x0080), + + /** + * An optional user-defined data (up to 16bytes) that can be configured in a CC2530-ZNP device so that it can easily identified or + * described later. The first byte is the length of the user descriptor data and must not be greater than 16. Size: 17 bytes; Default + * value: “CC2530-ZNP x......” (dots represent the device IEEE address) + */ + ZCD_NV_USERDESC(0x0081), + + /** + * This holds the value of nwkActiveKeyItems structure and restores the NWK key counter after power cycles. + */ + ZCD_NV_NWKKEY(0x0082), + + /** + * This parameter identifies the ZigBee network. This should be set to a value between 0 and 0x3FFF. Networks that exist in the same + * vicinity must have different values for this parameter. It can be set to a special value of 0xFFFF to indicate “don’t care”. Size: + * 2 bytes; Default value: 0xFFFF + */ + ZCD_NV_PANID(0x0083), + + /** + * This parameter is a bit mask of the channels on which this network can operate (note that multiple channels can be selected). See + * section 4.5.16 for a table of the bitmap representation that maps to each channel. Multiple networks that exist in the same + * vicinity are encouraged to have different values. If multiple channels are selected, the coordinator will pick one of the + * channels for network operation. First, an energy scan is performed on each channel and those channels with a high energy level + * are discarded. Then, the coordinator determines the number of existing ZigBee networks on each of the remaining channels and + * picks the one with the fewest networks. For routers and end-devices, the device will simply scan all the selected channels until + * it finds the ZigBee network. Size: 4 bytes; Default value: 0x00000800 + */ + ZCD_NV_CHANLIST(0x0084), + + /** + * + */ + ZCD_NV_SCAN_DURATION(0x0086), + + /** + * This is the logical type of the device in the ZigBee network. This can be set to a COORDINATOR (0x00), ROUTER (0x01) or ENDDEVICE + * (0x02). + *

    + * Note: This parameter is read by the CC2530-ZNP device immediately when it powers up after a reset. Size: 1 byte; Default + * value: 0x00 + */ + ZCD_NV_LOGICAL_TYPE(0x0087), + + /** + * + */ + ZCD_NV_NWKMGR_MIN_TX(0x0088), + + /** + * + */ + ZCD_NV_NWKMGR_ADDR(0x0089), + + /** + * This configures the manner in which ZDO responses (hereby referred to as callbacks) are issued to the host processor. By + * default, this item is set to FALSE, which means that the host processor must use the ZDO_MSG_CB_REGISTER command to subscribe to + * a specific ZDO callback in order to receive it. The ZDO callback is then conveyed as part of the ZDO_MSG_CB_INCOMING command. If + * ZCD_NV_ZDO_DIRECT_CB is set TRUE, then the host processor will receive the “verbose” response. For example, the host + * processor would receive the ZDO_IEEE_ADDR_RSP command in response to ZDO_IEEE_ADDR_REQ. Size: 1 byte; Default value: FALSE + */ + ZCD_NV_ZDO_DIRECT_CB(0x008F), + + /** + * + */ + ZCD_NV_SAS_SHORT_ADDR(0x00B1), + + /** + * + */ + ZCD_NV_SAS_EXT_PANID(0x00B2), + + /** + * + */ + ZCD_NV_SAS_PANID(0x00B3), + + /** + * + */ + ZCD_NV_SAS_CHANNEL_MASK(0x00B4), + + /** + * + */ + ZCD_NV_SAS_PROTOCOL_VER(0x00B5), + + /** + * + */ + ZCD_NV_SAS_STACK_PROFILE(0x00B6), + + /** + * + */ + ZCD_NV_SAS_STARTUP_CTRL(0x00B7), + + /** + * + */ + ZCD_NV_SAS_TC_ADDR(0x00C1), + + /** + * + */ + ZCD_NV_SAS_TC_MASTER_KEY(0x00C2), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY(0x00C3), + + /** + * + */ + ZCD_NV_SAS_USE_INSEC_JOIN(0x00C4), + + /** + * + */ + ZCD_NV_SAS_PRECFG_LINK_KEY(0x00C5), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY_SEQ_NUM(0x00C6), + + /** + * + */ + ZCD_NV_SAS_NWK_KEY_TYPE(0x00C7), + + /** + * + */ + ZCD_NV_SAS_NWK_MGR_ADDR(0x00C8), + + /** + * + */ + ZCD_NV_SAS_CURR_TC_MASTER_KEY(0x00D1), + + /** + * + */ + ZCD_NV_SAS_CURR_NWK_KEY(0x00D2), + + /** + * + */ + ZCD_NV_TCLK_TABLE_START(0x0101), + + /** + * + */ + ZCD_NV_TCLK_TABLE_END(0x01FF), + + /** + * + */ + ZCD_NV_APS_LINK_KEY_DATA_START(0x0201), + + /** + * + */ + ZCD_NV_APS_LINK_KEY_DATA_END(0x02FF); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackConfigId s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackConfigId(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackConfigId valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java index 201ceed1ba..b83c8b3470 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackDiagnosticAttribute.java @@ -1,144 +1,144 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackDiagnosticAttribute. - *

    - * Diagnostics attribute IDs. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackDiagnosticAttribute { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * System Clock when stats were saved/cleared - */ - ZDIAGS_SYSTEM_CLOCK(0x0000), - - /** - * Increments every time the system resets - */ - ZDIAGS_NUMBER_OF_RESETS(0x0001), - - /** - * MAC diagnostic CRC success counter - */ - ZDIAGS_MAC_RX_CRC_PASS(0x0064), - - /** - * MAC diagnostic CRC failure counter - */ - ZDIAGS_MAC_RX_CRC_FAIL(0x0065), - - /** - * MAC layer retries a unicast - */ - ZDIAGS_MAC_TX_UCAST_RETRY(0x006A), - - /** - * Mac layer fails to send a unicast - */ - ZDIAGS_MAC_TX_UCAST_FAIL(0x006B), - - /** - * NWK packet decryption failed - */ - ZDIAGS_NWK_DECRYPT_FAILURES(0x00CF), - - /** - * NWK packet drop because of validation error - */ - ZDIAGS_PACKET_VALIDATE_DROP_COUNT(0x00D3), - - /** - * APS layer transmits broadcast - */ - ZDIAGS_APS_TX_BCAST(0x012D), - - /** - * APS layer successfully transmits a unicast - */ - ZDIAGS_APS_TX_UCAST_SUCCESS(0x012F), - - /** - * APS layer retries the sending of a unicast - */ - ZDIAGS_APS_TX_UCAST_RETRY(0x0130), - - /** - * APS layer fails to send a unicast - */ - ZDIAGS_APS_TX_UCAST_FAIL(0x0131), - - /** - * APS packet decryption failed - */ - ZDIAGS_APS_DECRYPT_FAILURES(0x0134), - - /** - * APS invalid packet dropped - */ - ZDIAGS_APS_INVALID_PACKETS(0x0135), - - /** - * Number of MAC retries per APS message - */ - ZDIAGS_MAC_RETRIES_PER_APS_TX_SUCCESS(0x0136); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackDiagnosticAttribute s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackDiagnosticAttribute(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackDiagnosticAttribute valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackDiagnosticAttribute. + *

    + * Diagnostics attribute IDs. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackDiagnosticAttribute { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * System Clock when stats were saved/cleared + */ + ZDIAGS_SYSTEM_CLOCK(0x0000), + + /** + * Increments every time the system resets + */ + ZDIAGS_NUMBER_OF_RESETS(0x0001), + + /** + * MAC diagnostic CRC success counter + */ + ZDIAGS_MAC_RX_CRC_PASS(0x0064), + + /** + * MAC diagnostic CRC failure counter + */ + ZDIAGS_MAC_RX_CRC_FAIL(0x0065), + + /** + * MAC layer retries a unicast + */ + ZDIAGS_MAC_TX_UCAST_RETRY(0x006A), + + /** + * Mac layer fails to send a unicast + */ + ZDIAGS_MAC_TX_UCAST_FAIL(0x006B), + + /** + * NWK packet decryption failed + */ + ZDIAGS_NWK_DECRYPT_FAILURES(0x00CF), + + /** + * NWK packet drop because of validation error + */ + ZDIAGS_PACKET_VALIDATE_DROP_COUNT(0x00D3), + + /** + * APS layer transmits broadcast + */ + ZDIAGS_APS_TX_BCAST(0x012D), + + /** + * APS layer successfully transmits a unicast + */ + ZDIAGS_APS_TX_UCAST_SUCCESS(0x012F), + + /** + * APS layer retries the sending of a unicast + */ + ZDIAGS_APS_TX_UCAST_RETRY(0x0130), + + /** + * APS layer fails to send a unicast + */ + ZDIAGS_APS_TX_UCAST_FAIL(0x0131), + + /** + * APS packet decryption failed + */ + ZDIAGS_APS_DECRYPT_FAILURES(0x0134), + + /** + * APS invalid packet dropped + */ + ZDIAGS_APS_INVALID_PACKETS(0x0135), + + /** + * Number of MAC retries per APS message + */ + ZDIAGS_MAC_RETRIES_PER_APS_TX_SUCCESS(0x0136); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackDiagnosticAttribute s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackDiagnosticAttribute(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackDiagnosticAttribute valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java index 9e1fe4072d..58e0ec6d68 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackNwkKeyDesc.java @@ -1,100 +1,100 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; -import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack structure ZstackNwkKeyDesc. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackNwkKeyDesc { - - /** - */ - private int keySeqNum; - - /** - */ - private ZigBeeKey key; - - /** - * - * - * @return the current keySeqNum as {@link int} - */ - public int getKeySeqNum() { - return keySeqNum; - } - - /** - * - * - * @param keySeqNum the keySeqNum to set as {@link int} - */ - public void setKeySeqNum(int keySeqNum) { - this.keySeqNum = keySeqNum; - } - - /** - * - * - * @return the current key as {@link ZigBeeKey} - */ - public ZigBeeKey getKey() { - return key; - } - - /** - * - * - * @param key the key to set as {@link ZigBeeKey} - */ - public void setKey(ZigBeeKey key) { - this.key = key; - } - - /** - * Serialize the data from this structure class to an integer array - * - * @param serializer the {@link ZstackSerializer} to use - */ - public int[] serialize(ZstackSerializer serializer) { - // Serialize the fields - serializer.serializeUInt8(keySeqNum); - serializer.serializeZigBeeKey(key); - return serializer.getBuffer(); - } - - /** - * Deserialize the data into this structure class - * - * @param deserializer the {@link ZstackDeserializer} to use - */ - public void deserialize (ZstackDeserializer deserializer) { - // Deserialize the fields - keySeqNum = deserializer.deserializeUInt8(); - key = deserializer.deserializeZigBeeKey(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(69); - builder.append("ZstackNwkKeyDesc [keySeqNum="); - builder.append(keySeqNum); - builder.append(", key="); - builder.append(key); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; +import com.zsmartsystems.zigbee.security.ZigBeeKey; + +/** + * Class to implement the Z-Stack structure ZstackNwkKeyDesc. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackNwkKeyDesc { + + /** + */ + private int keySeqNum; + + /** + */ + private ZigBeeKey key; + + /** + * + * + * @return the current keySeqNum as {@link int} + */ + public int getKeySeqNum() { + return keySeqNum; + } + + /** + * + * + * @param keySeqNum the keySeqNum to set as {@link int} + */ + public void setKeySeqNum(int keySeqNum) { + this.keySeqNum = keySeqNum; + } + + /** + * + * + * @return the current key as {@link ZigBeeKey} + */ + public ZigBeeKey getKey() { + return key; + } + + /** + * + * + * @param key the key to set as {@link ZigBeeKey} + */ + public void setKey(ZigBeeKey key) { + this.key = key; + } + + /** + * Serialize the data from this structure class to an integer array + * + * @param serializer the {@link ZstackSerializer} to use + */ + public int[] serialize(ZstackSerializer serializer) { + // Serialize the fields + serializer.serializeUInt8(keySeqNum); + serializer.serializeZigBeeKey(key); + return serializer.getBuffer(); + } + + /** + * Deserialize the data into this structure class + * + * @param deserializer the {@link ZstackDeserializer} to use + */ + public void deserialize (ZstackDeserializer deserializer) { + // Deserialize the fields + keySeqNum = deserializer.deserializeUInt8(); + key = deserializer.deserializeZigBeeKey(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(69); + builder.append("ZstackNwkKeyDesc [keySeqNum="); + builder.append(keySeqNum); + builder.append(", key="); + builder.append(key); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java index b3947de67f..0e421b35d2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetReason.java @@ -1,84 +1,84 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackResetReason. - *

    - * Reasons for reset - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackResetReason { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - POWER_UP(0x0000), - - /** - * - */ - EXTERNAL(0x0001), - - /** - * - */ - WATCH_DOG(0x0002); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackResetReason s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackResetReason(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackResetReason valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResetReason. + *

    + * Reasons for reset + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResetReason { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + POWER_UP(0x0000), + + /** + * + */ + EXTERNAL(0x0001), + + /** + * + */ + WATCH_DOG(0x0002); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResetReason s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResetReason(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResetReason valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java index 87abe5e4df..0c4c19d363 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackResetType.java @@ -1,79 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackResetType. - *

    - * Reset Command Type - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackResetType { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - TARGET_DEVICE(0x0000), - - /** - * - */ - SERIAL_BOOTLOADER(0x0001); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackResetType s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackResetType(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackResetType valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackResetType. + *

    + * Reset Command Type + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackResetType { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + TARGET_DEVICE(0x0000), + + /** + * + */ + SERIAL_BOOTLOADER(0x0001); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackResetType s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackResetType(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackResetType valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java index ba93991378..740f563a38 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSecMgrEntry.java @@ -1,128 +1,128 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAuthenticationOption; -import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; -import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; - -/** - * Class to implement the Z-Stack structure ZstackSecMgrEntry. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSecMgrEntry { - - /** - * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE - */ - private int ami; - - /** - * Index to the Link Key table in NV - */ - private int keyNvId; - - /** - */ - private ZstackAuthenticationOption authenticateOption; - - /** - * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE - * - * @return the current ami as {@link int} - */ - public int getAmi() { - return ami; - } - - /** - * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE - * - * @param ami the ami to set as {@link int} - */ - public void setAmi(int ami) { - this.ami = ami; - } - - /** - * Index to the Link Key table in NV - * - * @return the current keyNvId as {@link int} - */ - public int getKeyNvId() { - return keyNvId; - } - - /** - * Index to the Link Key table in NV - * - * @param keyNvId the keyNvId to set as {@link int} - */ - public void setKeyNvId(int keyNvId) { - this.keyNvId = keyNvId; - } - - /** - * - * - * @return the current authenticateOption as {@link ZstackAuthenticationOption} - */ - public ZstackAuthenticationOption getAuthenticateOption() { - return authenticateOption; - } - - /** - * - * - * @param authenticateOption the authenticateOption to set as {@link ZstackAuthenticationOption} - */ - public void setAuthenticateOption(ZstackAuthenticationOption authenticateOption) { - this.authenticateOption = authenticateOption; - } - - /** - * Serialize the data from this structure class to an integer array - * - * @param serializer the {@link ZstackSerializer} to use - */ - public int[] serialize(ZstackSerializer serializer) { - // Serialize the fields - serializer.serializeUInt16(ami); - serializer.serializeUInt16(keyNvId); - serializer.serializeUInt8(authenticateOption.getKey()); - return serializer.getBuffer(); - } - - /** - * Deserialize the data into this structure class - * - * @param deserializer the {@link ZstackDeserializer} to use - */ - public void deserialize (ZstackDeserializer deserializer) { - // Deserialize the fields - ami = deserializer.deserializeUInt16(); - keyNvId = deserializer.deserializeUInt16(); - authenticateOption = ZstackAuthenticationOption.valueOf(deserializer.deserializeUInt8()); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(95); - builder.append("ZstackSecMgrEntry [ami="); - builder.append(ami); - builder.append(", keyNvId="); - builder.append(keyNvId); - builder.append(", authenticateOption="); - builder.append(authenticateOption); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.appcnf.ZstackAuthenticationOption; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackDeserializer; +import com.zsmartsystems.zigbee.dongle.zstack.internal.serializer.ZstackSerializer; + +/** + * Class to implement the Z-Stack structure ZstackSecMgrEntry. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public class ZstackSecMgrEntry { + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + */ + private int ami; + + /** + * Index to the Link Key table in NV + */ + private int keyNvId; + + /** + */ + private ZstackAuthenticationOption authenticateOption; + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + * + * @return the current ami as {@link int} + */ + public int getAmi() { + return ami; + } + + /** + * Address manager index that holds the IEEE address of destination device. INVALID_NODE_ADDR = 0xFFFE + * + * @param ami the ami to set as {@link int} + */ + public void setAmi(int ami) { + this.ami = ami; + } + + /** + * Index to the Link Key table in NV + * + * @return the current keyNvId as {@link int} + */ + public int getKeyNvId() { + return keyNvId; + } + + /** + * Index to the Link Key table in NV + * + * @param keyNvId the keyNvId to set as {@link int} + */ + public void setKeyNvId(int keyNvId) { + this.keyNvId = keyNvId; + } + + /** + * + * + * @return the current authenticateOption as {@link ZstackAuthenticationOption} + */ + public ZstackAuthenticationOption getAuthenticateOption() { + return authenticateOption; + } + + /** + * + * + * @param authenticateOption the authenticateOption to set as {@link ZstackAuthenticationOption} + */ + public void setAuthenticateOption(ZstackAuthenticationOption authenticateOption) { + this.authenticateOption = authenticateOption; + } + + /** + * Serialize the data from this structure class to an integer array + * + * @param serializer the {@link ZstackSerializer} to use + */ + public int[] serialize(ZstackSerializer serializer) { + // Serialize the fields + serializer.serializeUInt16(ami); + serializer.serializeUInt16(keyNvId); + serializer.serializeUInt8(authenticateOption.getKey()); + return serializer.getBuffer(); + } + + /** + * Deserialize the data into this structure class + * + * @param deserializer the {@link ZstackDeserializer} to use + */ + public void deserialize (ZstackDeserializer deserializer) { + // Deserialize the fields + ami = deserializer.deserializeUInt16(); + keyNvId = deserializer.deserializeUInt16(); + authenticateOption = ZstackAuthenticationOption.valueOf(deserializer.deserializeUInt8()); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(95); + builder.append("ZstackSecMgrEntry [ami="); + builder.append(ami); + builder.append(", keyNvId="); + builder.append(keyNvId); + builder.append(", authenticateOption="); + builder.append(authenticateOption); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java index fcffd4b90f..4f5a525cf9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. - *

    - * This command is used to set the extended address of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysGetExtAddrSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSysGetExtAddrSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x04)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x04); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSysGetExtAddrSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. + *

    + * This command is used to set the extended address of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysGetExtAddrSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysGetExtAddrSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x04); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysGetExtAddrSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java index 2faec3ff5d..a442488952 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysGetExtAddrSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. - *

    - * This command is used to set the extended address of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysGetExtAddrSrsp extends ZstackFrameResponse { - - /** - * The device’s extended address. - */ - private IeeeAddress extAddress; - - /** - * Response and Handler constructor - */ - public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - extAddress = deserializer.deserializeIeeeAddress(); - } - - /** - * The device’s extended address. - * - * @return the current extAddress as {@link IeeeAddress} - */ - public IeeeAddress getExtAddress() { - return extAddress; - } - - /** - * The device’s extended address. - * - * @param extAddress the ExtAddress to set as {@link IeeeAddress} - */ - public void setExtAddress(IeeeAddress extAddress) { - this.extAddress = extAddress; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysGetExtAddrSrsp [extAddress="); - builder.append(extAddress); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_GET_EXT_ADDR. + *

    + * This command is used to set the extended address of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysGetExtAddrSrsp extends ZstackFrameResponse { + + /** + * The device’s extended address. + */ + private IeeeAddress extAddress; + + /** + * Response and Handler constructor + */ + public ZstackSysGetExtAddrSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + extAddress = deserializer.deserializeIeeeAddress(); + } + + /** + * The device’s extended address. + * + * @return the current extAddress as {@link IeeeAddress} + */ + public IeeeAddress getExtAddress() { + return extAddress; + } + + /** + * The device’s extended address. + * + * @param extAddress the ExtAddress to set as {@link IeeeAddress} + */ + public void setExtAddress(IeeeAddress extAddress) { + this.extAddress = extAddress; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysGetExtAddrSrsp [extAddress="); + builder.append(extAddress); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java index 1d2f49602d..765500bf4b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSreq.java @@ -1,181 +1,182 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_NV_READ. - *

    - * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysNvReadSreq extends ZstackFrameRequest { - - /** - * The system id (1 for zstack) - */ - private int sysId; - - /** - * The sub id (0 for legacy) - */ - private int itemId; - - /** - * The Id of the NV item. - */ - private int subId; - - /** - * Number of bytes offset from the beginning or the NV value. - */ - private int offset; - - /** - * Number of bytes to read - */ - private int length; - - /** - * Request constructor - */ - public ZstackSysNvReadSreq() { - synchronousCommand = true; - } - - /** - * The system id (1 for zstack) - * - * @return the current sysId as {@link int} - */ - public int getSysId() { - return sysId; - } - - /** - * The system id (1 for zstack) - * - * @param sysId the sysId to set as {@link int} - */ - public void setSysId(int sysId) { - this.sysId = sysId; - } - - /** - * The sub id (0 for legacy) - * - * @return the current itemId as {@link int} - */ - public int getItemId() { - return itemId; - } - - /** - * The sub id (0 for legacy) - * - * @param itemId the itemId to set as {@link int} - */ - public void setItemId(int itemId) { - this.itemId = itemId; - } - - /** - * The Id of the NV item. - * - * @return the current subId as {@link int} - */ - public int getSubId() { - return subId; - } - - /** - * The Id of the NV item. - * - * @param subId the subId to set as {@link int} - */ - public void setSubId(int subId) { - this.subId = subId; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @return the current offset as {@link int} - */ - public int getOffset() { - return offset; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @param offset the offset to set as {@link int} - */ - public void setOffset(int offset) { - this.offset = offset; - } - - /** - * Number of bytes to read - * - * @return the current length as {@link int} - */ - public int getLength() { - return length; - } - - /** - * Number of bytes to read - * - * @param length the length to set as {@link int} - */ - public void setLength(int length) { - this.length = length; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x33)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x33); - - // Serialize the fields - serializer.serializeUInt8(sysId); - serializer.serializeUInt16(itemId); - serializer.serializeUInt16(subId); - serializer.serializeUInt16(offset); - serializer.serializeUInt8(length); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(147); - builder.append("ZstackSysNvReadSreq [sysId="); - builder.append(sysId); - builder.append(", itemId="); - builder.append(itemId); - builder.append(", subId="); - builder.append(subId); - builder.append(", offset="); - builder.append(offset); - builder.append(", length="); - builder.append(length); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysNvReadSreq extends ZstackFrameRequest { + + /** + * The system id (1 for zstack) + */ + private int sysId; + + /** + * The sub id (0 for legacy) + */ + private int itemId; + + /** + * The Id of the NV item. + */ + private int subId; + + /** + * Number of bytes offset from the beginning or the NV value. + */ + private int offset; + + /** + * Number of bytes to read + */ + private int length; + + /** + * Request constructor + */ + public ZstackSysNvReadSreq() { + synchronousCommand = true; + } + + /** + * The system id (1 for zstack) + * + * @return the current sysId as {@link int} + */ + public int getSysId() { + return sysId; + } + + /** + * The system id (1 for zstack) + * + * @param sysId the sysId to set as {@link int} + */ + public void setSysId(int sysId) { + this.sysId = sysId; + } + + /** + * The sub id (0 for legacy) + * + * @return the current itemId as {@link int} + */ + public int getItemId() { + return itemId; + } + + /** + * The sub id (0 for legacy) + * + * @param itemId the itemId to set as {@link int} + */ + public void setItemId(int itemId) { + this.itemId = itemId; + } + + /** + * The Id of the NV item. + * + * @return the current subId as {@link int} + */ + public int getSubId() { + return subId; + } + + /** + * The Id of the NV item. + * + * @param subId the subId to set as {@link int} + */ + public void setSubId(int subId) { + this.subId = subId; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + /** + * Number of bytes to read + * + * @return the current length as {@link int} + */ + public int getLength() { + return length; + } + + /** + * Number of bytes to read + * + * @param length the length to set as {@link int} + */ + public void setLength(int length) { + this.length = length; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x33)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x33); + + // Serialize the fields + serializer.serializeUInt8(sysId); + serializer.serializeUInt16(itemId); + serializer.serializeUInt16(subId); + serializer.serializeUInt16(offset); + serializer.serializeUInt8(length); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(147); + builder.append("ZstackSysNvReadSreq [sysId="); + builder.append(sysId); + builder.append(", itemId="); + builder.append(itemId); + builder.append(", subId="); + builder.append(subId); + builder.append(", offset="); + builder.append(offset); + builder.append(", length="); + builder.append(length); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java index eb146c302b..264d2a5511 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysNvReadSrsp.java @@ -1,100 +1,101 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_NV_READ. - *

    - * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysNvReadSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * value of the NV item. - */ - private int[] value; - - /** - * Response and Handler constructor - */ - public ZstackSysNvReadSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - int length = deserializer.deserializeUInt8(); - value = deserializer.deserializeUInt8Array(length); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * value of the NV item. - * - * @return the current value as {@link int[]} - */ - public int[] getValue() { - return value; - } - - /** - * value of the NV item. - * - * @param value the value to set as {@link int[]} - */ - public void setValue(int[] value) { - this.value = value; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(97); - builder.append("ZstackSysNvReadSrsp [status="); - builder.append(status); - builder.append(", value="); - for (int c = 0; c < value.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", value[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command returns the item requested + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysNvReadSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * value of the NV item. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackSysNvReadSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + int length = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(length); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * value of the NV item. + * + * @param value the value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(97); + builder.append("ZstackSysNvReadSrsp [status="); + builder.append(status); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java index a59842becd..34175f9b6f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSreq.java @@ -1,104 +1,105 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_OSAL_NV_READ. - *

    - * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value - * and data offset and returns the memory value present in the target for the specified attribute Id. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysOsalNvReadSreq extends ZstackFrameRequest { - - /** - * The Id of the NV item. - */ - private ZstackConfigId id; - - /** - * Number of bytes offset from the beginning or the NV value. - */ - private int offset; - - /** - * Request constructor - */ - public ZstackSysOsalNvReadSreq() { - synchronousCommand = true; - } - - /** - * The Id of the NV item. - * - * @return the current id as {@link ZstackConfigId} - */ - public ZstackConfigId getId() { - return id; - } - - /** - * The Id of the NV item. - * - * @param id the id to set as {@link ZstackConfigId} - */ - public void setId(ZstackConfigId id) { - this.id = id; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @return the current offset as {@link int} - */ - public int getOffset() { - return offset; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @param offset the Offset to set as {@link int} - */ - public void setOffset(int offset) { - this.offset = offset; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x08)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x08); - - // Serialize the fields - serializer.serializeUInt16(id.getKey()); - serializer.serializeUInt8(offset); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(76); - builder.append("ZstackSysOsalNvReadSreq [id="); - builder.append(id); - builder.append(", offset="); - builder.append(offset); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysOsalNvReadSreq extends ZstackFrameRequest { + + /** + * The Id of the NV item. + */ + private ZstackConfigId id; + + /** + * Number of bytes offset from the beginning or the NV value. + */ + private int offset; + + /** + * Request constructor + */ + public ZstackSysOsalNvReadSreq() { + synchronousCommand = true; + } + + /** + * The Id of the NV item. + * + * @return the current id as {@link ZstackConfigId} + */ + public ZstackConfigId getId() { + return id; + } + + /** + * The Id of the NV item. + * + * @param id the id to set as {@link ZstackConfigId} + */ + public void setId(ZstackConfigId id) { + this.id = id; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the Offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x08)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x08); + + // Serialize the fields + serializer.serializeUInt16(id.getKey()); + serializer.serializeUInt8(offset); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(76); + builder.append("ZstackSysOsalNvReadSreq [id="); + builder.append(id); + builder.append(", offset="); + builder.append(offset); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java index 43af8d1a33..8b65727b5b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvReadSrsp.java @@ -1,101 +1,102 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_OSAL_NV_READ. - *

    - * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value - * and data offset and returns the memory value present in the target for the specified attribute Id. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysOsalNvReadSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Value of the NV item. - */ - private int[] value; - - /** - * Response and Handler constructor - */ - public ZstackSysOsalNvReadSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - int len = deserializer.deserializeUInt8(); - value = deserializer.deserializeUInt8Array(len); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * Value of the NV item. - * - * @return the current value as {@link int[]} - */ - public int[] getValue() { - return value; - } - - /** - * Value of the NV item. - * - * @param value the Value to set as {@link int[]} - */ - public void setValue(int[] value) { - this.value = value; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(101); - builder.append("ZstackSysOsalNvReadSrsp [status="); - builder.append(status); - builder.append(", value="); - for (int c = 0; c < value.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", value[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_READ. + *

    + * This command is used to read a single memory item from the target non-volatile memory. The command accepts an attribute Id value + * and data offset and returns the memory value present in the target for the specified attribute Id. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysOsalNvReadSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Value of the NV item. + */ + private int[] value; + + /** + * Response and Handler constructor + */ + public ZstackSysOsalNvReadSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + int len = deserializer.deserializeUInt8(); + value = deserializer.deserializeUInt8Array(len); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Value of the NV item. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackSysOsalNvReadSrsp [status="); + builder.append(status); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java index 619c16a2e1..ff91e7f81a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSreq.java @@ -1,136 +1,137 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. - *

    - * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data - * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysOsalNvWriteSreq extends ZstackFrameRequest { - - /** - * The Id of the NV item. - */ - private ZstackConfigId id; - - /** - * Number of bytes offset from the beginning or the NV value. - */ - private int offset; - - /** - * Value of the NV item. - */ - private int[] value; - - /** - * Request constructor - */ - public ZstackSysOsalNvWriteSreq() { - synchronousCommand = true; - } - - /** - * The Id of the NV item. - * - * @return the current id as {@link ZstackConfigId} - */ - public ZstackConfigId getId() { - return id; - } - - /** - * The Id of the NV item. - * - * @param id the Id to set as {@link ZstackConfigId} - */ - public void setId(ZstackConfigId id) { - this.id = id; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @return the current offset as {@link int} - */ - public int getOffset() { - return offset; - } - - /** - * Number of bytes offset from the beginning or the NV value. - * - * @param offset the Offset to set as {@link int} - */ - public void setOffset(int offset) { - this.offset = offset; - } - - /** - * Value of the NV item. - * - * @return the current value as {@link int[]} - */ - public int[] getValue() { - return value; - } - - /** - * Value of the NV item. - * - * @param value the Value to set as {@link int[]} - */ - public void setValue(int[] value) { - this.value = value; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x09)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x09); - - // Serialize the fields - serializer.serializeUInt16(id.getKey()); - serializer.serializeUInt8(offset); - serializer.serializeUInt8(value.length); - serializer.serializeUInt8Array(value); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(127); - builder.append("ZstackSysOsalNvWriteSreq [id="); - builder.append(id); - builder.append(", offset="); - builder.append(offset); - builder.append(", value="); - for (int c = 0; c < value.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", value[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. + *

    + * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data + * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysOsalNvWriteSreq extends ZstackFrameRequest { + + /** + * The Id of the NV item. + */ + private ZstackConfigId id; + + /** + * Number of bytes offset from the beginning or the NV value. + */ + private int offset; + + /** + * Value of the NV item. + */ + private int[] value; + + /** + * Request constructor + */ + public ZstackSysOsalNvWriteSreq() { + synchronousCommand = true; + } + + /** + * The Id of the NV item. + * + * @return the current id as {@link ZstackConfigId} + */ + public ZstackConfigId getId() { + return id; + } + + /** + * The Id of the NV item. + * + * @param id the Id to set as {@link ZstackConfigId} + */ + public void setId(ZstackConfigId id) { + this.id = id; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @return the current offset as {@link int} + */ + public int getOffset() { + return offset; + } + + /** + * Number of bytes offset from the beginning or the NV value. + * + * @param offset the Offset to set as {@link int} + */ + public void setOffset(int offset) { + this.offset = offset; + } + + /** + * Value of the NV item. + * + * @return the current value as {@link int[]} + */ + public int[] getValue() { + return value; + } + + /** + * Value of the NV item. + * + * @param value the Value to set as {@link int[]} + */ + public void setValue(int[] value) { + this.value = value; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x09); + + // Serialize the fields + serializer.serializeUInt16(id.getKey()); + serializer.serializeUInt8(offset); + serializer.serializeUInt8(value.length); + serializer.serializeUInt8Array(value); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(127); + builder.append("ZstackSysOsalNvWriteSreq [id="); + builder.append(id); + builder.append(", offset="); + builder.append(offset); + builder.append(", value="); + for (int c = 0; c < value.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", value[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java index 0efcf52a64..4f1fc56a20 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysOsalNvWriteSrsp.java @@ -1,69 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. - *

    - * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data - * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysOsalNvWriteSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSysOsalNvWriteSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(52); - builder.append("ZstackSysOsalNvWriteSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_OSAL_NV_WRITE. + *

    + * This command is used to write to a particular item in non-volatile memory. The command accepts an attribute Id, data offset, data + * length, and attribute value. The attribute value is written to the location specified for the attribute Id in the target. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysOsalNvWriteSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysOsalNvWriteSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(52); + builder.append("ZstackSysOsalNvWriteSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java index 17983409af..36052be44a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_PING. - *

    - * This command issues PING requests to verify if a device is active and check the capability of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysPingSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSysPingSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x01)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x01); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSysPingSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_PING. + *

    + * This command issues PING requests to verify if a device is active and check the capability of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysPingSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysPingSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x01); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysPingSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java index d63f0f99ac..1c2a48169b 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysPingSrsp.java @@ -1,67 +1,68 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_PING. - *

    - * This command issues PING requests to verify if a device is active and check the capability of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysPingSrsp extends ZstackFrameResponse { - - /** - * This field represents the interfaces that this device can handle (compiled into the device). - */ - private int capabilities; - - /** - * Response and Handler constructor - */ - public ZstackSysPingSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - capabilities = deserializer.deserializeUInt16(); - } - - /** - * This field represents the interfaces that this device can handle (compiled into the device). - * - * @return the current capabilities as {@link int} - */ - public int getCapabilities() { - return capabilities; - } - - /** - * This field represents the interfaces that this device can handle (compiled into the device). - * - * @param capabilities the Capabilities to set as {@link int} - */ - public void setCapabilities(int capabilities) { - this.capabilities = capabilities; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(45); - builder.append("ZstackSysPingSrsp [capabilities="); - builder.append(String.format("%04X", capabilities)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_PING. + *

    + * This command issues PING requests to verify if a device is active and check the capability of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysPingSrsp extends ZstackFrameResponse { + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + */ + private int capabilities; + + /** + * Response and Handler constructor + */ + public ZstackSysPingSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + capabilities = deserializer.deserializeUInt16(); + } + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + * + * @return the current capabilities as {@link int} + */ + public int getCapabilities() { + return capabilities; + } + + /** + * This field represents the interfaces that this device can handle (compiled into the device). + * + * @param capabilities the Capabilities to set as {@link int} + */ + public void setCapabilities(int capabilities) { + this.capabilities = capabilities; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(45); + builder.append("ZstackSysPingSrsp [capabilities="); + builder.append(String.format("%04X", capabilities)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java index 8b8e96c937..48042c97f0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetIndAreq.java @@ -1,195 +1,196 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_RESET_IND. - *

    - * This command is generated by the CC2530 device automatically immediately after a reset. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysResetIndAreq extends ZstackFrameResponse { - - /** - * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 - */ - private ZstackResetReason reason; - - /** - * Transport protocol revision - */ - private int transportRev; - - /** - * Product Id - */ - private int product; - - /** - * Software major release number - */ - private int majorRel; - - /** - * Software minor release number - */ - private int minorRel; - - /** - * Hardware revision number. - */ - private int hwRev; - - /** - * Response and Handler constructor - */ - public ZstackSysResetIndAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - reason = ZstackResetReason.valueOf(deserializer.deserializeUInt8()); - transportRev = deserializer.deserializeUInt8(); - product = deserializer.deserializeUInt8(); - majorRel = deserializer.deserializeUInt8(); - minorRel = deserializer.deserializeUInt8(); - hwRev = deserializer.deserializeUInt8(); - } - - /** - * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 - * - * @return the current reason as {@link ZstackResetReason} - */ - public ZstackResetReason getReason() { - return reason; - } - - /** - * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 - * - * @param reason the Reason to set as {@link ZstackResetReason} - */ - public void setReason(ZstackResetReason reason) { - this.reason = reason; - } - - /** - * Transport protocol revision - * - * @return the current transportRev as {@link int} - */ - public int getTransportRev() { - return transportRev; - } - - /** - * Transport protocol revision - * - * @param transportRev the TransportRev to set as {@link int} - */ - public void setTransportRev(int transportRev) { - this.transportRev = transportRev; - } - - /** - * Product Id - * - * @return the current product as {@link int} - */ - public int getProduct() { - return product; - } - - /** - * Product Id - * - * @param product the Product to set as {@link int} - */ - public void setProduct(int product) { - this.product = product; - } - - /** - * Software major release number - * - * @return the current majorRel as {@link int} - */ - public int getMajorRel() { - return majorRel; - } - - /** - * Software major release number - * - * @param majorRel the MajorRel to set as {@link int} - */ - public void setMajorRel(int majorRel) { - this.majorRel = majorRel; - } - - /** - * Software minor release number - * - * @return the current minorRel as {@link int} - */ - public int getMinorRel() { - return minorRel; - } - - /** - * Software minor release number - * - * @param minorRel the MinorRel to set as {@link int} - */ - public void setMinorRel(int minorRel) { - this.minorRel = minorRel; - } - - /** - * Hardware revision number. - * - * @return the current hwRev as {@link int} - */ - public int getHwRev() { - return hwRev; - } - - /** - * Hardware revision number. - * - * @param hwRev the HwRev to set as {@link int} - */ - public void setHwRev(int hwRev) { - this.hwRev = hwRev; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(174); - builder.append("ZstackSysResetIndAreq [reason="); - builder.append(reason); - builder.append(", transportRev="); - builder.append(transportRev); - builder.append(", product="); - builder.append(product); - builder.append(", majorRel="); - builder.append(majorRel); - builder.append(", minorRel="); - builder.append(minorRel); - builder.append(", hwRev="); - builder.append(hwRev); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_RESET_IND. + *

    + * This command is generated by the CC2530 device automatically immediately after a reset. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysResetIndAreq extends ZstackFrameResponse { + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + */ + private ZstackResetReason reason; + + /** + * Transport protocol revision + */ + private int transportRev; + + /** + * Product Id + */ + private int product; + + /** + * Software major release number + */ + private int majorRel; + + /** + * Software minor release number + */ + private int minorRel; + + /** + * Hardware revision number. + */ + private int hwRev; + + /** + * Response and Handler constructor + */ + public ZstackSysResetIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + reason = ZstackResetReason.valueOf(deserializer.deserializeUInt8()); + transportRev = deserializer.deserializeUInt8(); + product = deserializer.deserializeUInt8(); + majorRel = deserializer.deserializeUInt8(); + minorRel = deserializer.deserializeUInt8(); + hwRev = deserializer.deserializeUInt8(); + } + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + * + * @return the current reason as {@link ZstackResetReason} + */ + public ZstackResetReason getReason() { + return reason; + } + + /** + * One of the following values indicating the reason for the reset. Power=0x00, External=0x01, Watchdog=0x02 + * + * @param reason the Reason to set as {@link ZstackResetReason} + */ + public void setReason(ZstackResetReason reason) { + this.reason = reason; + } + + /** + * Transport protocol revision + * + * @return the current transportRev as {@link int} + */ + public int getTransportRev() { + return transportRev; + } + + /** + * Transport protocol revision + * + * @param transportRev the TransportRev to set as {@link int} + */ + public void setTransportRev(int transportRev) { + this.transportRev = transportRev; + } + + /** + * Product Id + * + * @return the current product as {@link int} + */ + public int getProduct() { + return product; + } + + /** + * Product Id + * + * @param product the Product to set as {@link int} + */ + public void setProduct(int product) { + this.product = product; + } + + /** + * Software major release number + * + * @return the current majorRel as {@link int} + */ + public int getMajorRel() { + return majorRel; + } + + /** + * Software major release number + * + * @param majorRel the MajorRel to set as {@link int} + */ + public void setMajorRel(int majorRel) { + this.majorRel = majorRel; + } + + /** + * Software minor release number + * + * @return the current minorRel as {@link int} + */ + public int getMinorRel() { + return minorRel; + } + + /** + * Software minor release number + * + * @param minorRel the MinorRel to set as {@link int} + */ + public void setMinorRel(int minorRel) { + this.minorRel = minorRel; + } + + /** + * Hardware revision number. + * + * @return the current hwRev as {@link int} + */ + public int getHwRev() { + return hwRev; + } + + /** + * Hardware revision number. + * + * @param hwRev the HwRev to set as {@link int} + */ + public void setHwRev(int hwRev) { + this.hwRev = hwRev; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(174); + builder.append("ZstackSysResetIndAreq [reason="); + builder.append(reason); + builder.append(", transportRev="); + builder.append(transportRev); + builder.append(", product="); + builder.append(product); + builder.append(", majorRel="); + builder.append(majorRel); + builder.append(", minorRel="); + builder.append(minorRel); + builder.append(", hwRev="); + builder.append(hwRev); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java index 5d9fb4ba1e..134ecc1df8 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysResetReqAcmd.java @@ -1,74 +1,75 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; - -/** - * Class to implement the Z-Stack command SYS_RESET_REQ. - *

    - * This command is issued by the application processor to reset the CC2530 device. The reset is achieved through an internal - * watchdog reset on the CC2530. Note that the hardware reset interface is recommended over using this interface. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysResetReqAcmd extends ZstackFrameRequest { - - /** - * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial - * bootloading, bootloader reset commands are ignored and no response is sent from the target. - */ - private ZstackResetType type; - - /** - * Request constructor - */ - public ZstackSysResetReqAcmd() { - } - - /** - * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial - * bootloading, bootloader reset commands are ignored and no response is sent from the target. - * - * @return the current type as {@link ZstackResetType} - */ - public ZstackResetType getType() { - return type; - } - - /** - * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial - * bootloading, bootloader reset commands are ignored and no response is sent from the target. - * - * @param type the Type to set as {@link ZstackResetType} - */ - public void setType(ZstackResetType type) { - this.type = type; - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_ACMD, ZSTACK_SYS, 0x00); - - // Serialize the fields - serializer.serializeUInt8(type.getKey()); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(49); - builder.append("ZstackSysResetReqAcmd [type="); - builder.append(type); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_RESET_REQ. + *

    + * This command is issued by the application processor to reset the CC2530 device. The reset is achieved through an internal + * watchdog reset on the CC2530. Note that the hardware reset interface is recommended over using this interface. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysResetReqAcmd extends ZstackFrameRequest { + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + */ + private ZstackResetType type; + + /** + * Request constructor + */ + public ZstackSysResetReqAcmd() { + } + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + * + * @return the current type as {@link ZstackResetType} + */ + public ZstackResetType getType() { + return type; + } + + /** + * This requests a target device reset (0) or serial bootloader reset (1). If the target device does not support serial + * bootloading, bootloader reset commands are ignored and no response is sent from the target. + * + * @param type the Type to set as {@link ZstackResetType} + */ + public void setType(ZstackResetType type) { + this.type = type; + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_ACMD, ZSTACK_SYS, 0x00); + + // Serialize the fields + serializer.serializeUInt8(type.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(49); + builder.append("ZstackSysResetReqAcmd [type="); + builder.append(type); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java index ff18f9a06a..c5ee41c813 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. - *

    - * This command is used to set the extended address of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysSetExtAddrSreq extends ZstackFrameRequest { - - /** - * The device’s extended address. - */ - private IeeeAddress extAddress; - - /** - * Request constructor - */ - public ZstackSysSetExtAddrSreq() { - synchronousCommand = true; - } - - /** - * The device’s extended address. - * - * @return the current extAddress as {@link IeeeAddress} - */ - public IeeeAddress getExtAddress() { - return extAddress; - } - - /** - * The device’s extended address. - * - * @param extAddress the ExtAddress to set as {@link IeeeAddress} - */ - public void setExtAddress(IeeeAddress extAddress) { - this.extAddress = extAddress; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x03)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x03); - - // Serialize the fields - serializer.serializeIeeeAddress(extAddress); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysSetExtAddrSreq [extAddress="); - builder.append(extAddress); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. + *

    + * This command is used to set the extended address of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysSetExtAddrSreq extends ZstackFrameRequest { + + /** + * The device’s extended address. + */ + private IeeeAddress extAddress; + + /** + * Request constructor + */ + public ZstackSysSetExtAddrSreq() { + synchronousCommand = true; + } + + /** + * The device’s extended address. + * + * @return the current extAddress as {@link IeeeAddress} + */ + public IeeeAddress getExtAddress() { + return extAddress; + } + + /** + * The device’s extended address. + * + * @param extAddress the ExtAddress to set as {@link IeeeAddress} + */ + public void setExtAddress(IeeeAddress extAddress) { + this.extAddress = extAddress; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x03)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x03); + + // Serialize the fields + serializer.serializeIeeeAddress(extAddress); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetExtAddrSreq [extAddress="); + builder.append(extAddress); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java index c997380732..ecc48af616 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetExtAddrSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. - *

    - * This command is used to set the extended address of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysSetExtAddrSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (1) or Failure (0) - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSysSetExtAddrSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (1) or Failure (0) - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (1) or Failure (0) - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysSetExtAddrSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_SET_EXT_ADDR. + *

    + * This command is used to set the extended address of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysSetExtAddrSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (1) or Failure (0) + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysSetExtAddrSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (1) or Failure (0) + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (1) or Failure (0) + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetExtAddrSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java index 0c9f880305..202deb6af0 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_SET_TX_POWER. - *

    - * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio – nearest characterized value for the specific radio. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysSetTxPowerSreq extends ZstackFrameRequest { - - /** - * Requested TX power setting, in dBm. - */ - private int txPower; - - /** - * Request constructor - */ - public ZstackSysSetTxPowerSreq() { - synchronousCommand = true; - } - - /** - * Requested TX power setting, in dBm. - * - * @return the current txPower as {@link int} - */ - public int getTxPower() { - return txPower; - } - - /** - * Requested TX power setting, in dBm. - * - * @param txPower the TxPower to set as {@link int} - */ - public void setTxPower(int txPower) { - this.txPower = txPower; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x14)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x14); - - // Serialize the fields - serializer.serializeUInt8(txPower); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysSetTxPowerSreq [txPower="); - builder.append(txPower); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_SET_TX_POWER. + *

    + * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting + * applied to the radio – nearest characterized value for the specific radio. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysSetTxPowerSreq extends ZstackFrameRequest { + + /** + * Requested TX power setting, in dBm. + */ + private int txPower; + + /** + * Request constructor + */ + public ZstackSysSetTxPowerSreq() { + synchronousCommand = true; + } + + /** + * Requested TX power setting, in dBm. + * + * @return the current txPower as {@link int} + */ + public int getTxPower() { + return txPower; + } + + /** + * Requested TX power setting, in dBm. + * + * @param txPower the TxPower to set as {@link int} + */ + public void setTxPower(int txPower) { + this.txPower = txPower; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x14)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x14); + + // Serialize the fields + serializer.serializeUInt8(txPower); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetTxPowerSreq [txPower="); + builder.append(txPower); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java index 2c5dee61b1..17be7820a4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysSetTxPowerSrsp.java @@ -1,69 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_SET_TX_POWER. - *

    - * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting - * applied to the radio – nearest characterized value for the specific radio. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysSetTxPowerSrsp extends ZstackFrameResponse { - - /** - * Staus is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSysSetTxPowerSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Staus is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Staus is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackSysSetTxPowerSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_SET_TX_POWER. + *

    + * This command is used by the tester to set the target system radio transmit power. The returned TX power is the actual setting + * applied to the radio – nearest characterized value for the specific radio. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysSetTxPowerSrsp extends ZstackFrameResponse { + + /** + * Staus is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysSetTxPowerSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Staus is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Staus is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackSysSetTxPowerSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java index f86dc977b6..aa66cd2d12 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_VERSION. - *

    - * This command issues PING requests to verify if a device is active and check the capability of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysVersionSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSysVersionSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x02)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x02); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSysVersionSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_VERSION. + *

    + * This command issues PING requests to verify if a device is active and check the capability of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysVersionSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysVersionSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x02); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysVersionSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java index 8370d199d9..f443257479 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysVersionSrsp.java @@ -1,171 +1,172 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_VERSION. - *

    - * This command issues PING requests to verify if a device is active and check the capability of the device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysVersionSrsp extends ZstackFrameResponse { - - /** - * Transport protocol revision - */ - private int transportRev; - - /** - * Product Id - */ - private int product; - - /** - * Software major release number - */ - private int majorRel; - - /** - * Software minor release number - */ - private int minorRel; - - /** - * Software maintenance release number - */ - private int maintRel; - - /** - * Response and Handler constructor - */ - public ZstackSysVersionSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - transportRev = deserializer.deserializeUInt8(); - product = deserializer.deserializeUInt8(); - majorRel = deserializer.deserializeUInt8(); - minorRel = deserializer.deserializeUInt8(); - maintRel = deserializer.deserializeUInt8(); - } - - /** - * Transport protocol revision - * - * @return the current transportRev as {@link int} - */ - public int getTransportRev() { - return transportRev; - } - - /** - * Transport protocol revision - * - * @param transportRev the TransportRev to set as {@link int} - */ - public void setTransportRev(int transportRev) { - this.transportRev = transportRev; - } - - /** - * Product Id - * - * @return the current product as {@link int} - */ - public int getProduct() { - return product; - } - - /** - * Product Id - * - * @param product the Product to set as {@link int} - */ - public void setProduct(int product) { - this.product = product; - } - - /** - * Software major release number - * - * @return the current majorRel as {@link int} - */ - public int getMajorRel() { - return majorRel; - } - - /** - * Software major release number - * - * @param majorRel the MajorRel to set as {@link int} - */ - public void setMajorRel(int majorRel) { - this.majorRel = majorRel; - } - - /** - * Software minor release number - * - * @return the current minorRel as {@link int} - */ - public int getMinorRel() { - return minorRel; - } - - /** - * Software minor release number - * - * @param minorRel the MinorRel to set as {@link int} - */ - public void setMinorRel(int minorRel) { - this.minorRel = minorRel; - } - - /** - * Software maintenance release number - * - * @return the current maintRel as {@link int} - */ - public int getMaintRel() { - return maintRel; - } - - /** - * Software maintenance release number - * - * @param maintRel the MaintRel to set as {@link int} - */ - public void setMaintRel(int maintRel) { - this.maintRel = maintRel; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(148); - builder.append("ZstackSysVersionSrsp [transportRev="); - builder.append(transportRev); - builder.append(", product="); - builder.append(product); - builder.append(", majorRel="); - builder.append(majorRel); - builder.append(", minorRel="); - builder.append(minorRel); - builder.append(", maintRel="); - builder.append(maintRel); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_VERSION. + *

    + * This command issues PING requests to verify if a device is active and check the capability of the device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysVersionSrsp extends ZstackFrameResponse { + + /** + * Transport protocol revision + */ + private int transportRev; + + /** + * Product Id + */ + private int product; + + /** + * Software major release number + */ + private int majorRel; + + /** + * Software minor release number + */ + private int minorRel; + + /** + * Software maintenance release number + */ + private int maintRel; + + /** + * Response and Handler constructor + */ + public ZstackSysVersionSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + transportRev = deserializer.deserializeUInt8(); + product = deserializer.deserializeUInt8(); + majorRel = deserializer.deserializeUInt8(); + minorRel = deserializer.deserializeUInt8(); + maintRel = deserializer.deserializeUInt8(); + } + + /** + * Transport protocol revision + * + * @return the current transportRev as {@link int} + */ + public int getTransportRev() { + return transportRev; + } + + /** + * Transport protocol revision + * + * @param transportRev the TransportRev to set as {@link int} + */ + public void setTransportRev(int transportRev) { + this.transportRev = transportRev; + } + + /** + * Product Id + * + * @return the current product as {@link int} + */ + public int getProduct() { + return product; + } + + /** + * Product Id + * + * @param product the Product to set as {@link int} + */ + public void setProduct(int product) { + this.product = product; + } + + /** + * Software major release number + * + * @return the current majorRel as {@link int} + */ + public int getMajorRel() { + return majorRel; + } + + /** + * Software major release number + * + * @param majorRel the MajorRel to set as {@link int} + */ + public void setMajorRel(int majorRel) { + this.majorRel = majorRel; + } + + /** + * Software minor release number + * + * @return the current minorRel as {@link int} + */ + public int getMinorRel() { + return minorRel; + } + + /** + * Software minor release number + * + * @param minorRel the MinorRel to set as {@link int} + */ + public void setMinorRel(int minorRel) { + this.minorRel = minorRel; + } + + /** + * Software maintenance release number + * + * @return the current maintRel as {@link int} + */ + public int getMaintRel() { + return maintRel; + } + + /** + * Software maintenance release number + * + * @param maintRel the MaintRel to set as {@link int} + */ + public void setMaintRel(int maintRel) { + this.maintRel = maintRel; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(148); + builder.append("ZstackSysVersionSrsp [transportRev="); + builder.append(transportRev); + builder.append(", product="); + builder.append(product); + builder.append(", majorRel="); + builder.append(majorRel); + builder.append(", minorRel="); + builder.append(minorRel); + builder.append(", maintRel="); + builder.append(maintRel); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java index 2cf9f4dc11..6ca2be8786 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. - *

    - * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set - * to TRUE. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsClearStatsSreq extends ZstackFrameRequest { - - /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. - */ - private boolean clearNv; - - /** - * Request constructor - */ - public ZstackSysZdiagsClearStatsSreq() { - synchronousCommand = true; - } - - /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. - * - * @return the current clearNv as {@link boolean} - */ - public boolean getClearNV() { - return clearNv; - } - - /** - * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. - * - * @param clearNv the clearNV to set as {@link boolean} - */ - public void setClearNV(boolean clearNv) { - this.clearNv = clearNv; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x18)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x18); - - // Serialize the fields - serializer.serializeBoolean(clearNv); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(57); - builder.append("ZstackSysZdiagsClearStatsSreq [clearNv="); - builder.append(clearNv); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. + *

    + * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set + * to TRUE. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsClearStatsSreq extends ZstackFrameRequest { + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + */ + private boolean clearNv; + + /** + * Request constructor + */ + public ZstackSysZdiagsClearStatsSreq() { + synchronousCommand = true; + } + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * + * @return the current clearNv as {@link boolean} + */ + public boolean getClearNV() { + return clearNv; + } + + /** + * TRUE – Clears statistics in NV memory including Boot Counter. FALSE – Clears statistics in RAM only. Boot Counter is preserved. + * + * @param clearNv the clearNV to set as {@link boolean} + */ + public void setClearNV(boolean clearNv) { + this.clearNv = clearNv; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x18)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x18); + + // Serialize the fields + serializer.serializeBoolean(clearNv); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackSysZdiagsClearStatsSreq [clearNv="); + builder.append(clearNv); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java index e9665f040a..1ef77fa0f4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsClearStatsSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. - *

    - * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set - * to TRUE. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsClearStatsSrsp extends ZstackFrameResponse { - - /** - * Milliseconds since last reset. - */ - private int sysClock; - - /** - * Response and Handler constructor - */ - public ZstackSysZdiagsClearStatsSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - sysClock = deserializer.deserializeUInt32(); - } - - /** - * Milliseconds since last reset. - * - * @return the current sysClock as {@link int} - */ - public int getSysClock() { - return sysClock; - } - - /** - * Milliseconds since last reset. - * - * @param sysClock the SysClock to set as {@link int} - */ - public void setSysClock(int sysClock) { - this.sysClock = sysClock; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(57); - builder.append("ZstackSysZdiagsClearStatsSrsp [sysClock="); - builder.append(sysClock); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_CLEAR_STATS. + *

    + * This command is used to clear the statistics table. To clear data in NV (including the Boot Counter) the clearNV flag shall be set + * to TRUE. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsClearStatsSrsp extends ZstackFrameResponse { + + /** + * Milliseconds since last reset. + */ + private int sysClock; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsClearStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + sysClock = deserializer.deserializeUInt32(); + } + + /** + * Milliseconds since last reset. + * + * @return the current sysClock as {@link int} + */ + public int getSysClock() { + return sysClock; + } + + /** + * Milliseconds since last reset. + * + * @param sysClock the SysClock to set as {@link int} + */ + public void setSysClock(int sysClock) { + this.sysClock = sysClock; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(57); + builder.append("ZstackSysZdiagsClearStatsSrsp [sysClock="); + builder.append(sysClock); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java index c3f0b8fb71..36eaa9609d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. - *

    - * This command is used to read a specific system (attribute) ID statistics and/or metrics value. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsGetStatsSreq extends ZstackFrameRequest { - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - */ - private ZstackDiagnosticAttribute attributeId; - - /** - * Request constructor - */ - public ZstackSysZdiagsGetStatsSreq() { - synchronousCommand = true; - } - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - * - * @return the current attributeId as {@link ZstackDiagnosticAttribute} - */ - public ZstackDiagnosticAttribute getAttributeID() { - return attributeId; - } - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - * - * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} - */ - public void setAttributeID(ZstackDiagnosticAttribute attributeId) { - this.attributeId = attributeId; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x19)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x19); - - // Serialize the fields - serializer.serializeUInt16(attributeId.getKey()); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(55); - builder.append("ZstackSysZdiagsGetStatsSreq [attributeId="); - builder.append(attributeId); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. + *

    + * This command is used to read a specific system (attribute) ID statistics and/or metrics value. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsGetStatsSreq extends ZstackFrameRequest { + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + */ + private ZstackDiagnosticAttribute attributeId; + + /** + * Request constructor + */ + public ZstackSysZdiagsGetStatsSreq() { + synchronousCommand = true; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @return the current attributeId as {@link ZstackDiagnosticAttribute} + */ + public ZstackDiagnosticAttribute getAttributeID() { + return attributeId; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} + */ + public void setAttributeID(ZstackDiagnosticAttribute attributeId) { + this.attributeId = attributeId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x19)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x19); + + // Serialize the fields + serializer.serializeUInt16(attributeId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackSysZdiagsGetStatsSreq [attributeId="); + builder.append(attributeId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java index 9d60d6690f..e676c801fb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsGetStatsSrsp.java @@ -1,67 +1,68 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. - *

    - * This command is used to read a specific system (attribute) ID statistics and/or metrics value. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsGetStatsSrsp extends ZstackFrameResponse { - - /** - * Value of the requested attribute. - */ - private int attributeValue; - - /** - * Response and Handler constructor - */ - public ZstackSysZdiagsGetStatsSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - attributeValue = deserializer.deserializeUInt32(); - } - - /** - * Value of the requested attribute. - * - * @return the current attributeValue as {@link int} - */ - public int getAttributeValue() { - return attributeValue; - } - - /** - * Value of the requested attribute. - * - * @param attributeValue the AttributeValue to set as {@link int} - */ - public void setAttributeValue(int attributeValue) { - this.attributeValue = attributeValue; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(55); - builder.append("ZstackSysZdiagsGetStatsSrsp [attributeValue="); - builder.append(attributeValue); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_GET_STATS. + *

    + * This command is used to read a specific system (attribute) ID statistics and/or metrics value. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsGetStatsSrsp extends ZstackFrameResponse { + + /** + * Value of the requested attribute. + */ + private int attributeValue; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsGetStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + attributeValue = deserializer.deserializeUInt32(); + } + + /** + * Value of the requested attribute. + * + * @return the current attributeValue as {@link int} + */ + public int getAttributeValue() { + return attributeValue; + } + + /** + * Value of the requested attribute. + * + * @param attributeValue the AttributeValue to set as {@link int} + */ + public void setAttributeValue(int attributeValue) { + this.attributeValue = attributeValue; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackSysZdiagsGetStatsSrsp [attributeValue="); + builder.append(attributeValue); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java index 7084cc740d..217e821b34 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. - *

    - * This command is used to initialize the statistics table in NV memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsInitStatsSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSysZdiagsInitStatsSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x17)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x17); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSysZdiagsInitStatsSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. + *

    + * This command is used to initialize the statistics table in NV memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsInitStatsSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysZdiagsInitStatsSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x17)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x17); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysZdiagsInitStatsSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java index 98ef68a7cf..86a2d05803 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsInitStatsSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. - *

    - * This command is used to initialize the statistics table in NV memory. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsInitStatsSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSysZdiagsInitStatsSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(56); - builder.append("ZstackSysZdiagsInitStatsSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_INIT_STATS. + *

    + * This command is used to initialize the statistics table in NV memory. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsInitStatsSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsInitStatsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(56); + builder.append("ZstackSysZdiagsInitStatsSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java index a8644f2641..ba276ecb9d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. - *

    - * This command is used to restore the statistics table from NV into the RAM table. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsRestoreStatsNvSreq extends ZstackFrameRequest { - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - */ - private ZstackDiagnosticAttribute attributeId; - - /** - * Request constructor - */ - public ZstackSysZdiagsRestoreStatsNvSreq() { - synchronousCommand = true; - } - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - * - * @return the current attributeId as {@link ZstackDiagnosticAttribute} - */ - public ZstackDiagnosticAttribute getAttributeID() { - return attributeId; - } - - /** - * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. - * - * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} - */ - public void setAttributeID(ZstackDiagnosticAttribute attributeId) { - this.attributeId = attributeId; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1A)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1A); - - // Serialize the fields - serializer.serializeUInt16(attributeId.getKey()); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(61); - builder.append("ZstackSysZdiagsRestoreStatsNvSreq [attributeId="); - builder.append(attributeId); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. + *

    + * This command is used to restore the statistics table from NV into the RAM table. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsRestoreStatsNvSreq extends ZstackFrameRequest { + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + */ + private ZstackDiagnosticAttribute attributeId; + + /** + * Request constructor + */ + public ZstackSysZdiagsRestoreStatsNvSreq() { + synchronousCommand = true; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @return the current attributeId as {@link ZstackDiagnosticAttribute} + */ + public ZstackDiagnosticAttribute getAttributeID() { + return attributeId; + } + + /** + * System Diagnostics (ZDiags) attribute ID, as defined in ZDiags.h module. + * + * @param attributeId the AttributeID to set as {@link ZstackDiagnosticAttribute} + */ + public void setAttributeID(ZstackDiagnosticAttribute attributeId) { + this.attributeId = attributeId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1A)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1A); + + // Serialize the fields + serializer.serializeUInt16(attributeId.getKey()); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackSysZdiagsRestoreStatsNvSreq [attributeId="); + builder.append(attributeId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java index f0fc7c0d15..a6591d213d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsRestoreStatsNvSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. - *

    - * This command is used to restore the statistics table from NV into the RAM table. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsRestoreStatsNvSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackSysZdiagsRestoreStatsNvSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(61); - builder.append("ZstackSysZdiagsRestoreStatsNvSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_RESTORE_STATS_NV. + *

    + * This command is used to restore the statistics table from NV into the RAM table. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsRestoreStatsNvSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsRestoreStatsNvSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackSysZdiagsRestoreStatsNvSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java index 9ce977c8c2..56ab2a8038 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. - *

    - * This command is used to save the statistics table from RAM to NV. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsSaveStatsToNvSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackSysZdiagsSaveStatsToNvSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1B)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1B); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackSysZdiagsSaveStatsToNvSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. + *

    + * This command is used to save the statistics table from RAM to NV. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsSaveStatsToNvSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackSysZdiagsSaveStatsToNvSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_SYS) && (response.getReqCmd1() == 0x1B)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_SYS, 0x1B); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackSysZdiagsSaveStatsToNvSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java index 5b0658cde9..bff97ff3ff 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSysZdiagsSaveStatsToNvSrsp.java @@ -1,67 +1,68 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. - *

    - * This command is used to save the statistics table from RAM to NV. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackSysZdiagsSaveStatsToNvSrsp extends ZstackFrameResponse { - - /** - * Milliseconds since last reset. - */ - private int sysClock; - - /** - * Response and Handler constructor - */ - public ZstackSysZdiagsSaveStatsToNvSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - sysClock = deserializer.deserializeUInt32(); - } - - /** - * Milliseconds since last reset. - * - * @return the current sysClock as {@link int} - */ - public int getSysClock() { - return sysClock; - } - - /** - * Milliseconds since last reset. - * - * @param sysClock the SysClock to set as {@link int} - */ - public void setSysClock(int sysClock) { - this.sysClock = sysClock; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(60); - builder.append("ZstackSysZdiagsSaveStatsToNvSrsp [sysClock="); - builder.append(sysClock); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command SYS_ZDIAGS_SAVE_STATS_TO_NV. + *

    + * This command is used to save the statistics table from RAM to NV. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackSysZdiagsSaveStatsToNvSrsp extends ZstackFrameResponse { + + /** + * Milliseconds since last reset. + */ + private int sysClock; + + /** + * Response and Handler constructor + */ + public ZstackSysZdiagsSaveStatsToNvSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + sysClock = deserializer.deserializeUInt32(); + } + + /** + * Milliseconds since last reset. + * + * @return the current sysClock as {@link int} + */ + public int getSysClock() { + return sysClock; + } + + /** + * Milliseconds since last reset. + * + * @param sysClock the SysClock to set as {@link int} + */ + public void setSysClock(int sysClock) { + this.sysClock = sysClock; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(60); + builder.append("ZstackSysZdiagsSaveStatsToNvSrsp [sysClock="); + builder.append(sysClock); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java index 557f2dade5..a7f24914be 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackSystemCapabilities.java @@ -1,119 +1,119 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackSystemCapabilities. - *

    - * Subsystem capabilities bitmap - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackSystemCapabilities { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * - */ - MT_CAP_SYS(0x0001), - - /** - * - */ - MT_CAP_MAC(0x0002), - - /** - * - */ - MT_CAP_NWK(0x0004), - - /** - * - */ - MT_CAP_AF(0x0008), - - /** - * - */ - MT_CAP_ZDO(0x0010), - - /** - * - */ - MT_CAP_SAPI(0x0020), - - /** - * - */ - MT_CAP_UTIL(0x0040), - - /** - * - */ - MT_CAP_DEBUG(0x0080), - - /** - * - */ - MT_CAP_APP(0x0100), - - /** - * - */ - MT_CAP_ZOAD(0x1000); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackSystemCapabilities s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackSystemCapabilities(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackSystemCapabilities valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackSystemCapabilities. + *

    + * Subsystem capabilities bitmap + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackSystemCapabilities { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * + */ + MT_CAP_SYS(0x0001), + + /** + * + */ + MT_CAP_MAC(0x0002), + + /** + * + */ + MT_CAP_NWK(0x0004), + + /** + * + */ + MT_CAP_AF(0x0008), + + /** + * + */ + MT_CAP_ZDO(0x0010), + + /** + * + */ + MT_CAP_SAPI(0x0020), + + /** + * + */ + MT_CAP_UTIL(0x0040), + + /** + * + */ + MT_CAP_DEBUG(0x0080), + + /** + * + */ + MT_CAP_APP(0x0100), + + /** + * + */ + MT_CAP_ZOAD(0x1000); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackSystemCapabilities s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackSystemCapabilities(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackSystemCapabilities valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java index 36de6a5f39..0e65efa5b7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/sys/ZstackZdoState.java @@ -1,122 +1,122 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.sys; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class to implement the Z-Stack Enumeration ZstackZdoState. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public enum ZstackZdoState { - /** - * Default unknown value - */ - UNKNOWN(-1), - - /** - * Initialized - not started automatically - */ - DEV_HOLD(0x0000), - - /** - * Initialized - not connected to anything - */ - DEV_INIT(0x0001), - - /** - * Discovering PAN's to join - */ - DEV_NWK_DISC(0x0002), - - /** - * Joining a PAN - */ - DEV_NWK_JOINING(0x0003), - - /** - * ReJoining a PAN, only for end devices - */ - DEV_NWK_REJOIN(0x0004), - - /** - * Joined but not yet authenticated by trust center - */ - DEV_END_DEVICE_UNAUTH(0x0005), - - /** - * Started as device after authentication - */ - DEV_END_DEVICE(0x0006), - - /** - * Device joined, authenticated and is a router - */ - DEV_ROUTER(0x0007), - - /** - * Starting as Zigbee Coordinator - */ - DEV_COORD_STARTING(0x0008), - - /** - * Started as Zigbee Coordinator - */ - DEV_ZB_COORD(0x0009), - - /** - * Device has lost information about its parent - */ - DEV_NWK_ORPHAN(0x000A); - - /** - * A mapping between the integer code and its corresponding type to - * facilitate lookup by code. - */ - private static Map codeMapping; - - private int key; - - static { - codeMapping = new HashMap(); - for (ZstackZdoState s : values()) { - codeMapping.put(s.key, s); - } - } - - private ZstackZdoState(int key) { - this.key = key; - } - - /** - * Lookup function based on the type code. Returns null if the code does not exist. - * - * @param code the code to lookup - * @return enumeration value of the alarm type. - */ - public static ZstackZdoState valueOf(int code) { - if (codeMapping.get(code) == null) { - return UNKNOWN; - } - - return codeMapping.get(code); - } - - /** - * Returns the Z-Stack protocol defined value for this enumeration. - * - * @return the Z-Stack protocol key - */ - public int getKey() { - return key; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.sys; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to implement the Z-Stack Enumeration ZstackZdoState. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + * + * @author Chris Jackson + */ +public enum ZstackZdoState { + /** + * Default unknown value + */ + UNKNOWN(-1), + + /** + * Initialized - not started automatically + */ + DEV_HOLD(0x0000), + + /** + * Initialized - not connected to anything + */ + DEV_INIT(0x0001), + + /** + * Discovering PAN's to join + */ + DEV_NWK_DISC(0x0002), + + /** + * Joining a PAN + */ + DEV_NWK_JOINING(0x0003), + + /** + * ReJoining a PAN, only for end devices + */ + DEV_NWK_REJOIN(0x0004), + + /** + * Joined but not yet authenticated by trust center + */ + DEV_END_DEVICE_UNAUTH(0x0005), + + /** + * Started as device after authentication + */ + DEV_END_DEVICE(0x0006), + + /** + * Device joined, authenticated and is a router + */ + DEV_ROUTER(0x0007), + + /** + * Starting as Zigbee Coordinator + */ + DEV_COORD_STARTING(0x0008), + + /** + * Started as Zigbee Coordinator + */ + DEV_ZB_COORD(0x0009), + + /** + * Device has lost information about its parent + */ + DEV_NWK_ORPHAN(0x000A); + + /** + * A mapping between the integer code and its corresponding type to + * facilitate lookup by code. + */ + private static Map codeMapping; + + private int key; + + static { + codeMapping = new HashMap(); + for (ZstackZdoState s : values()) { + codeMapping.put(s.key, s); + } + } + + private ZstackZdoState(int key) { + this.key = key; + } + + /** + * Lookup function based on the type code. Returns null if the code does not exist. + * + * @param code the code to lookup + * @return enumeration value of the alarm type. + */ + public static ZstackZdoState valueOf(int code) { + if (codeMapping.get(code) == null) { + return UNKNOWN; + } + + return codeMapping.get(code); + } + + /** + * Returns the Z-Stack protocol defined value for this enumeration. + * + * @return the Z-Stack protocol key + */ + public int getKey() { + return key; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java index 0ea069c317..ab379f0094 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. - *

    - * This command retrieves APS link key data, Tx and Rx frame counters. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilApsmeLinkKeyDataGetSreq extends ZstackFrameRequest { - - /** - * The extended address for which to get the link key data. - */ - private IeeeAddress extAddr; - - /** - * Request constructor - */ - public ZstackUtilApsmeLinkKeyDataGetSreq() { - synchronousCommand = true; - } - - /** - * The extended address for which to get the link key data. - * - * @return the current extAddr as {@link IeeeAddress} - */ - public IeeeAddress getExtAddr() { - return extAddr; - } - - /** - * The extended address for which to get the link key data. - * - * @param extAddr the ExtAddr to set as {@link IeeeAddress} - */ - public void setExtAddr(IeeeAddress extAddr) { - this.extAddr = extAddr; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x44)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x44); - - // Serialize the fields - serializer.serializeIeeeAddress(extAddr); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(61); - builder.append("ZstackUtilApsmeLinkKeyDataGetSreq [extAddr="); - builder.append(extAddr); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. + *

    + * This command retrieves APS link key data, Tx and Rx frame counters. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilApsmeLinkKeyDataGetSreq extends ZstackFrameRequest { + + /** + * The extended address for which to get the link key data. + */ + private IeeeAddress extAddr; + + /** + * Request constructor + */ + public ZstackUtilApsmeLinkKeyDataGetSreq() { + synchronousCommand = true; + } + + /** + * The extended address for which to get the link key data. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * The extended address for which to get the link key data. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x44)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x44); + + // Serialize the fields + serializer.serializeIeeeAddress(extAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackUtilApsmeLinkKeyDataGetSreq [extAddr="); + builder.append(extAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java index 2bdef2a99b..f8a7bcef95 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyDataGetSrsp.java @@ -1,147 +1,148 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. - *

    - * This command retrieves APS link key data, Tx and Rx frame counters. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilApsmeLinkKeyDataGetSrsp extends ZstackFrameResponse { - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - */ - private ZstackResponseCode status; - - /** - * On success, the security key looked up; otherwise N/A. - */ - private ZigBeeKey secKey; - - /** - * On success, the TX frame counter; otherwise N/A. - */ - private int txFrmCntr; - - /** - * On success, the RX frame counter; otherwise N/A. - */ - private int rxFrmCntr; - - /** - * Response and Handler constructor - */ - public ZstackUtilApsmeLinkKeyDataGetSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - secKey = deserializer.deserializeZigBeeKey(); - txFrmCntr = deserializer.deserializeUInt32(); - rxFrmCntr = deserializer.deserializeUInt32(); - } - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * On success, the security key looked up; otherwise N/A. - * - * @return the current secKey as {@link ZigBeeKey} - */ - public ZigBeeKey getSecKey() { - return secKey; - } - - /** - * On success, the security key looked up; otherwise N/A. - * - * @param secKey the SecKey to set as {@link ZigBeeKey} - */ - public void setSecKey(ZigBeeKey secKey) { - this.secKey = secKey; - } - - /** - * On success, the TX frame counter; otherwise N/A. - * - * @return the current txFrmCntr as {@link int} - */ - public int getTxFrmCntr() { - return txFrmCntr; - } - - /** - * On success, the TX frame counter; otherwise N/A. - * - * @param txFrmCntr the TxFrmCntr to set as {@link int} - */ - public void setTxFrmCntr(int txFrmCntr) { - this.txFrmCntr = txFrmCntr; - } - - /** - * On success, the RX frame counter; otherwise N/A. - * - * @return the current rxFrmCntr as {@link int} - */ - public int getRxFrmCntr() { - return rxFrmCntr; - } - - /** - * On success, the RX frame counter; otherwise N/A. - * - * @param rxFrmCntr the RxFrmCntr to set as {@link int} - */ - public void setRxFrmCntr(int rxFrmCntr) { - this.rxFrmCntr = rxFrmCntr; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(136); - builder.append("ZstackUtilApsmeLinkKeyDataGetSrsp [status="); - builder.append(status); - builder.append(", secKey="); - builder.append(secKey); - builder.append(", txFrmCntr="); - builder.append(String.format("%08X", txFrmCntr)); - builder.append(", rxFrmCntr="); - builder.append(String.format("%08X", rxFrmCntr)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_DATA_GET. + *

    + * This command retrieves APS link key data, Tx and Rx frame counters. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilApsmeLinkKeyDataGetSrsp extends ZstackFrameResponse { + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + */ + private ZstackResponseCode status; + + /** + * On success, the security key looked up; otherwise N/A. + */ + private ZigBeeKey secKey; + + /** + * On success, the TX frame counter; otherwise N/A. + */ + private int txFrmCntr; + + /** + * On success, the RX frame counter; otherwise N/A. + */ + private int rxFrmCntr; + + /** + * Response and Handler constructor + */ + public ZstackUtilApsmeLinkKeyDataGetSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + secKey = deserializer.deserializeZigBeeKey(); + txFrmCntr = deserializer.deserializeUInt32(); + rxFrmCntr = deserializer.deserializeUInt32(); + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * On success, the security key looked up; otherwise N/A. + * + * @return the current secKey as {@link ZigBeeKey} + */ + public ZigBeeKey getSecKey() { + return secKey; + } + + /** + * On success, the security key looked up; otherwise N/A. + * + * @param secKey the SecKey to set as {@link ZigBeeKey} + */ + public void setSecKey(ZigBeeKey secKey) { + this.secKey = secKey; + } + + /** + * On success, the TX frame counter; otherwise N/A. + * + * @return the current txFrmCntr as {@link int} + */ + public int getTxFrmCntr() { + return txFrmCntr; + } + + /** + * On success, the TX frame counter; otherwise N/A. + * + * @param txFrmCntr the TxFrmCntr to set as {@link int} + */ + public void setTxFrmCntr(int txFrmCntr) { + this.txFrmCntr = txFrmCntr; + } + + /** + * On success, the RX frame counter; otherwise N/A. + * + * @return the current rxFrmCntr as {@link int} + */ + public int getRxFrmCntr() { + return rxFrmCntr; + } + + /** + * On success, the RX frame counter; otherwise N/A. + * + * @param rxFrmCntr the RxFrmCntr to set as {@link int} + */ + public void setRxFrmCntr(int rxFrmCntr) { + this.rxFrmCntr = rxFrmCntr; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(136); + builder.append("ZstackUtilApsmeLinkKeyDataGetSrsp [status="); + builder.append(status); + builder.append(", secKey="); + builder.append(secKey); + builder.append(", txFrmCntr="); + builder.append(String.format("%08X", txFrmCntr)); + builder.append(", rxFrmCntr="); + builder.append(String.format("%08X", rxFrmCntr)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java index 8f1b1d023b..61751a1a01 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. - *

    - * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilApsmeLinkKeyNvIdGetSreq extends ZstackFrameRequest { - - /** - * The extended address for which to get the link key NV Id. - */ - private IeeeAddress extAddr; - - /** - * Request constructor - */ - public ZstackUtilApsmeLinkKeyNvIdGetSreq() { - synchronousCommand = true; - } - - /** - * The extended address for which to get the link key NV Id. - * - * @return the current extAddr as {@link IeeeAddress} - */ - public IeeeAddress getExtAddr() { - return extAddr; - } - - /** - * The extended address for which to get the link key NV Id. - * - * @param extAddr the ExtAddr to set as {@link IeeeAddress} - */ - public void setExtAddr(IeeeAddress extAddr) { - this.extAddr = extAddr; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x45)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x45); - - // Serialize the fields - serializer.serializeIeeeAddress(extAddr); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(61); - builder.append("ZstackUtilApsmeLinkKeyNvIdGetSreq [extAddr="); - builder.append(extAddr); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. + *

    + * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilApsmeLinkKeyNvIdGetSreq extends ZstackFrameRequest { + + /** + * The extended address for which to get the link key NV Id. + */ + private IeeeAddress extAddr; + + /** + * Request constructor + */ + public ZstackUtilApsmeLinkKeyNvIdGetSreq() { + synchronousCommand = true; + } + + /** + * The extended address for which to get the link key NV Id. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * The extended address for which to get the link key NV Id. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x45)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x45); + + // Serialize the fields + serializer.serializeIeeeAddress(extAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(61); + builder.append("ZstackUtilApsmeLinkKeyNvIdGetSreq [extAddr="); + builder.append(extAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java index 294aa355c1..d4d97a1fdc 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilApsmeLinkKeyNvIdGetSrsp.java @@ -1,94 +1,95 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. - *

    - * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilApsmeLinkKeyNvIdGetSrsp extends ZstackFrameResponse { - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - */ - private ZstackResponseCode status; - - /** - * On success, link key NV ID. Otherwise 0xFFFF - */ - private int linkKeyNvId; - - /** - * Response and Handler constructor - */ - public ZstackUtilApsmeLinkKeyNvIdGetSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - linkKeyNvId = deserializer.deserializeUInt16(); - } - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * On success, link key NV ID. Otherwise 0xFFFF - * - * @return the current linkKeyNvId as {@link int} - */ - public int getLinkKeyNvId() { - return linkKeyNvId; - } - - /** - * On success, link key NV ID. Otherwise 0xFFFF - * - * @param linkKeyNvId the LinkKeyNvId to set as {@link int} - */ - public void setLinkKeyNvId(int linkKeyNvId) { - this.linkKeyNvId = linkKeyNvId; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(86); - builder.append("ZstackUtilApsmeLinkKeyNvIdGetSrsp [status="); - builder.append(status); - builder.append(", linkKeyNvId="); - builder.append(linkKeyNvId); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_APSME_LINK_KEY_NV_ID_GET. + *

    + * This command is a proxy call to the APSME_LinkKeyNvIdGet() function. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilApsmeLinkKeyNvIdGetSrsp extends ZstackFrameResponse { + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + */ + private ZstackResponseCode status; + + /** + * On success, link key NV ID. Otherwise 0xFFFF + */ + private int linkKeyNvId; + + /** + * Response and Handler constructor + */ + public ZstackUtilApsmeLinkKeyNvIdGetSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + linkKeyNvId = deserializer.deserializeUInt16(); + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * The ZStatus_t returned by the proxy call to APSME_LinkKeyNVIdGet(). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * On success, link key NV ID. Otherwise 0xFFFF + * + * @return the current linkKeyNvId as {@link int} + */ + public int getLinkKeyNvId() { + return linkKeyNvId; + } + + /** + * On success, link key NV ID. Otherwise 0xFFFF + * + * @param linkKeyNvId the LinkKeyNvId to set as {@link int} + */ + public void setLinkKeyNvId(int linkKeyNvId) { + this.linkKeyNvId = linkKeyNvId; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(86); + builder.append("ZstackUtilApsmeLinkKeyNvIdGetSrsp [status="); + builder.append(status); + builder.append(", linkKeyNvId="); + builder.append(linkKeyNvId); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java index 6311981322..8f8696dfe5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. - *

    - * This command is used to retrieve the device info. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilGetDeviceInfoSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackUtilGetDeviceInfoSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x00)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x00); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackUtilGetDeviceInfoSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. + *

    + * This command is used to retrieve the device info. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilGetDeviceInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackUtilGetDeviceInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x00)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x00); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackUtilGetDeviceInfoSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java index 17e3f7bd33..bd2cacd6ad 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetDeviceInfoSrsp.java @@ -1,212 +1,213 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; - -/** - * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. - *

    - * This command is used to retrieve the device info. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilGetDeviceInfoSrsp extends ZstackFrameResponse { - - /** - * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command - * message was not within the valid range. - */ - private ZstackResponseCode status; - - /** - * IEEE address of the device. - */ - private IeeeAddress ieeeAddress; - - /** - * Short address of the device. - */ - private int shortAddr; - - /** - * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end - * device, respectively. - */ - private int deviceType; - - /** - * Indicates the state of the device. - */ - private ZstackZdoState deviceState; - - /** - * Array of 16-bits specifies the network address associated with the device. - */ - private int[] assocDevicesList; - - /** - * Response and Handler constructor - */ - public ZstackUtilGetDeviceInfoSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - ieeeAddress = deserializer.deserializeIeeeAddress(); - shortAddr = deserializer.deserializeUInt16(); - deviceType = deserializer.deserializeUInt8(); - deviceState = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); - int numAssocDevices = deserializer.deserializeUInt8(); - assocDevicesList = deserializer.deserializeUInt16Array(numAssocDevices); - } - - /** - * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command - * message was not within the valid range. - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command - * message was not within the valid range. - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * IEEE address of the device. - * - * @return the current ieeeAddress as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddress() { - return ieeeAddress; - } - - /** - * IEEE address of the device. - * - * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} - */ - public void setIeeeAddress(IeeeAddress ieeeAddress) { - this.ieeeAddress = ieeeAddress; - } - - /** - * Short address of the device. - * - * @return the current shortAddr as {@link int} - */ - public int getShortAddr() { - return shortAddr; - } - - /** - * Short address of the device. - * - * @param shortAddr the ShortAddr to set as {@link int} - */ - public void setShortAddr(int shortAddr) { - this.shortAddr = shortAddr; - } - - /** - * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end - * device, respectively. - * - * @return the current deviceType as {@link int} - */ - public int getDeviceType() { - return deviceType; - } - - /** - * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end - * device, respectively. - * - * @param deviceType the DeviceType to set as {@link int} - */ - public void setDeviceType(int deviceType) { - this.deviceType = deviceType; - } - - /** - * Indicates the state of the device. - * - * @return the current deviceState as {@link ZstackZdoState} - */ - public ZstackZdoState getDeviceState() { - return deviceState; - } - - /** - * Indicates the state of the device. - * - * @param deviceState the DeviceState to set as {@link ZstackZdoState} - */ - public void setDeviceState(ZstackZdoState deviceState) { - this.deviceState = deviceState; - } - - /** - * Array of 16-bits specifies the network address associated with the device. - * - * @return the current assocDevicesList as {@link int[]} - */ - public int[] getAssocDevicesList() { - return assocDevicesList; - } - - /** - * Array of 16-bits specifies the network address associated with the device. - * - * @param assocDevicesList the AssocDevicesList to set as {@link int[]} - */ - public void setAssocDevicesList(int[] assocDevicesList) { - this.assocDevicesList = assocDevicesList; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(205); - builder.append("ZstackUtilGetDeviceInfoSrsp [status="); - builder.append(status); - builder.append(", ieeeAddress="); - builder.append(ieeeAddress); - builder.append(", shortAddr="); - builder.append(String.format("%04X", shortAddr)); - builder.append(", deviceType="); - builder.append(deviceType); - builder.append(", deviceState="); - builder.append(deviceState); - builder.append(", assocDevicesList="); - for (int c = 0; c < assocDevicesList.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", assocDevicesList[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_GET_DEVICE_INFO. + *

    + * This command is used to retrieve the device info. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilGetDeviceInfoSrsp extends ZstackFrameResponse { + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + */ + private ZstackResponseCode status; + + /** + * IEEE address of the device. + */ + private IeeeAddress ieeeAddress; + + /** + * Short address of the device. + */ + private int shortAddr; + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + */ + private int deviceType; + + /** + * Indicates the state of the device. + */ + private ZstackZdoState deviceState; + + /** + * Array of 16-bits specifies the network address associated with the device. + */ + private int[] assocDevicesList; + + /** + * Response and Handler constructor + */ + public ZstackUtilGetDeviceInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + ieeeAddress = deserializer.deserializeIeeeAddress(); + shortAddr = deserializer.deserializeUInt16(); + deviceType = deserializer.deserializeUInt8(); + deviceState = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); + int numAssocDevices = deserializer.deserializeUInt8(); + assocDevicesList = deserializer.deserializeUInt16Array(numAssocDevices); + } + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is a one byte field and is either success(0) or fail(1). The fail status is returned if the address value in the command + * message was not within the valid range. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * IEEE address of the device. + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * IEEE address of the device. + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * Short address of the device. + * + * @return the current shortAddr as {@link int} + */ + public int getShortAddr() { + return shortAddr; + } + + /** + * Short address of the device. + * + * @param shortAddr the ShortAddr to set as {@link int} + */ + public void setShortAddr(int shortAddr) { + this.shortAddr = shortAddr; + } + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + * + * @return the current deviceType as {@link int} + */ + public int getDeviceType() { + return deviceType; + } + + /** + * Indicates device type, where bits 0 to 2 indicate the capability for the device to operate as a coordinator, router, or end + * device, respectively. + * + * @param deviceType the DeviceType to set as {@link int} + */ + public void setDeviceType(int deviceType) { + this.deviceType = deviceType; + } + + /** + * Indicates the state of the device. + * + * @return the current deviceState as {@link ZstackZdoState} + */ + public ZstackZdoState getDeviceState() { + return deviceState; + } + + /** + * Indicates the state of the device. + * + * @param deviceState the DeviceState to set as {@link ZstackZdoState} + */ + public void setDeviceState(ZstackZdoState deviceState) { + this.deviceState = deviceState; + } + + /** + * Array of 16-bits specifies the network address associated with the device. + * + * @return the current assocDevicesList as {@link int[]} + */ + public int[] getAssocDevicesList() { + return assocDevicesList; + } + + /** + * Array of 16-bits specifies the network address associated with the device. + * + * @param assocDevicesList the AssocDevicesList to set as {@link int[]} + */ + public void setAssocDevicesList(int[] assocDevicesList) { + this.assocDevicesList = assocDevicesList; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(205); + builder.append("ZstackUtilGetDeviceInfoSrsp [status="); + builder.append(status); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", shortAddr="); + builder.append(String.format("%04X", shortAddr)); + builder.append(", deviceType="); + builder.append(deviceType); + builder.append(", deviceState="); + builder.append(deviceState); + builder.append(", assocDevicesList="); + for (int c = 0; c < assocDevicesList.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", assocDevicesList[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java index ee95ed1b75..397a951638 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_GET_NV_INFO. - *

    - * This command is used to read a block of parameters from non-volatile storage of the target device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilGetNvInfoSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackUtilGetNvInfoSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x01)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x01); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackUtilGetNvInfoSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_GET_NV_INFO. + *

    + * This command is used to read a block of parameters from non-volatile storage of the target device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilGetNvInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackUtilGetNvInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x01)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x01); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackUtilGetNvInfoSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java index 2bae41e7b2..a1c7a7e3d1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilGetNvInfoSrsp.java @@ -1,205 +1,206 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command UTIL_GET_NV_INFO. - *

    - * This command is used to read a block of parameters from non-volatile storage of the target device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilGetNvInfoSrsp extends ZstackFrameResponse { - - /** - * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be - * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. - * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. - */ - private int status; - - /** - * IEEE address of the device. - */ - private IeeeAddress ieeeAddress; - - /** - * This represents a bit-mask of channels to be scanned when starting the device. - */ - private int scanChannels; - - /** - * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. - */ - private int panId; - - /** - * This specifies the network messaging security level, zero disables security. - */ - private int securityLevel; - - /** - * This specifies the pre-configured security key. - */ - private ZigBeeKey preConfigKey; - - /** - * Response and Handler constructor - */ - public ZstackUtilGetNvInfoSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = deserializer.deserializeUInt8(); - ieeeAddress = deserializer.deserializeIeeeAddress(); - scanChannels = deserializer.deserializeUInt32(); - panId = deserializer.deserializeUInt16(); - securityLevel = deserializer.deserializeUInt8(); - preConfigKey = deserializer.deserializeZigBeeKey(); - } - - /** - * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be - * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. - * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. - * - * @return the current status as {@link int} - */ - public int getStatus() { - return status; - } - - /** - * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be - * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. - * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. - * - * @param status the Status to set as {@link int} - */ - public void setStatus(int status) { - this.status = status; - } - - /** - * IEEE address of the device. - * - * @return the current ieeeAddress as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddress() { - return ieeeAddress; - } - - /** - * IEEE address of the device. - * - * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} - */ - public void setIeeeAddress(IeeeAddress ieeeAddress) { - this.ieeeAddress = ieeeAddress; - } - - /** - * This represents a bit-mask of channels to be scanned when starting the device. - * - * @return the current scanChannels as {@link int} - */ - public int getScanChannels() { - return scanChannels; - } - - /** - * This represents a bit-mask of channels to be scanned when starting the device. - * - * @param scanChannels the ScanChannels to set as {@link int} - */ - public void setScanChannels(int scanChannels) { - this.scanChannels = scanChannels; - } - - /** - * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. - * - * @return the current panId as {@link int} - */ - public int getPanId() { - return panId; - } - - /** - * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. - * - * @param panId the PanId to set as {@link int} - */ - public void setPanId(int panId) { - this.panId = panId; - } - - /** - * This specifies the network messaging security level, zero disables security. - * - * @return the current securityLevel as {@link int} - */ - public int getSecurityLevel() { - return securityLevel; - } - - /** - * This specifies the network messaging security level, zero disables security. - * - * @param securityLevel the SecurityLevel to set as {@link int} - */ - public void setSecurityLevel(int securityLevel) { - this.securityLevel = securityLevel; - } - - /** - * This specifies the pre-configured security key. - * - * @return the current preConfigKey as {@link ZigBeeKey} - */ - public ZigBeeKey getPreConfigKey() { - return preConfigKey; - } - - /** - * This specifies the pre-configured security key. - * - * @param preConfigKey the PreConfigKey to set as {@link ZigBeeKey} - */ - public void setPreConfigKey(ZigBeeKey preConfigKey) { - this.preConfigKey = preConfigKey; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(176); - builder.append("ZstackUtilGetNvInfoSrsp [status="); - builder.append(status); - builder.append(", ieeeAddress="); - builder.append(ieeeAddress); - builder.append(", scanChannels="); - builder.append(scanChannels); - builder.append(", panId="); - builder.append(String.format("%04X", panId)); - builder.append(", securityLevel="); - builder.append(securityLevel); - builder.append(", preConfigKey="); - builder.append(preConfigKey); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_GET_NV_INFO. + *

    + * This command is used to read a block of parameters from non-volatile storage of the target device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilGetNvInfoSrsp extends ZstackFrameResponse { + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + */ + private int status; + + /** + * IEEE address of the device. + */ + private IeeeAddress ieeeAddress; + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + */ + private int scanChannels; + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + */ + private int panId; + + /** + * This specifies the network messaging security level, zero disables security. + */ + private int securityLevel; + + /** + * This specifies the pre-configured security key. + */ + private ZigBeeKey preConfigKey; + + /** + * Response and Handler constructor + */ + public ZstackUtilGetNvInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = deserializer.deserializeUInt8(); + ieeeAddress = deserializer.deserializeIeeeAddress(); + scanChannels = deserializer.deserializeUInt32(); + panId = deserializer.deserializeUInt16(); + securityLevel = deserializer.deserializeUInt8(); + preConfigKey = deserializer.deserializeZigBeeKey(); + } + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + * + * @return the current status as {@link int} + */ + public int getStatus() { + return status; + } + + /** + * A value of zero indicates success. Failure is indicated by a non-zero value, representing a bit mask of each item that failed to be + * retrieved from NV memory. Bit0 is used for the first item (IEEEAddress), bit1 for the second item (ScanChannels), and so forth. + * Data values for failed items are returned as one or more bytes of 0xFF, the typical value read from erased NV memory. + * + * @param status the Status to set as {@link int} + */ + public void setStatus(int status) { + this.status = status; + } + + /** + * IEEE address of the device. + * + * @return the current ieeeAddress as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddress() { + return ieeeAddress; + } + + /** + * IEEE address of the device. + * + * @param ieeeAddress the IeeeAddress to set as {@link IeeeAddress} + */ + public void setIeeeAddress(IeeeAddress ieeeAddress) { + this.ieeeAddress = ieeeAddress; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * This represents a bit-mask of channels to be scanned when starting the device. + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + * + * @return the current panId as {@link int} + */ + public int getPanId() { + return panId; + } + + /** + * Specifies the Pan Id to start or join. Set to 0xFFFF to select a PAN after scanning. + * + * @param panId the PanId to set as {@link int} + */ + public void setPanId(int panId) { + this.panId = panId; + } + + /** + * This specifies the network messaging security level, zero disables security. + * + * @return the current securityLevel as {@link int} + */ + public int getSecurityLevel() { + return securityLevel; + } + + /** + * This specifies the network messaging security level, zero disables security. + * + * @param securityLevel the SecurityLevel to set as {@link int} + */ + public void setSecurityLevel(int securityLevel) { + this.securityLevel = securityLevel; + } + + /** + * This specifies the pre-configured security key. + * + * @return the current preConfigKey as {@link ZigBeeKey} + */ + public ZigBeeKey getPreConfigKey() { + return preConfigKey; + } + + /** + * This specifies the pre-configured security key. + * + * @param preConfigKey the PreConfigKey to set as {@link ZigBeeKey} + */ + public void setPreConfigKey(ZigBeeKey preConfigKey) { + this.preConfigKey = preConfigKey; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(176); + builder.append("ZstackUtilGetNvInfoSrsp [status="); + builder.append(status); + builder.append(", ieeeAddress="); + builder.append(ieeeAddress); + builder.append(", scanChannels="); + builder.append(scanChannels); + builder.append(", panId="); + builder.append(String.format("%04X", panId)); + builder.append(", securityLevel="); + builder.append(securityLevel); + builder.append(", preConfigKey="); + builder.append(preConfigKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java index 2ced0c238f..f8ee89812e 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSreq.java @@ -1,103 +1,104 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_LED_CONTROL. - *

    - * This command is used by the tester to control the LEDs on the board. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilLedControlSreq extends ZstackFrameRequest { - - /** - * The LED number. - */ - private int ledId; - - /** - * 0: OFF, 1: ON. - */ - private boolean mode; - - /** - * Request constructor - */ - public ZstackUtilLedControlSreq() { - synchronousCommand = true; - } - - /** - * The LED number. - * - * @return the current ledId as {@link int} - */ - public int getLedId() { - return ledId; - } - - /** - * The LED number. - * - * @param ledId the LedId to set as {@link int} - */ - public void setLedId(int ledId) { - this.ledId = ledId; - } - - /** - * 0: OFF, 1: ON. - * - * @return the current mode as {@link boolean} - */ - public boolean getMode() { - return mode; - } - - /** - * 0: OFF, 1: ON. - * - * @param mode the Mode to set as {@link boolean} - */ - public void setMode(boolean mode) { - this.mode = mode; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x09)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x09); - - // Serialize the fields - serializer.serializeUInt8(ledId); - serializer.serializeBoolean(mode); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(77); - builder.append("ZstackUtilLedControlSreq [ledId="); - builder.append(ledId); - builder.append(", mode="); - builder.append(mode); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_LED_CONTROL. + *

    + * This command is used by the tester to control the LEDs on the board. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilLedControlSreq extends ZstackFrameRequest { + + /** + * The LED number. + */ + private int ledId; + + /** + * 0: OFF, 1: ON. + */ + private boolean mode; + + /** + * Request constructor + */ + public ZstackUtilLedControlSreq() { + synchronousCommand = true; + } + + /** + * The LED number. + * + * @return the current ledId as {@link int} + */ + public int getLedId() { + return ledId; + } + + /** + * The LED number. + * + * @param ledId the LedId to set as {@link int} + */ + public void setLedId(int ledId) { + this.ledId = ledId; + } + + /** + * 0: OFF, 1: ON. + * + * @return the current mode as {@link boolean} + */ + public boolean getMode() { + return mode; + } + + /** + * 0: OFF, 1: ON. + * + * @param mode the Mode to set as {@link boolean} + */ + public void setMode(boolean mode) { + this.mode = mode; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x09)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x09); + + // Serialize the fields + serializer.serializeUInt8(ledId); + serializer.serializeBoolean(mode); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(77); + builder.append("ZstackUtilLedControlSreq [ledId="); + builder.append(ledId); + builder.append(", mode="); + builder.append(mode); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java index 7da7884346..5ed5e20c57 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilLedControlSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_LED_CONTROL. - *

    - * This command is used by the tester to control the LEDs on the board. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilLedControlSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackUtilLedControlSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(52); - builder.append("ZstackUtilLedControlSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_LED_CONTROL. + *

    + * This command is used by the tester to control the LEDs on the board. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilLedControlSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilLedControlSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(52); + builder.append("ZstackUtilLedControlSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java index 7382df9226..593828f5c1 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_SET_CHANNELS. - *

    - * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetChannelsSreq extends ZstackFrameRequest { - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - */ - private int channels; - - /** - * Request constructor - */ - public ZstackUtilSetChannelsSreq() { - synchronousCommand = true; - } - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - * - * @return the current channels as {@link int} - */ - public int getChannels() { - return channels; - } - - /** - * A bit-mask representing the channel(s) to scan the next time the target device resets. - * - * @param channels the Channels to set as {@link int} - */ - public void setChannels(int channels) { - this.channels = channels; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x03)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x03); - - // Serialize the fields - serializer.serializeUInt32(channels); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(53); - builder.append("ZstackUtilSetChannelsSreq [channels="); - builder.append(channels); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_CHANNELS. + *

    + * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetChannelsSreq extends ZstackFrameRequest { + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + */ + private int channels; + + /** + * Request constructor + */ + public ZstackUtilSetChannelsSreq() { + synchronousCommand = true; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @return the current channels as {@link int} + */ + public int getChannels() { + return channels; + } + + /** + * A bit-mask representing the channel(s) to scan the next time the target device resets. + * + * @param channels the Channels to set as {@link int} + */ + public void setChannels(int channels) { + this.channels = channels; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x03)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x03); + + // Serialize the fields + serializer.serializeUInt32(channels); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetChannelsSreq [channels="); + builder.append(channels); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java index f1956c52e0..407968472c 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetChannelsSrsp.java @@ -1,69 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_SET_CHANNELS. - *

    - * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetChannelsSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackUtilSetChannelsSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(53); - builder.append("ZstackUtilSetChannelsSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_CHANNELS. + *

    + * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetChannelsSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetChannelsSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetChannelsSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java index f027e61be9..8db559b960 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_SET_PANID. - *

    - * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetPanidSreq extends ZstackFrameRequest { - - /** - * PanId that will be set. - */ - private int panId; - - /** - * Request constructor - */ - public ZstackUtilSetPanidSreq() { - synchronousCommand = true; - } - - /** - * PanId that will be set. - * - * @return the current panId as {@link int} - */ - public int getPanId() { - return panId; - } - - /** - * PanId that will be set. - * - * @param panId the PanId to set as {@link int} - */ - public void setPanId(int panId) { - this.panId = panId; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x02)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x02); - - // Serialize the fields - serializer.serializeUInt16(panId); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(50); - builder.append("ZstackUtilSetPanidSreq [panId="); - builder.append(String.format("%04X", panId)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_PANID. + *

    + * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetPanidSreq extends ZstackFrameRequest { + + /** + * PanId that will be set. + */ + private int panId; + + /** + * Request constructor + */ + public ZstackUtilSetPanidSreq() { + synchronousCommand = true; + } + + /** + * PanId that will be set. + * + * @return the current panId as {@link int} + */ + public int getPanId() { + return panId; + } + + /** + * PanId that will be set. + * + * @param panId the PanId to set as {@link int} + */ + public void setPanId(int panId) { + this.panId = panId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x02)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x02); + + // Serialize the fields + serializer.serializeUInt16(panId); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(50); + builder.append("ZstackUtilSetPanidSreq [panId="); + builder.append(String.format("%04X", panId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java index 940c02f0b9..e88a10fa17 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPanidSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_SET_PANID. - *

    - * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetPanidSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackUtilSetPanidSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(50); - builder.append("ZstackUtilSetPanidSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_PANID. + *

    + * Store a PanId value into Non-Volatile memory to be used the next time the target device resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetPanidSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetPanidSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(50); + builder.append("ZstackUtilSetPanidSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java index 25a12bf45b..6f9259db16 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySreq.java @@ -1,79 +1,80 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. - *

    - * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetPrecfgkeySreq extends ZstackFrameRequest { - - /** - * An array representing the pre-configured key to use the next time the target device resets. - */ - private ZigBeeKey preCfgKey; - - /** - * Request constructor - */ - public ZstackUtilSetPrecfgkeySreq() { - synchronousCommand = true; - } - - /** - * An array representing the pre-configured key to use the next time the target device resets. - * - * @return the current preCfgKey as {@link ZigBeeKey} - */ - public ZigBeeKey getPreCfgKey() { - return preCfgKey; - } - - /** - * An array representing the pre-configured key to use the next time the target device resets. - * - * @param preCfgKey the PreCfgKey to set as {@link ZigBeeKey} - */ - public void setPreCfgKey(ZigBeeKey preCfgKey) { - this.preCfgKey = preCfgKey; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x05)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x05); - - // Serialize the fields - serializer.serializeZigBeeKey(preCfgKey); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackUtilSetPrecfgkeySreq [preCfgKey="); - builder.append(preCfgKey); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. + *

    + * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetPrecfgkeySreq extends ZstackFrameRequest { + + /** + * An array representing the pre-configured key to use the next time the target device resets. + */ + private ZigBeeKey preCfgKey; + + /** + * Request constructor + */ + public ZstackUtilSetPrecfgkeySreq() { + synchronousCommand = true; + } + + /** + * An array representing the pre-configured key to use the next time the target device resets. + * + * @return the current preCfgKey as {@link ZigBeeKey} + */ + public ZigBeeKey getPreCfgKey() { + return preCfgKey; + } + + /** + * An array representing the pre-configured key to use the next time the target device resets. + * + * @param preCfgKey the PreCfgKey to set as {@link ZigBeeKey} + */ + public void setPreCfgKey(ZigBeeKey preCfgKey) { + this.preCfgKey = preCfgKey; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x05)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x05); + + // Serialize the fields + serializer.serializeZigBeeKey(preCfgKey); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackUtilSetPrecfgkeySreq [preCfgKey="); + builder.append(preCfgKey); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java index 44895fe5ef..34ad7650a4 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetPrecfgkeySrsp.java @@ -1,69 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. - *

    - * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetPrecfgkeySrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackUtilSetPrecfgkeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackUtilSetPrecfgkeySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_PRECFGKEY. + *

    + * This command is used to store a pre-configured key array into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetPrecfgkeySrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetPrecfgkeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackUtilSetPrecfgkeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java index ac978ace39..f0fa408118 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. - *

    - * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetSeclevelSreq extends ZstackFrameRequest { - - /** - * Security level to use the next time the target device resets. Zero is used to disable security. - */ - private int secLevel; - - /** - * Request constructor - */ - public ZstackUtilSetSeclevelSreq() { - synchronousCommand = true; - } - - /** - * Security level to use the next time the target device resets. Zero is used to disable security. - * - * @return the current secLevel as {@link int} - */ - public int getSecLevel() { - return secLevel; - } - - /** - * Security level to use the next time the target device resets. Zero is used to disable security. - * - * @param secLevel the SecLevel to set as {@link int} - */ - public void setSecLevel(int secLevel) { - this.secLevel = secLevel; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x04)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x04); - - // Serialize the fields - serializer.serializeUInt8(secLevel); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(53); - builder.append("ZstackUtilSetSeclevelSreq [secLevel="); - builder.append(secLevel); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. + *

    + * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetSeclevelSreq extends ZstackFrameRequest { + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + */ + private int secLevel; + + /** + * Request constructor + */ + public ZstackUtilSetSeclevelSreq() { + synchronousCommand = true; + } + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + * + * @return the current secLevel as {@link int} + */ + public int getSecLevel() { + return secLevel; + } + + /** + * Security level to use the next time the target device resets. Zero is used to disable security. + * + * @param secLevel the SecLevel to set as {@link int} + */ + public void setSecLevel(int secLevel) { + this.secLevel = secLevel; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_UTIL) && (response.getReqCmd1() == 0x04)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_UTIL, 0x04); + + // Serialize the fields + serializer.serializeUInt8(secLevel); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetSeclevelSreq [secLevel="); + builder.append(secLevel); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java index 5baec19c2e..ca23f20958 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/util/ZstackUtilSetSeclevelSrsp.java @@ -1,69 +1,70 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.util; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. - *

    - * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device - * resets. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackUtilSetSeclevelSrsp extends ZstackFrameResponse { - - /** - * Status is either Success (0) or Failure (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackUtilSetSeclevelSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Status is either Success (0) or Failure (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Status is either Success (0) or Failure (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(53); - builder.append("ZstackUtilSetSeclevelSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.util; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command UTIL_SET_SECLEVEL. + *

    + * This command is used to store a channel select bit-mask into Non-Volatile memory to be used the next time the target device + * resets. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackUtilSetSeclevelSrsp extends ZstackFrameResponse { + + /** + * Status is either Success (0) or Failure (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackUtilSetSeclevelSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Status is either Success (0) or Failure (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Status is either Success (0) or Failure (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(53); + builder.append("ZstackUtilSetSeclevelSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java index 67d3214c20..92875f84fb 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSreq.java @@ -1,49 +1,50 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. - *

    - * Get the network info from the device - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoExtNwkInfoSreq extends ZstackFrameRequest { - - /** - * Request constructor - */ - public ZstackZdoExtNwkInfoSreq() { - synchronousCommand = true; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x50)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x50); - - // Serialize the fields - return getPayload(); - } - - @Override - public String toString() { - return "ZstackZdoExtNwkInfoSreq []"; - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. + *

    + * Get the network info from the device + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoExtNwkInfoSreq extends ZstackFrameRequest { + + /** + * Request constructor + */ + public ZstackZdoExtNwkInfoSreq() { + synchronousCommand = true; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x50)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x50); + + // Serialize the fields + return getPayload(); + } + + @Override + public String toString() { + return "ZstackZdoExtNwkInfoSreq []"; + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java index b7d3cc1e93..e8595f0de6 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoExtNwkInfoSrsp.java @@ -1,225 +1,226 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.ExtendedPanId; -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. - *

    - * Get the network info from the device - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoExtNwkInfoSrsp extends ZstackFrameResponse { - - /** - * Short address - */ - private int shortAddress; - - /** - * Unknown field - */ - private int padding; - - /** - * Pan id - */ - private int panId; - - /** - * Parent address - */ - private int parentAddress; - - /** - * Extended pan id - */ - private ExtendedPanId extendedPanId; - - /** - * Extended parent address - */ - private IeeeAddress extendedParentAddress; - - /** - * Channel - */ - private int channel; - - /** - * Response and Handler constructor - */ - public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - shortAddress = deserializer.deserializeUInt16(); - padding = deserializer.deserializeUInt8(); - panId = deserializer.deserializeUInt16(); - parentAddress = deserializer.deserializeUInt16(); - extendedPanId = deserializer.deserializeExtendedPanId(); - extendedParentAddress = deserializer.deserializeIeeeAddress(); - channel = deserializer.deserializeUInt8(); - } - - /** - * Short address - * - * @return the current shortAddress as {@link int} - */ - public int getShortAddress() { - return shortAddress; - } - - /** - * Short address - * - * @param shortAddress the ShortAddress to set as {@link int} - */ - public void setShortAddress(int shortAddress) { - this.shortAddress = shortAddress; - } - - /** - * Unknown field - * - * @return the current padding as {@link int} - */ - public int getPadding() { - return padding; - } - - /** - * Unknown field - * - * @param padding the Padding to set as {@link int} - */ - public void setPadding(int padding) { - this.padding = padding; - } - - /** - * Pan id - * - * @return the current panId as {@link int} - */ - public int getPanId() { - return panId; - } - - /** - * Pan id - * - * @param panId the PanId to set as {@link int} - */ - public void setPanId(int panId) { - this.panId = panId; - } - - /** - * Parent address - * - * @return the current parentAddress as {@link int} - */ - public int getParentAddress() { - return parentAddress; - } - - /** - * Parent address - * - * @param parentAddress the ParentAddress to set as {@link int} - */ - public void setParentAddress(int parentAddress) { - this.parentAddress = parentAddress; - } - - /** - * Extended pan id - * - * @return the current extendedPanId as {@link ExtendedPanId} - */ - public ExtendedPanId getExtendedPanId() { - return extendedPanId; - } - - /** - * Extended pan id - * - * @param extendedPanId the ExtendedPanId to set as {@link ExtendedPanId} - */ - public void setExtendedPanId(ExtendedPanId extendedPanId) { - this.extendedPanId = extendedPanId; - } - - /** - * Extended parent address - * - * @return the current extendedParentAddress as {@link IeeeAddress} - */ - public IeeeAddress getExtendedParentAddress() { - return extendedParentAddress; - } - - /** - * Extended parent address - * - * @param extendedParentAddress the ExtendedParentAddress to set as {@link IeeeAddress} - */ - public void setExtendedParentAddress(IeeeAddress extendedParentAddress) { - this.extendedParentAddress = extendedParentAddress; - } - - /** - * Channel - * - * @return the current channel as {@link int} - */ - public int getChannel() { - return channel; - } - - /** - * Channel - * - * @param channel the Channel to set as {@link int} - */ - public void setChannel(int channel) { - this.channel = channel; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(201); - builder.append("ZstackZdoExtNwkInfoSrsp [shortAddress="); - builder.append(String.format("%02X", shortAddress)); - builder.append(", padding="); - builder.append(String.format("%01X", padding)); - builder.append(", panId="); - builder.append(String.format("%02X", panId)); - builder.append(", parentAddress="); - builder.append(String.format("%02X", parentAddress)); - builder.append(", extendedPanId="); - builder.append(extendedPanId); - builder.append(", extendedParentAddress="); - builder.append(extendedParentAddress); - builder.append(", channel="); - builder.append(channel); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.ExtendedPanId; +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_EXT_NWK_INFO. + *

    + * Get the network info from the device + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoExtNwkInfoSrsp extends ZstackFrameResponse { + + /** + * Short address + */ + private int shortAddress; + + /** + * Unknown field + */ + private int padding; + + /** + * Pan id + */ + private int panId; + + /** + * Parent address + */ + private int parentAddress; + + /** + * Extended pan id + */ + private ExtendedPanId extendedPanId; + + /** + * Extended parent address + */ + private IeeeAddress extendedParentAddress; + + /** + * Channel + */ + private int channel; + + /** + * Response and Handler constructor + */ + public ZstackZdoExtNwkInfoSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + shortAddress = deserializer.deserializeUInt16(); + padding = deserializer.deserializeUInt8(); + panId = deserializer.deserializeUInt16(); + parentAddress = deserializer.deserializeUInt16(); + extendedPanId = deserializer.deserializeExtendedPanId(); + extendedParentAddress = deserializer.deserializeIeeeAddress(); + channel = deserializer.deserializeUInt8(); + } + + /** + * Short address + * + * @return the current shortAddress as {@link int} + */ + public int getShortAddress() { + return shortAddress; + } + + /** + * Short address + * + * @param shortAddress the ShortAddress to set as {@link int} + */ + public void setShortAddress(int shortAddress) { + this.shortAddress = shortAddress; + } + + /** + * Unknown field + * + * @return the current padding as {@link int} + */ + public int getPadding() { + return padding; + } + + /** + * Unknown field + * + * @param padding the Padding to set as {@link int} + */ + public void setPadding(int padding) { + this.padding = padding; + } + + /** + * Pan id + * + * @return the current panId as {@link int} + */ + public int getPanId() { + return panId; + } + + /** + * Pan id + * + * @param panId the PanId to set as {@link int} + */ + public void setPanId(int panId) { + this.panId = panId; + } + + /** + * Parent address + * + * @return the current parentAddress as {@link int} + */ + public int getParentAddress() { + return parentAddress; + } + + /** + * Parent address + * + * @param parentAddress the ParentAddress to set as {@link int} + */ + public void setParentAddress(int parentAddress) { + this.parentAddress = parentAddress; + } + + /** + * Extended pan id + * + * @return the current extendedPanId as {@link ExtendedPanId} + */ + public ExtendedPanId getExtendedPanId() { + return extendedPanId; + } + + /** + * Extended pan id + * + * @param extendedPanId the ExtendedPanId to set as {@link ExtendedPanId} + */ + public void setExtendedPanId(ExtendedPanId extendedPanId) { + this.extendedPanId = extendedPanId; + } + + /** + * Extended parent address + * + * @return the current extendedParentAddress as {@link IeeeAddress} + */ + public IeeeAddress getExtendedParentAddress() { + return extendedParentAddress; + } + + /** + * Extended parent address + * + * @param extendedParentAddress the ExtendedParentAddress to set as {@link IeeeAddress} + */ + public void setExtendedParentAddress(IeeeAddress extendedParentAddress) { + this.extendedParentAddress = extendedParentAddress; + } + + /** + * Channel + * + * @return the current channel as {@link int} + */ + public int getChannel() { + return channel; + } + + /** + * Channel + * + * @param channel the Channel to set as {@link int} + */ + public void setChannel(int channel) { + this.channel = channel; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(201); + builder.append("ZstackZdoExtNwkInfoSrsp [shortAddress="); + builder.append(String.format("%02X", shortAddress)); + builder.append(", padding="); + builder.append(String.format("%01X", padding)); + builder.append(", panId="); + builder.append(String.format("%02X", panId)); + builder.append(", parentAddress="); + builder.append(String.format("%02X", parentAddress)); + builder.append(", extendedPanId="); + builder.append(extendedPanId); + builder.append(", extendedParentAddress="); + builder.append(extendedParentAddress); + builder.append(", channel="); + builder.append(channel); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java index c78fdbf52b..deb230b452 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. - *

    - * This command retrieves the application link key of a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoGetLinkKeySreq extends ZstackFrameRequest { - - /** - * Specifies the IEEE address of the pair device of the link key - */ - private IeeeAddress ieeeAddr; - - /** - * Request constructor - */ - public ZstackZdoGetLinkKeySreq() { - synchronousCommand = true; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @return the current ieeeAddr as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddr() { - return ieeeAddr; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} - */ - public void setIeeeAddr(IeeeAddress ieeeAddr) { - this.ieeeAddr = ieeeAddr; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x25)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x25); - - // Serialize the fields - serializer.serializeIeeeAddress(ieeeAddr); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackZdoGetLinkKeySreq [ieeeAddr="); - builder.append(ieeeAddr); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

    + * This command retrieves the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoGetLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Request constructor + */ + public ZstackZdoGetLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x25)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x25); + + // Serialize the fields + serializer.serializeIeeeAddress(ieeeAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackZdoGetLinkKeySreq [ieeeAddr="); + builder.append(ieeeAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java index 8110706066..b80e4736a7 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoGetLinkKeySrsp.java @@ -1,122 +1,123 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. - *

    - * This command retrieves the application link key of a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoGetLinkKeySrsp extends ZstackFrameResponse { - - /** - * 0x00 – Success. 0xC8 – Unknown device. - */ - private ZstackResponseCode status; - - /** - * Specifies the IEEE address of the pair device of the link key - */ - private IeeeAddress ieeeAddr; - - /** - * Link key data of the device - */ - private ZigBeeKey linkKeyData; - - /** - * Response and Handler constructor - */ - public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - ieeeAddr = deserializer.deserializeIeeeAddress(); - linkKeyData = deserializer.deserializeZigBeeKey(); - } - - /** - * 0x00 – Success. 0xC8 – Unknown device. - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 – Success. 0xC8 – Unknown device. - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @return the current ieeeAddr as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddr() { - return ieeeAddr; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} - */ - public void setIeeeAddr(IeeeAddress ieeeAddr) { - this.ieeeAddr = ieeeAddr; - } - - /** - * Link key data of the device - * - * @return the current linkKeyData as {@link ZigBeeKey} - */ - public ZigBeeKey getLinkKeyData() { - return linkKeyData; - } - - /** - * Link key data of the device - * - * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} - */ - public void setLinkKeyData(ZigBeeKey linkKeyData) { - this.linkKeyData = linkKeyData; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(101); - builder.append("ZstackZdoGetLinkKeySrsp [status="); - builder.append(status); - builder.append(", ieeeAddr="); - builder.append(ieeeAddr); - builder.append(", linkKeyData="); - builder.append(linkKeyData); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_GET_LINK_KEY. + *

    + * This command retrieves the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoGetLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0xC8 – Unknown device. + */ + private ZstackResponseCode status; + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Link key data of the device + */ + private ZigBeeKey linkKeyData; + + /** + * Response and Handler constructor + */ + public ZstackZdoGetLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + ieeeAddr = deserializer.deserializeIeeeAddress(); + linkKeyData = deserializer.deserializeZigBeeKey(); + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + /** + * Link key data of the device + * + * @return the current linkKeyData as {@link ZigBeeKey} + */ + public ZigBeeKey getLinkKeyData() { + return linkKeyData; + } + + /** + * Link key data of the device + * + * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} + */ + public void setLinkKeyData(ZigBeeKey linkKeyData) { + this.linkKeyData = linkKeyData; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackZdoGetLinkKeySrsp [status="); + builder.append(status); + builder.append(", ieeeAddr="); + builder.append(ieeeAddr); + builder.append(", linkKeyData="); + builder.append(linkKeyData); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java index fb6362c864..7c364a5c1a 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoLeaveIndAreq.java @@ -1,170 +1,171 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command ZDO_LEAVE_IND. - *

    - * This message is an indication to inform the host of a device leaving the network. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoLeaveIndAreq extends ZstackFrameResponse { - - /** - * Short address (LSB-MSB) of the source of the leave indication. - */ - private int srcAddr; - - /** - * Extended address (LSB-MSB) of the source of the leave indication. - */ - private IeeeAddress extAddr; - - /** - * Boolean, TRUE = request, FALSE = indication. - */ - private boolean request; - - /** - * Boolean, TRUE = remove children. - */ - private boolean remove; - - /** - * Boolean, TRUE = rejoin. - */ - private boolean rejoin; - - /** - * Response and Handler constructor - */ - public ZstackZdoLeaveIndAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - srcAddr = deserializer.deserializeUInt16(); - extAddr = deserializer.deserializeIeeeAddress(); - request = deserializer.deserializeBoolean(); - remove = deserializer.deserializeBoolean(); - rejoin = deserializer.deserializeBoolean(); - } - - /** - * Short address (LSB-MSB) of the source of the leave indication. - * - * @return the current srcAddr as {@link int} - */ - public int getSrcAddr() { - return srcAddr; - } - - /** - * Short address (LSB-MSB) of the source of the leave indication. - * - * @param srcAddr the SrcAddr to set as {@link int} - */ - public void setSrcAddr(int srcAddr) { - this.srcAddr = srcAddr; - } - - /** - * Extended address (LSB-MSB) of the source of the leave indication. - * - * @return the current extAddr as {@link IeeeAddress} - */ - public IeeeAddress getExtAddr() { - return extAddr; - } - - /** - * Extended address (LSB-MSB) of the source of the leave indication. - * - * @param extAddr the ExtAddr to set as {@link IeeeAddress} - */ - public void setExtAddr(IeeeAddress extAddr) { - this.extAddr = extAddr; - } - - /** - * Boolean, TRUE = request, FALSE = indication. - * - * @return the current request as {@link boolean} - */ - public boolean getRequest() { - return request; - } - - /** - * Boolean, TRUE = request, FALSE = indication. - * - * @param request the Request to set as {@link boolean} - */ - public void setRequest(boolean request) { - this.request = request; - } - - /** - * Boolean, TRUE = remove children. - * - * @return the current remove as {@link boolean} - */ - public boolean getRemove() { - return remove; - } - - /** - * Boolean, TRUE = remove children. - * - * @param remove the Remove to set as {@link boolean} - */ - public void setRemove(boolean remove) { - this.remove = remove; - } - - /** - * Boolean, TRUE = rejoin. - * - * @return the current rejoin as {@link boolean} - */ - public boolean getRejoin() { - return rejoin; - } - - /** - * Boolean, TRUE = rejoin. - * - * @param rejoin the Rejoin to set as {@link boolean} - */ - public void setRejoin(boolean rejoin) { - this.rejoin = rejoin; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(149); - builder.append("ZstackZdoLeaveIndAreq [srcAddr="); - builder.append(String.format("%04X", srcAddr)); - builder.append(", extAddr="); - builder.append(extAddr); - builder.append(", request="); - builder.append(request); - builder.append(", remove="); - builder.append(remove); - builder.append(", rejoin="); - builder.append(rejoin); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_LEAVE_IND. + *

    + * This message is an indication to inform the host of a device leaving the network. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoLeaveIndAreq extends ZstackFrameResponse { + + /** + * Short address (LSB-MSB) of the source of the leave indication. + */ + private int srcAddr; + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + */ + private IeeeAddress extAddr; + + /** + * Boolean, TRUE = request, FALSE = indication. + */ + private boolean request; + + /** + * Boolean, TRUE = remove children. + */ + private boolean remove; + + /** + * Boolean, TRUE = rejoin. + */ + private boolean rejoin; + + /** + * Response and Handler constructor + */ + public ZstackZdoLeaveIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializer.deserializeUInt16(); + extAddr = deserializer.deserializeIeeeAddress(); + request = deserializer.deserializeBoolean(); + remove = deserializer.deserializeBoolean(); + rejoin = deserializer.deserializeBoolean(); + } + + /** + * Short address (LSB-MSB) of the source of the leave indication. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Short address (LSB-MSB) of the source of the leave indication. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * Extended address (LSB-MSB) of the source of the leave indication. + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + /** + * Boolean, TRUE = request, FALSE = indication. + * + * @return the current request as {@link boolean} + */ + public boolean getRequest() { + return request; + } + + /** + * Boolean, TRUE = request, FALSE = indication. + * + * @param request the Request to set as {@link boolean} + */ + public void setRequest(boolean request) { + this.request = request; + } + + /** + * Boolean, TRUE = remove children. + * + * @return the current remove as {@link boolean} + */ + public boolean getRemove() { + return remove; + } + + /** + * Boolean, TRUE = remove children. + * + * @param remove the Remove to set as {@link boolean} + */ + public void setRemove(boolean remove) { + this.remove = remove; + } + + /** + * Boolean, TRUE = rejoin. + * + * @return the current rejoin as {@link boolean} + */ + public boolean getRejoin() { + return rejoin; + } + + /** + * Boolean, TRUE = rejoin. + * + * @param rejoin the Rejoin to set as {@link boolean} + */ + public void setRejoin(boolean rejoin) { + this.rejoin = rejoin; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(149); + builder.append("ZstackZdoLeaveIndAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", extAddr="); + builder.append(extAddr); + builder.append(", request="); + builder.append(request); + builder.append(", remove="); + builder.append(remove); + builder.append(", rejoin="); + builder.append(rejoin); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java index b3363d9819..18d73629f3 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbIncomingAreq.java @@ -1,226 +1,227 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command ZDO_MSG_CB_INCOMING. - *

    - * This message is a ZDO callback for a Cluster Id that the host requested to receive with a ZDO_ MSG_CB_REGISTER request. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoMsgCbIncomingAreq extends ZstackFrameResponse { - - /** - * Short address (LSB-MSB) of the source of the ZDO message. - */ - private int srcAddr; - - /** - * This field indicates whether or not this ZDO message was broadcast. - */ - private boolean wasBroadcast; - - /** - * The ZDO Cluster Id of this message. - */ - private int clusterId; - - /** - * N/A – not used. - */ - private boolean securityUse; - - /** - * The sequence number of this ZDO message. - */ - private int seqNumber; - - /** - * The MAC destination short address (LSB-MSB) of the ZDO message. - */ - private int dstAddr; - - /** - * The data that corresponds to the Cluster Id of the message - */ - private int[] data; - - /** - * Response and Handler constructor - */ - public ZstackZdoMsgCbIncomingAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - srcAddr = deserializer.deserializeUInt16(); - wasBroadcast = deserializer.deserializeBoolean(); - clusterId = deserializer.deserializeUInt16(); - securityUse = deserializer.deserializeBoolean(); - seqNumber = deserializer.deserializeUInt8(); - dstAddr = deserializer.deserializeUInt16(); - data = deserializer.deserializeUInt8Array(); - } - - /** - * Short address (LSB-MSB) of the source of the ZDO message. - * - * @return the current srcAddr as {@link int} - */ - public int getSrcAddr() { - return srcAddr; - } - - /** - * Short address (LSB-MSB) of the source of the ZDO message. - * - * @param srcAddr the SrcAddr to set as {@link int} - */ - public void setSrcAddr(int srcAddr) { - this.srcAddr = srcAddr; - } - - /** - * This field indicates whether or not this ZDO message was broadcast. - * - * @return the current wasBroadcast as {@link boolean} - */ - public boolean getWasBroadcast() { - return wasBroadcast; - } - - /** - * This field indicates whether or not this ZDO message was broadcast. - * - * @param wasBroadcast the WasBroadcast to set as {@link boolean} - */ - public void setWasBroadcast(boolean wasBroadcast) { - this.wasBroadcast = wasBroadcast; - } - - /** - * The ZDO Cluster Id of this message. - * - * @return the current clusterId as {@link int} - */ - public int getClusterId() { - return clusterId; - } - - /** - * The ZDO Cluster Id of this message. - * - * @param clusterId the ClusterId to set as {@link int} - */ - public void setClusterId(int clusterId) { - this.clusterId = clusterId; - } - - /** - * N/A – not used. - * - * @return the current securityUse as {@link boolean} - */ - public boolean getSecurityUse() { - return securityUse; - } - - /** - * N/A – not used. - * - * @param securityUse the SecurityUse to set as {@link boolean} - */ - public void setSecurityUse(boolean securityUse) { - this.securityUse = securityUse; - } - - /** - * The sequence number of this ZDO message. - * - * @return the current seqNumber as {@link int} - */ - public int getSeqNumber() { - return seqNumber; - } - - /** - * The sequence number of this ZDO message. - * - * @param seqNumber the SeqNumber to set as {@link int} - */ - public void setSeqNumber(int seqNumber) { - this.seqNumber = seqNumber; - } - - /** - * The MAC destination short address (LSB-MSB) of the ZDO message. - * - * @return the current dstAddr as {@link int} - */ - public int getDstAddr() { - return dstAddr; - } - - /** - * The MAC destination short address (LSB-MSB) of the ZDO message. - * - * @param dstAddr the DstAddr to set as {@link int} - */ - public void setDstAddr(int dstAddr) { - this.dstAddr = dstAddr; - } - - /** - * The data that corresponds to the Cluster Id of the message - * - * @return the current data as {@link int[]} - */ - public int[] getData() { - return data; - } - - /** - * The data that corresponds to the Cluster Id of the message - * - * @param data the Data to set as {@link int[]} - */ - public void setData(int[] data) { - this.data = data; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(204); - builder.append("ZstackZdoMsgCbIncomingAreq [srcAddr="); - builder.append(String.format("%04X", srcAddr)); - builder.append(", wasBroadcast="); - builder.append(wasBroadcast); - builder.append(", clusterId="); - builder.append(String.format("%04X", clusterId)); - builder.append(", securityUse="); - builder.append(securityUse); - builder.append(", seqNumber="); - builder.append(String.format("%02X", seqNumber)); - builder.append(", dstAddr="); - builder.append(String.format("%04X", dstAddr)); - builder.append(", data="); - for (int c = 0; c < data.length; c++) { - if (c > 0) { - builder.append(' '); - } - builder.append(String.format("%02X", data[c])); - } - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_INCOMING. + *

    + * This message is a ZDO callback for a Cluster Id that the host requested to receive with a ZDO_ MSG_CB_REGISTER request. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoMsgCbIncomingAreq extends ZstackFrameResponse { + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + */ + private int srcAddr; + + /** + * This field indicates whether or not this ZDO message was broadcast. + */ + private boolean wasBroadcast; + + /** + * The ZDO Cluster Id of this message. + */ + private int clusterId; + + /** + * N/A – not used. + */ + private boolean securityUse; + + /** + * The sequence number of this ZDO message. + */ + private int seqNumber; + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + */ + private int dstAddr; + + /** + * The data that corresponds to the Cluster Id of the message + */ + private int[] data; + + /** + * Response and Handler constructor + */ + public ZstackZdoMsgCbIncomingAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializer.deserializeUInt16(); + wasBroadcast = deserializer.deserializeBoolean(); + clusterId = deserializer.deserializeUInt16(); + securityUse = deserializer.deserializeBoolean(); + seqNumber = deserializer.deserializeUInt8(); + dstAddr = deserializer.deserializeUInt16(); + data = deserializer.deserializeUInt8Array(); + } + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Short address (LSB-MSB) of the source of the ZDO message. + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * This field indicates whether or not this ZDO message was broadcast. + * + * @return the current wasBroadcast as {@link boolean} + */ + public boolean getWasBroadcast() { + return wasBroadcast; + } + + /** + * This field indicates whether or not this ZDO message was broadcast. + * + * @param wasBroadcast the WasBroadcast to set as {@link boolean} + */ + public void setWasBroadcast(boolean wasBroadcast) { + this.wasBroadcast = wasBroadcast; + } + + /** + * The ZDO Cluster Id of this message. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * The ZDO Cluster Id of this message. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + /** + * N/A – not used. + * + * @return the current securityUse as {@link boolean} + */ + public boolean getSecurityUse() { + return securityUse; + } + + /** + * N/A – not used. + * + * @param securityUse the SecurityUse to set as {@link boolean} + */ + public void setSecurityUse(boolean securityUse) { + this.securityUse = securityUse; + } + + /** + * The sequence number of this ZDO message. + * + * @return the current seqNumber as {@link int} + */ + public int getSeqNumber() { + return seqNumber; + } + + /** + * The sequence number of this ZDO message. + * + * @param seqNumber the SeqNumber to set as {@link int} + */ + public void setSeqNumber(int seqNumber) { + this.seqNumber = seqNumber; + } + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + * + * @return the current dstAddr as {@link int} + */ + public int getDstAddr() { + return dstAddr; + } + + /** + * The MAC destination short address (LSB-MSB) of the ZDO message. + * + * @param dstAddr the DstAddr to set as {@link int} + */ + public void setDstAddr(int dstAddr) { + this.dstAddr = dstAddr; + } + + /** + * The data that corresponds to the Cluster Id of the message + * + * @return the current data as {@link int[]} + */ + public int[] getData() { + return data; + } + + /** + * The data that corresponds to the Cluster Id of the message + * + * @param data the Data to set as {@link int[]} + */ + public void setData(int[] data) { + this.data = data; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(204); + builder.append("ZstackZdoMsgCbIncomingAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", wasBroadcast="); + builder.append(wasBroadcast); + builder.append(", clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(", securityUse="); + builder.append(securityUse); + builder.append(", seqNumber="); + builder.append(String.format("%02X", seqNumber)); + builder.append(", dstAddr="); + builder.append(String.format("%04X", dstAddr)); + builder.append(", data="); + for (int c = 0; c < data.length; c++) { + if (c > 0) { + builder.append(' '); + } + builder.append(String.format("%02X", data[c])); + } + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java index 690c876474..a9a6a63b51 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. - *

    - * This command registers for a ZDO callback. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoMsgCbRegisterSreq extends ZstackFrameRequest { - - /** - * Specifies the ZDO Cluster Id for which to receive a ZDO callback. - */ - private int clusterId; - - /** - * Request constructor - */ - public ZstackZdoMsgCbRegisterSreq() { - synchronousCommand = true; - } - - /** - * Specifies the ZDO Cluster Id for which to receive a ZDO callback. - * - * @return the current clusterId as {@link int} - */ - public int getClusterId() { - return clusterId; - } - - /** - * Specifies the ZDO Cluster Id for which to receive a ZDO callback. - * - * @param clusterId the ClusterId to set as {@link int} - */ - public void setClusterId(int clusterId) { - this.clusterId = clusterId; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x3E)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x3E); - - // Serialize the fields - serializer.serializeUInt16(clusterId); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackZdoMsgCbRegisterSreq [clusterId="); - builder.append(String.format("%04X", clusterId)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. + *

    + * This command registers for a ZDO callback. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoMsgCbRegisterSreq extends ZstackFrameRequest { + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + */ + private int clusterId; + + /** + * Request constructor + */ + public ZstackZdoMsgCbRegisterSreq() { + synchronousCommand = true; + } + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + * + * @return the current clusterId as {@link int} + */ + public int getClusterId() { + return clusterId; + } + + /** + * Specifies the ZDO Cluster Id for which to receive a ZDO callback. + * + * @param clusterId the ClusterId to set as {@link int} + */ + public void setClusterId(int clusterId) { + this.clusterId = clusterId; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x3E)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x3E); + + // Serialize the fields + serializer.serializeUInt16(clusterId); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoMsgCbRegisterSreq [clusterId="); + builder.append(String.format("%04X", clusterId)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java index 33d473fe16..54d4866750 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoMsgCbRegisterSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. - *

    - * This command registers for a ZDO callback. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoMsgCbRegisterSrsp extends ZstackFrameResponse { - - /** - * 0x00 – Success. - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * 0x00 – Success. - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 – Success. - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackZdoMsgCbRegisterSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_MSG_CB_REGISTER. + *

    + * This command registers for a ZDO callback. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoMsgCbRegisterSrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoMsgCbRegisterSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * 0x00 – Success. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoMsgCbRegisterSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java index 3972c60175..47ab5dc7e9 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSreq.java @@ -1,103 +1,104 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. - *

    - * This command is used to initiate a network discovery (active scan). - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoNwkDiscoveryReqSreq extends ZstackFrameRequest { - - /** - * Bit mask for channels to scan. - */ - private int scanChannels; - - /** - * A value used to calculate the length of time to spend scanning each channel - */ - private int scanDuration; - - /** - * Request constructor - */ - public ZstackZdoNwkDiscoveryReqSreq() { - synchronousCommand = true; - } - - /** - * Bit mask for channels to scan. - * - * @return the current scanChannels as {@link int} - */ - public int getScanChannels() { - return scanChannels; - } - - /** - * Bit mask for channels to scan. - * - * @param scanChannels the ScanChannels to set as {@link int} - */ - public void setScanChannels(int scanChannels) { - this.scanChannels = scanChannels; - } - - /** - * A value used to calculate the length of time to spend scanning each channel - * - * @return the current scanDuration as {@link int} - */ - public int getScanDuration() { - return scanDuration; - } - - /** - * A value used to calculate the length of time to spend scanning each channel - * - * @param scanDuration the ScanDuration to set as {@link int} - */ - public void setScanDuration(int scanDuration) { - this.scanDuration = scanDuration; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x26)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x26); - - // Serialize the fields - serializer.serializeUInt32(scanChannels); - serializer.serializeUInt8(scanDuration); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(81); - builder.append("ZstackZdoNwkDiscoveryReqSreq [scanChannels="); - builder.append(scanChannels); - builder.append(", scanDuration="); - builder.append(scanDuration); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. + *

    + * This command is used to initiate a network discovery (active scan). + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoNwkDiscoveryReqSreq extends ZstackFrameRequest { + + /** + * Bit mask for channels to scan. + */ + private int scanChannels; + + /** + * A value used to calculate the length of time to spend scanning each channel + */ + private int scanDuration; + + /** + * Request constructor + */ + public ZstackZdoNwkDiscoveryReqSreq() { + synchronousCommand = true; + } + + /** + * Bit mask for channels to scan. + * + * @return the current scanChannels as {@link int} + */ + public int getScanChannels() { + return scanChannels; + } + + /** + * Bit mask for channels to scan. + * + * @param scanChannels the ScanChannels to set as {@link int} + */ + public void setScanChannels(int scanChannels) { + this.scanChannels = scanChannels; + } + + /** + * A value used to calculate the length of time to spend scanning each channel + * + * @return the current scanDuration as {@link int} + */ + public int getScanDuration() { + return scanDuration; + } + + /** + * A value used to calculate the length of time to spend scanning each channel + * + * @param scanDuration the ScanDuration to set as {@link int} + */ + public void setScanDuration(int scanDuration) { + this.scanDuration = scanDuration; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x26)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x26); + + // Serialize the fields + serializer.serializeUInt32(scanChannels); + serializer.serializeUInt8(scanDuration); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(81); + builder.append("ZstackZdoNwkDiscoveryReqSreq [scanChannels="); + builder.append(scanChannels); + builder.append(", scanDuration="); + builder.append(scanDuration); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java index 3e40303a46..ddbbac0296 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoNwkDiscoveryReqSrsp.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. - *

    - * This command is used to initiate a network discovery (active scan). - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoNwkDiscoveryReqSrsp extends ZstackFrameResponse { - - /** - * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User - * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a - * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were - * available. - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZdoNwkDiscoveryReqSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User - * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a - * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were - * available. - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User - * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a - * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were - * available. - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(56); - builder.append("ZstackZdoNwkDiscoveryReqSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_NWK_DISCOVERY_REQ. + *

    + * This command is used to initiate a network discovery (active scan). + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoNwkDiscoveryReqSrsp extends ZstackFrameResponse { + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoNwkDiscoveryReqSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * Success (0) Invalid_Parameter (0x02). ZNwkInvalidRequest (0xC2) if the device is already on a network. User + * ZDO_MGMT_NWK_DISC_REQ instead. Or leave the network first, then initiate the request. MAC_SCAN_IN_PROGRESS (0xFC) if a + * channel change is in progress. MAC_NO_RESOURCE (0x1A) if the operation could not complete because no memory resource were + * available. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(56); + builder.append("ZstackZdoNwkDiscoveryReqSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java index 9887a6a91a..94080ada84 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySreq.java @@ -1,78 +1,79 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. - *

    - * This command removes the application link key of a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoRemoveLinkKeySreq extends ZstackFrameRequest { - - /** - * Specifies the IEEE address of the pair device of the link key - */ - private IeeeAddress ieeeAddr; - - /** - * Request constructor - */ - public ZstackZdoRemoveLinkKeySreq() { - synchronousCommand = true; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @return the current ieeeAddr as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddr() { - return ieeeAddr; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} - */ - public void setIeeeAddr(IeeeAddress ieeeAddr) { - this.ieeeAddr = ieeeAddr; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x24)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x24); - - // Serialize the fields - serializer.serializeIeeeAddress(ieeeAddr); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackZdoRemoveLinkKeySreq [ieeeAddr="); - builder.append(ieeeAddr); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. + *

    + * This command removes the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoRemoveLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * Request constructor + */ + public ZstackZdoRemoveLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x24)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x24); + + // Serialize the fields + serializer.serializeIeeeAddress(ieeeAddr); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoRemoveLinkKeySreq [ieeeAddr="); + builder.append(ieeeAddr); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java index dba377b8c8..de7b4f087d 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoRemoveLinkKeySrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. - *

    - * This command removes the application link key of a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoRemoveLinkKeySrsp extends ZstackFrameResponse { - - /** - * 0x00 – Success. 0xC8 – Unknown device. - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * 0x00 – Success. 0xC8 – Unknown device. - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 – Success. 0xC8 – Unknown device. - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(54); - builder.append("ZstackZdoRemoveLinkKeySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_REMOVE_LINK_KEY. + *

    + * This command removes the application link key of a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoRemoveLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0xC8 – Unknown device. + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoRemoveLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0xC8 – Unknown device. + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(54); + builder.append("ZstackZdoRemoveLinkKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java index 00a0ede242..50e1cbd525 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySreq.java @@ -1,131 +1,132 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; -import com.zsmartsystems.zigbee.security.ZigBeeKey; - -/** - * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. - *

    - * This command sets the application link key for a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoSetLinkKeySreq extends ZstackFrameRequest { - - /** - * Specifies the short address of the pair device of the link key. - */ - private int shortAddr; - - /** - * Specifies the IEEE address of the pair device of the link key - */ - private IeeeAddress ieeeAddr; - - /** - * 128 bit link key data of the device. - */ - private ZigBeeKey linkKeyData; - - /** - * Request constructor - */ - public ZstackZdoSetLinkKeySreq() { - synchronousCommand = true; - } - - /** - * Specifies the short address of the pair device of the link key. - * - * @return the current shortAddr as {@link int} - */ - public int getShortAddr() { - return shortAddr; - } - - /** - * Specifies the short address of the pair device of the link key. - * - * @param shortAddr the ShortAddr to set as {@link int} - */ - public void setShortAddr(int shortAddr) { - this.shortAddr = shortAddr; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @return the current ieeeAddr as {@link IeeeAddress} - */ - public IeeeAddress getIeeeAddr() { - return ieeeAddr; - } - - /** - * Specifies the IEEE address of the pair device of the link key - * - * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} - */ - public void setIeeeAddr(IeeeAddress ieeeAddr) { - this.ieeeAddr = ieeeAddr; - } - - /** - * 128 bit link key data of the device. - * - * @return the current linkKeyData as {@link ZigBeeKey} - */ - public ZigBeeKey getLinkKeyData() { - return linkKeyData; - } - - /** - * 128 bit link key data of the device. - * - * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} - */ - public void setLinkKeyData(ZigBeeKey linkKeyData) { - this.linkKeyData = linkKeyData; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x23)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x23); - - // Serialize the fields - serializer.serializeUInt16(shortAddr); - serializer.serializeIeeeAddress(ieeeAddr); - serializer.serializeZigBeeKey(linkKeyData); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(101); - builder.append("ZstackZdoSetLinkKeySreq [shortAddr="); - builder.append(String.format("%04X", shortAddr)); - builder.append(", ieeeAddr="); - builder.append(ieeeAddr); - builder.append(", linkKeyData="); - builder.append(linkKeyData); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import com.zsmartsystems.zigbee.security.ZigBeeKey; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. + *

    + * This command sets the application link key for a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoSetLinkKeySreq extends ZstackFrameRequest { + + /** + * Specifies the short address of the pair device of the link key. + */ + private int shortAddr; + + /** + * Specifies the IEEE address of the pair device of the link key + */ + private IeeeAddress ieeeAddr; + + /** + * 128 bit link key data of the device. + */ + private ZigBeeKey linkKeyData; + + /** + * Request constructor + */ + public ZstackZdoSetLinkKeySreq() { + synchronousCommand = true; + } + + /** + * Specifies the short address of the pair device of the link key. + * + * @return the current shortAddr as {@link int} + */ + public int getShortAddr() { + return shortAddr; + } + + /** + * Specifies the short address of the pair device of the link key. + * + * @param shortAddr the ShortAddr to set as {@link int} + */ + public void setShortAddr(int shortAddr) { + this.shortAddr = shortAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @return the current ieeeAddr as {@link IeeeAddress} + */ + public IeeeAddress getIeeeAddr() { + return ieeeAddr; + } + + /** + * Specifies the IEEE address of the pair device of the link key + * + * @param ieeeAddr the IeeeAddr to set as {@link IeeeAddress} + */ + public void setIeeeAddr(IeeeAddress ieeeAddr) { + this.ieeeAddr = ieeeAddr; + } + + /** + * 128 bit link key data of the device. + * + * @return the current linkKeyData as {@link ZigBeeKey} + */ + public ZigBeeKey getLinkKeyData() { + return linkKeyData; + } + + /** + * 128 bit link key data of the device. + * + * @param linkKeyData the LinkKeyData to set as {@link ZigBeeKey} + */ + public void setLinkKeyData(ZigBeeKey linkKeyData) { + this.linkKeyData = linkKeyData; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x23)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x23); + + // Serialize the fields + serializer.serializeUInt16(shortAddr); + serializer.serializeIeeeAddress(ieeeAddr); + serializer.serializeZigBeeKey(linkKeyData); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(101); + builder.append("ZstackZdoSetLinkKeySreq [shortAddr="); + builder.append(String.format("%04X", shortAddr)); + builder.append(", ieeeAddr="); + builder.append(ieeeAddr); + builder.append(", linkKeyData="); + builder.append(linkKeyData); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java index 53f9591fd1..73ab3f1719 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoSetLinkKeySrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. - *

    - * This command sets the application link key for a given device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoSetLinkKeySrsp extends ZstackFrameResponse { - - /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(51); - builder.append("ZstackZdoSetLinkKeySrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_SET_LINK_KEY. + *

    + * This command sets the application link key for a given device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:47 CEST 2023") +public class ZstackZdoSetLinkKeySrsp extends ZstackFrameResponse { + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoSetLinkKeySrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * 0x00 – Success. 0x01 – Fail to add to address manager. 0x11 – Security manager key table full + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(51); + builder.append("ZstackZdoSetLinkKeySrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java index ccd5f96652..3a72af0e95 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSreq.java @@ -1,77 +1,78 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; -import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; - -/** - * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. - *

    - * This command starts the device in the network. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoStartupFromAppSreq extends ZstackFrameRequest { - - /** - * Specifies the time delay before the device starts in milliseconds. - */ - private int startDelay; - - /** - * Request constructor - */ - public ZstackZdoStartupFromAppSreq() { - synchronousCommand = true; - } - - /** - * Specifies the time delay before the device starts in milliseconds. - * - * @return the current startDelay as {@link int} - */ - public int getStartDelay() { - return startDelay; - } - - /** - * Specifies the time delay before the device starts in milliseconds. - * - * @param startDelay the StartDelay to set as {@link int} - */ - public void setStartDelay(int startDelay) { - this.startDelay = startDelay; - } - - @Override - public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { - return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x40)); - } - - @Override - public int[] serialize() { - // Serialize the header - serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x40); - - // Serialize the fields - serializer.serializeUInt16(startDelay); - return getPayload(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(55); - builder.append("ZstackZdoStartupFromAppSreq [startDelay="); - builder.append(startDelay); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameRequest; +import com.zsmartsystems.zigbee.dongle.zstack.api.rpc.ZstackRpcSreqErrorSrsp; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. + *

    + * This command starts the device in the network. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoStartupFromAppSreq extends ZstackFrameRequest { + + /** + * Specifies the time delay before the device starts in milliseconds. + */ + private int startDelay; + + /** + * Request constructor + */ + public ZstackZdoStartupFromAppSreq() { + synchronousCommand = true; + } + + /** + * Specifies the time delay before the device starts in milliseconds. + * + * @return the current startDelay as {@link int} + */ + public int getStartDelay() { + return startDelay; + } + + /** + * Specifies the time delay before the device starts in milliseconds. + * + * @param startDelay the StartDelay to set as {@link int} + */ + public void setStartDelay(int startDelay) { + this.startDelay = startDelay; + } + + @Override + public boolean matchSreqError(ZstackRpcSreqErrorSrsp response) { + return (((response.getReqCmd0() & 0x1F) == ZSTACK_ZDO) && (response.getReqCmd1() == 0x40)); + } + + @Override + public int[] serialize() { + // Serialize the header + serializeHeader(ZSTACK_SREQ, ZSTACK_ZDO, 0x40); + + // Serialize the fields + serializer.serializeUInt16(startDelay); + return getPayload(); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStartupFromAppSreq [startDelay="); + builder.append(startDelay); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java index a544fe85cb..34b390603f 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStartupFromAppSrsp.java @@ -1,68 +1,69 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; - -/** - * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. - *

    - * This command starts the device in the network. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoStartupFromAppSrsp extends ZstackFrameResponse { - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - */ - private ZstackResponseCode status; - - /** - * Response and Handler constructor - */ - public ZstackZdoStartupFromAppSrsp(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - synchronousCommand = true; - - // Deserialize the fields - status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @return the current status as {@link ZstackResponseCode} - */ - public ZstackResponseCode getStatus() { - return status; - } - - /** - * This field indicates either SUCCESS (0) or FAILURE (1). - * - * @param status the Status to set as {@link ZstackResponseCode} - */ - public void setStatus(ZstackResponseCode status) { - this.status = status; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(55); - builder.append("ZstackZdoStartupFromAppSrsp [status="); - builder.append(status); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackResponseCode; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_STARTUP_FROM_APP. + *

    + * This command starts the device in the network. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoStartupFromAppSrsp extends ZstackFrameResponse { + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + */ + private ZstackResponseCode status; + + /** + * Response and Handler constructor + */ + public ZstackZdoStartupFromAppSrsp(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + synchronousCommand = true; + + // Deserialize the fields + status = ZstackResponseCode.valueOf(deserializer.deserializeUInt8()); + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @return the current status as {@link ZstackResponseCode} + */ + public ZstackResponseCode getStatus() { + return status; + } + + /** + * This field indicates either SUCCESS (0) or FAILURE (1). + * + * @param status the Status to set as {@link ZstackResponseCode} + */ + public void setStatus(ZstackResponseCode status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStartupFromAppSrsp [status="); + builder.append(status); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java index 0c7bee990c..5a8bc095d5 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoStateChangeIndAreq.java @@ -1,66 +1,67 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; -import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; - -/** - * Class to implement the Z-Stack command ZDO_STATE_CHANGE_IND. - *

    - * This callback message indicates the ZDO state change. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoStateChangeIndAreq extends ZstackFrameResponse { - - /** - * Specifies the changed ZDO state. An enumerated list starting from 0. - */ - private ZstackZdoState state; - - /** - * Response and Handler constructor - */ - public ZstackZdoStateChangeIndAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - state = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); - } - - /** - * Specifies the changed ZDO state. An enumerated list starting from 0. - * - * @return the current state as {@link ZstackZdoState} - */ - public ZstackZdoState getState() { - return state; - } - - /** - * Specifies the changed ZDO state. An enumerated list starting from 0. - * - * @param state the State to set as {@link ZstackZdoState} - */ - public void setState(ZstackZdoState state) { - this.state = state; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(55); - builder.append("ZstackZdoStateChangeIndAreq [state="); - builder.append(state); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import com.zsmartsystems.zigbee.dongle.zstack.api.sys.ZstackZdoState; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_STATE_CHANGE_IND. + *

    + * This callback message indicates the ZDO state change. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoStateChangeIndAreq extends ZstackFrameResponse { + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + */ + private ZstackZdoState state; + + /** + * Response and Handler constructor + */ + public ZstackZdoStateChangeIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + state = ZstackZdoState.valueOf(deserializer.deserializeUInt8()); + } + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + * + * @return the current state as {@link ZstackZdoState} + */ + public ZstackZdoState getState() { + return state; + } + + /** + * Specifies the changed ZDO state. An enumerated list starting from 0. + * + * @param state the State to set as {@link ZstackZdoState} + */ + public void setState(ZstackZdoState state) { + this.state = state; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(55); + builder.append("ZstackZdoStateChangeIndAreq [state="); + builder.append(state); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java index 3dd0ed4db6..6ae35f7b32 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/main/java/com/zsmartsystems/zigbee/dongle/zstack/api/zdo/ZstackZdoTcDevIndAreq.java @@ -1,119 +1,120 @@ -/** - * Copyright (c) 2016-2022 by the respective copyright holders. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - */ -package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; - -import com.zsmartsystems.zigbee.IeeeAddress; -import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; - -/** - * Class to implement the Z-Stack command ZDO_TC_DEV_IND. - *

    - * This message is a ZDO callback for TC Device Indication. This is an indication that the TC has delivered the key to a recently - * joined device. - *

    - * Note that this code is autogenerated. Manual changes may be overwritten. - * - * @author Chris Jackson - */ -public class ZstackZdoTcDevIndAreq extends ZstackFrameResponse { - - /** - * Source network Address - */ - private int srcAddr; - - /** - * IEEE Address of the source - */ - private IeeeAddress extAddr; - - /** - * Network address of the parent - */ - private int parentAddr; - - /** - * Response and Handler constructor - */ - public ZstackZdoTcDevIndAreq(int[] inputBuffer) { - // Super creates deserializer and reads header fields - super(inputBuffer); - - // Deserialize the fields - srcAddr = deserializer.deserializeUInt16(); - extAddr = deserializer.deserializeIeeeAddress(); - parentAddr = deserializer.deserializeUInt16(); - } - - /** - * Source network Address - * - * @return the current srcAddr as {@link int} - */ - public int getSrcAddr() { - return srcAddr; - } - - /** - * Source network Address - * - * @param srcAddr the SrcAddr to set as {@link int} - */ - public void setSrcAddr(int srcAddr) { - this.srcAddr = srcAddr; - } - - /** - * IEEE Address of the source - * - * @return the current extAddr as {@link IeeeAddress} - */ - public IeeeAddress getExtAddr() { - return extAddr; - } - - /** - * IEEE Address of the source - * - * @param extAddr the ExtAddr to set as {@link IeeeAddress} - */ - public void setExtAddr(IeeeAddress extAddr) { - this.extAddr = extAddr; - } - - /** - * Network address of the parent - * - * @return the current parentAddr as {@link int} - */ - public int getParentAddr() { - return parentAddr; - } - - /** - * Network address of the parent - * - * @param parentAddr the ParentAddr to set as {@link int} - */ - public void setParentAddr(int parentAddr) { - this.parentAddr = parentAddr; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(99); - builder.append("ZstackZdoTcDevIndAreq [srcAddr="); - builder.append(String.format("%04X", srcAddr)); - builder.append(", extAddr="); - builder.append(extAddr); - builder.append(", parentAddr="); - builder.append(String.format("%04X", parentAddr)); - builder.append(']'); - return builder.toString(); - } -} +/** + * Copyright (c) 2016-2022 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.dongle.zstack.api.zdo; + +import com.zsmartsystems.zigbee.IeeeAddress; +import com.zsmartsystems.zigbee.dongle.zstack.api.ZstackFrameResponse; +import javax.annotation.Generated; + +/** + * Class to implement the Z-Stack command ZDO_TC_DEV_IND. + *

    + * This message is a ZDO callback for TC Device Indication. This is an indication that the TC has delivered the key to a recently + * joined device. + *

    + * Note that this code is autogenerated. Manual changes may be overwritten. + */ + +@Generated(value = "com.zsmartsystems.zigbee.dongle.zstack.autocode.CommandGenerator", date = "Sun Mar 26 09:52:48 CEST 2023") +public class ZstackZdoTcDevIndAreq extends ZstackFrameResponse { + + /** + * Source network Address + */ + private int srcAddr; + + /** + * IEEE Address of the source + */ + private IeeeAddress extAddr; + + /** + * Network address of the parent + */ + private int parentAddr; + + /** + * Response and Handler constructor + */ + public ZstackZdoTcDevIndAreq(int[] inputBuffer) { + // Super creates deserializer and reads header fields + super(inputBuffer); + + // Deserialize the fields + srcAddr = deserializer.deserializeUInt16(); + extAddr = deserializer.deserializeIeeeAddress(); + parentAddr = deserializer.deserializeUInt16(); + } + + /** + * Source network Address + * + * @return the current srcAddr as {@link int} + */ + public int getSrcAddr() { + return srcAddr; + } + + /** + * Source network Address + * + * @param srcAddr the SrcAddr to set as {@link int} + */ + public void setSrcAddr(int srcAddr) { + this.srcAddr = srcAddr; + } + + /** + * IEEE Address of the source + * + * @return the current extAddr as {@link IeeeAddress} + */ + public IeeeAddress getExtAddr() { + return extAddr; + } + + /** + * IEEE Address of the source + * + * @param extAddr the ExtAddr to set as {@link IeeeAddress} + */ + public void setExtAddr(IeeeAddress extAddr) { + this.extAddr = extAddr; + } + + /** + * Network address of the parent + * + * @return the current parentAddr as {@link int} + */ + public int getParentAddr() { + return parentAddr; + } + + /** + * Network address of the parent + * + * @param parentAddr the ParentAddr to set as {@link int} + */ + public void setParentAddr(int parentAddr) { + this.parentAddr = parentAddr; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(99); + builder.append("ZstackZdoTcDevIndAreq [srcAddr="); + builder.append(String.format("%04X", srcAddr)); + builder.append(", extAddr="); + builder.append(extAddr); + builder.append(", parentAddr="); + builder.append(String.format("%04X", parentAddr)); + builder.append(']'); + return builder.toString(); + } +} diff --git a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java index 2155235d39..dded8c70b2 100644 --- a/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java +++ b/com.zsmartsystems.zigbee.dongle.zstack/src/test/java/com/zsmartsystems/zigbee/dongle/zstack/internal/ZstackProtocolHandlerTest.java @@ -114,13 +114,5 @@ public boolean open(int baudRate, FlowControl flowControl) { @Override public void purgeRxBuffer() { } - - @Override - public void setDtr(boolean state) { - } - - @Override - public void setRts(boolean state) { - } } } diff --git a/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java b/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java index 43f1f88dbe..24c5d254e4 100644 --- a/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java +++ b/com.zsmartsystems.zigbee.serial/src/main/java/com/zsmartsystems/zigbee/serial/ZigBeeSerialPort.java @@ -273,21 +273,19 @@ public void purgeRxBuffer() { } } - @Override - public void setDtr(boolean state) { + public boolean setDtr(boolean state) { try { - serialPort.setDTR(state); + return serialPort.setDTR(state); } catch (SerialPortException e) { - logger.warn("Could not set DTR to {} on {}", state, this.portName, e); + return false; } } - @Override - public void setRts(boolean state) { + public boolean setRts(boolean state) { try { - serialPort.setRTS(state); + return serialPort.setRTS(state); } catch (SerialPortException e) { - logger.warn("Could not set RTS to {} on {}", state, this.portName, e); + return false; } } } \ No newline at end of file diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java index 1a95a67c8c..6b52712c8d 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/transport/ZigBeePort.java @@ -85,16 +85,6 @@ public interface ZigBeePort { */ void purgeRxBuffer(); - /** - * Set DTR on Port - */ - void setDtr(boolean state); - - /** - * Set DTS on Port - */ - void setRts(boolean state); - /** * Enumeration of flow control options */ From 7d5086b416ae096dd67665f6e2a62431c9c19080 Mon Sep 17 00:00:00 2001 From: Leon Schenk <989485+leonschenk@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:51:45 +0200 Subject: [PATCH 33/33] Remove gradle file --- com.zsmartsystems.zigbee.console.zstack/build.gradle | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 com.zsmartsystems.zigbee.console.zstack/build.gradle diff --git a/com.zsmartsystems.zigbee.console.zstack/build.gradle b/com.zsmartsystems.zigbee.console.zstack/build.gradle deleted file mode 100644 index 230a086c44..0000000000 --- a/com.zsmartsystems.zigbee.console.zstack/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group = 'com.zsmartsystems.zigbee' -description = '' -dependencies { - compile project(':com.zsmartsystems.zigbee') - compile project(':com.zsmartsystems.zigbee.console') - compile project(':com.zsmartsystems.zigbee.dongle.zstack’) -} \ No newline at end of file