@Test public void doEnergyScan() { EzspScanCompleteHandler scanComplete = Mockito.mock(EzspScanCompleteHandler.class); Mockito.when(scanComplete.getStatus()).thenReturn(EmberStatus.EMBER_SUCCESS); EmberNcp ncp = getEmberNcp(scanComplete); ncp.doEnergyScan(ZigBeeChannelMask.CHANNEL_MASK_2GHZ, 123); Mockito.verify(handler, Mockito.times(1)).sendEzspTransaction(ezspTransactionCapture.capture()); EzspFrameRequest request = ezspTransactionCapture.getValue().getRequest(); assertTrue(request instanceof EzspStartScanRequest); assertEquals(ZigBeeChannelMask.CHANNEL_MASK_2GHZ, ((EzspStartScanRequest) request).getChannelMask()); }
public List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration) { EzspStartScanRequest energyScan = new EzspStartScanRequest(); energyScan.setChannelMask(channelMask); energyScan.setDuration(scanDuration); energyScan.setScanType(EzspNetworkScanType.EZSP_ENERGY_SCAN); Set<Class<?>> relatedResponses = new HashSet<Class<?>>( Arrays.asList(EzspStartScanResponse.class, EzspEnergyScanResultHandler.class)); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspMultiResponseTransaction(energyScan, EzspScanCompleteHandler.class, relatedResponses)); EzspScanCompleteHandler scanCompleteResponse = (EzspScanCompleteHandler) transaction.getResponse(); logger.debug(scanCompleteResponse.toString()); List<EzspEnergyScanResultHandler> channels = new ArrayList<>(); for (EzspFrameResponse network : transaction.getResponses()) { if (network instanceof EzspEnergyScanResultHandler) { channels.add((EzspEnergyScanResultHandler) network); } } lastStatus = scanCompleteResponse.getStatus(); return channels; }
EmberNcp { public List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration) { EzspStartScanRequest energyScan = new EzspStartScanRequest(); energyScan.setChannelMask(channelMask); energyScan.setDuration(scanDuration); energyScan.setScanType(EzspNetworkScanType.EZSP_ENERGY_SCAN); Set<Class<?>> relatedResponses = new HashSet<Class<?>>( Arrays.asList(EzspStartScanResponse.class, EzspEnergyScanResultHandler.class)); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspMultiResponseTransaction(energyScan, EzspScanCompleteHandler.class, relatedResponses)); EzspScanCompleteHandler scanCompleteResponse = (EzspScanCompleteHandler) transaction.getResponse(); logger.debug(scanCompleteResponse.toString()); List<EzspEnergyScanResultHandler> channels = new ArrayList<>(); for (EzspFrameResponse network : transaction.getResponses()) { if (network instanceof EzspEnergyScanResultHandler) { channels.add((EzspEnergyScanResultHandler) network); } } lastStatus = scanCompleteResponse.getStatus(); return channels; } }
EmberNcp { public List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration) { EzspStartScanRequest energyScan = new EzspStartScanRequest(); energyScan.setChannelMask(channelMask); energyScan.setDuration(scanDuration); energyScan.setScanType(EzspNetworkScanType.EZSP_ENERGY_SCAN); Set<Class<?>> relatedResponses = new HashSet<Class<?>>( Arrays.asList(EzspStartScanResponse.class, EzspEnergyScanResultHandler.class)); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspMultiResponseTransaction(energyScan, EzspScanCompleteHandler.class, relatedResponses)); EzspScanCompleteHandler scanCompleteResponse = (EzspScanCompleteHandler) transaction.getResponse(); logger.debug(scanCompleteResponse.toString()); List<EzspEnergyScanResultHandler> channels = new ArrayList<>(); for (EzspFrameResponse network : transaction.getResponses()) { if (network instanceof EzspEnergyScanResultHandler) { channels.add((EzspEnergyScanResultHandler) network); } } lastStatus = scanCompleteResponse.getStatus(); return channels; } EmberNcp(EzspProtocolHandler protocolHandler); }
EmberNcp { public List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration) { EzspStartScanRequest energyScan = new EzspStartScanRequest(); energyScan.setChannelMask(channelMask); energyScan.setDuration(scanDuration); energyScan.setScanType(EzspNetworkScanType.EZSP_ENERGY_SCAN); Set<Class<?>> relatedResponses = new HashSet<Class<?>>( Arrays.asList(EzspStartScanResponse.class, EzspEnergyScanResultHandler.class)); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspMultiResponseTransaction(energyScan, EzspScanCompleteHandler.class, relatedResponses)); EzspScanCompleteHandler scanCompleteResponse = (EzspScanCompleteHandler) transaction.getResponse(); logger.debug(scanCompleteResponse.toString()); List<EzspEnergyScanResultHandler> channels = new ArrayList<>(); for (EzspFrameResponse network : transaction.getResponses()) { if (network instanceof EzspEnergyScanResultHandler) { channels.add((EzspEnergyScanResultHandler) network); } } lastStatus = scanCompleteResponse.getStatus(); return channels; } EmberNcp(EzspProtocolHandler protocolHandler); EmberStatus getLastStatus(); EzspVersionResponse getVersion(); EmberStatus networkInit(); EmberStatus leaveNetwork(); EmberCurrentSecurityState getCurrentSecurityState(); EzspGetNetworkParametersResponse getNetworkParameters(); EmberNetworkStatus getNetworkState(); EzspGetParentChildParametersResponse getChildParameters(); EzspGetChildDataResponse getChildInformation(int childId); EzspStatus addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters,
            int[] outputClusters); int[] getCounters(); EmberStatus clearKeyTable(); EmberKeyStruct getKey(EmberKeyType keyType); EmberKeyStruct getKeyTableEntry(int index); Integer getConfiguration(EzspConfigId configId); EzspStatus setConfiguration(EzspConfigId configId, Integer value); EzspStatus setPolicy(EzspPolicyId policyId, EzspDecisionId decisionId); EzspStatus setPolicy(EzspPolicyId policyId, int decisionId); Integer getPolicy(EzspPolicyId policyId); EzspStatus setValue(EzspValueId valueId, int[] value); int[] getValue(EzspValueId valueId); EmberStatus addTransientLinkKey(IeeeAddress partner, ZigBeeKey transientKey); EmberTransientKeyData getTransientLinkKeyIndex(int index); EmberTransientKeyData getTransientLinkKey(IeeeAddress ieeeAddress); EmberCertificateData getCertificateData(); EmberCertificate283k1Data getCertificate283k1Data(); EmberAesMmoHashContext mmoHash(int[] code); IeeeAddress getIeeeAddress(); int getNwkAddress(); EmberStatus setRadioPower(int power); EmberLibraryStatus getLibraryStatus(EmberLibraryId libraryId); EmberStatus addOrUpdateKeyTableEntry(IeeeAddress address, ZigBeeKey key, boolean linkKey); void setPowerDescriptor(int descriptor); void setManufacturerCode(int code); String getMfgBoardName(); String getMfgName(); int getMfgCustomVersion(); IeeeAddress getMfgCustomEui64(); ByteArray getMfgInstallationCode(); Collection<EzspNetworkFoundHandler> doActiveScan(int channelMask, int scanDuration); List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration); ZigBeeStatus setExtendedTimeout(IeeeAddress remoteEui64, boolean extendedTimeout); int getBootloaderVersion(); EzspGetXncpInfoResponse getXncpInfo(); EzspCustomFrameResponse sendCustomFrame(int[] customFrame); EmberStatus sendManyToOneRouteRequest(EmberConcentratorType concentratorType, int radius); EzspStatus resetToFactoryDefaults(); int[] getMfgToken(EzspMfgTokenId tokenId); EmberStatus setMfgToken(EzspMfgTokenId tokenId, int[] token); }
EmberNcp { public List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration) { EzspStartScanRequest energyScan = new EzspStartScanRequest(); energyScan.setChannelMask(channelMask); energyScan.setDuration(scanDuration); energyScan.setScanType(EzspNetworkScanType.EZSP_ENERGY_SCAN); Set<Class<?>> relatedResponses = new HashSet<Class<?>>( Arrays.asList(EzspStartScanResponse.class, EzspEnergyScanResultHandler.class)); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspMultiResponseTransaction(energyScan, EzspScanCompleteHandler.class, relatedResponses)); EzspScanCompleteHandler scanCompleteResponse = (EzspScanCompleteHandler) transaction.getResponse(); logger.debug(scanCompleteResponse.toString()); List<EzspEnergyScanResultHandler> channels = new ArrayList<>(); for (EzspFrameResponse network : transaction.getResponses()) { if (network instanceof EzspEnergyScanResultHandler) { channels.add((EzspEnergyScanResultHandler) network); } } lastStatus = scanCompleteResponse.getStatus(); return channels; } EmberNcp(EzspProtocolHandler protocolHandler); EmberStatus getLastStatus(); EzspVersionResponse getVersion(); EmberStatus networkInit(); EmberStatus leaveNetwork(); EmberCurrentSecurityState getCurrentSecurityState(); EzspGetNetworkParametersResponse getNetworkParameters(); EmberNetworkStatus getNetworkState(); EzspGetParentChildParametersResponse getChildParameters(); EzspGetChildDataResponse getChildInformation(int childId); EzspStatus addEndpoint(int endpointId, int deviceId, int profileId, int[] inputClusters,
            int[] outputClusters); int[] getCounters(); EmberStatus clearKeyTable(); EmberKeyStruct getKey(EmberKeyType keyType); EmberKeyStruct getKeyTableEntry(int index); Integer getConfiguration(EzspConfigId configId); EzspStatus setConfiguration(EzspConfigId configId, Integer value); EzspStatus setPolicy(EzspPolicyId policyId, EzspDecisionId decisionId); EzspStatus setPolicy(EzspPolicyId policyId, int decisionId); Integer getPolicy(EzspPolicyId policyId); EzspStatus setValue(EzspValueId valueId, int[] value); int[] getValue(EzspValueId valueId); EmberStatus addTransientLinkKey(IeeeAddress partner, ZigBeeKey transientKey); EmberTransientKeyData getTransientLinkKeyIndex(int index); EmberTransientKeyData getTransientLinkKey(IeeeAddress ieeeAddress); EmberCertificateData getCertificateData(); EmberCertificate283k1Data getCertificate283k1Data(); EmberAesMmoHashContext mmoHash(int[] code); IeeeAddress getIeeeAddress(); int getNwkAddress(); EmberStatus setRadioPower(int power); EmberLibraryStatus getLibraryStatus(EmberLibraryId libraryId); EmberStatus addOrUpdateKeyTableEntry(IeeeAddress address, ZigBeeKey key, boolean linkKey); void setPowerDescriptor(int descriptor); void setManufacturerCode(int code); String getMfgBoardName(); String getMfgName(); int getMfgCustomVersion(); IeeeAddress getMfgCustomEui64(); ByteArray getMfgInstallationCode(); Collection<EzspNetworkFoundHandler> doActiveScan(int channelMask, int scanDuration); List<EzspEnergyScanResultHandler> doEnergyScan(int channelMask, int scanDuration); ZigBeeStatus setExtendedTimeout(IeeeAddress remoteEui64, boolean extendedTimeout); int getBootloaderVersion(); EzspGetXncpInfoResponse getXncpInfo(); EzspCustomFrameResponse sendCustomFrame(int[] customFrame); EmberStatus sendManyToOneRouteRequest(EmberConcentratorType concentratorType, int radius); EzspStatus resetToFactoryDefaults(); int[] getMfgToken(EzspMfgTokenId tokenId); EmberStatus setMfgToken(EzspMfgTokenId tokenId, int[] token);  }