@Test public void getTcLinkKey() { System.out.println("--- " + Thread.currentThread().getStackTrace()[1].getMethodName()); final EmberNcp ncp = Mockito.mock(EmberNcp.class); ZigBeeDongleEzsp dongle = new ZigBeeDongleEzsp(null) { @Override public EmberNcp getEmberNcp() { return ncp; } }; EmberKeyStruct emberKey = Mockito.mock(EmberKeyStruct.class); EmberKeyData emberKeyData = new EmberKeyData(); emberKeyData.setContents(new int[16]); Mockito.when(ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY)).thenReturn(null); Mockito.when(ncp.getKey(EmberKeyType.EMBER_CURRENT_NETWORK_KEY)).thenReturn(emberKey); Mockito.when(emberKey.getBitmask()).thenReturn(Collections.emptySet()); Mockito.when(emberKey.getKey()).thenReturn(emberKeyData); assertNull(dongle.getTcLinkKey()); assertNotNull(dongle.getZigBeeNetworkKey()); }
@Override public ZigBeeKey getTcLinkKey() { EmberNcp ncp = getEmberNcp(); EmberKeyStruct key = ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY); return emberKeyToZigBeeKey(key); }
ZigBeeDongleEzsp implements ZigBeeTransportTransmit, ZigBeeTransportFirmwareUpdate, EzspFrameHandler { @Override public ZigBeeKey getTcLinkKey() { EmberNcp ncp = getEmberNcp(); EmberKeyStruct key = ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY); return emberKeyToZigBeeKey(key); } }
ZigBeeDongleEzsp implements ZigBeeTransportTransmit, ZigBeeTransportFirmwareUpdate, EzspFrameHandler { @Override public ZigBeeKey getTcLinkKey() { EmberNcp ncp = getEmberNcp(); EmberKeyStruct key = ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY); return emberKeyToZigBeeKey(key); } ZigBeeDongleEzsp(final ZigBeePort serialPort);  ZigBeeDongleEzsp(final ZigBeePort serialPort, final EmberSerialProtocol protocol); }
ZigBeeDongleEzsp implements ZigBeeTransportTransmit, ZigBeeTransportFirmwareUpdate, EzspFrameHandler { @Override public ZigBeeKey getTcLinkKey() { EmberNcp ncp = getEmberNcp(); EmberKeyStruct key = ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY); return emberKeyToZigBeeKey(key); } ZigBeeDongleEzsp(final ZigBeePort serialPort);  ZigBeeDongleEzsp(final ZigBeePort serialPort, final EmberSerialProtocol protocol); void setEmberNcpResetProvider(EmberNcpResetProvider resetProvider); Integer updateDefaultConfiguration(EzspConfigId configId, Integer value); EzspDecisionId updateDefaultPolicy(EzspPolicyId policyId, EzspDecisionId decisionId); EmberMfglib getEmberMfglib(EmberMfglibListener mfglibListener); @Override void setDefaultProfileId(int defaultProfileId); @Override void setDefaultDeviceId(int defaultDeviceId); @Override ZigBeeStatus initialize(); @Override ZigBeeStatus startup(boolean reinitialize); void setPollRate(int pollRate); @Override void shutdown(); void passLoopbackMessages(boolean passLoopbackMessages); EmberNcp getEmberNcp(); EmberCbkeProvider getEmberCbkeProvider(); @Override IeeeAddress getIeeeAddress(); @Override Integer getNwkAddress(); @Override void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame); @Override void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportReceive); @Override void setNodeDescriptor(IeeeAddress ieeeAddress, NodeDescriptor nodeDescriptor); @Override void handlePacket(EzspFrame response); @Override void handleLinkStateChange(final boolean linkState); @Override ZigBeeChannel getZigBeeChannel(); @Override ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel); @Override int getZigBeePanId(); @Override ZigBeeStatus setZigBeePanId(int panId); @Override ExtendedPanId getZigBeeExtendedPanId(); @Override ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId); @Override ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key); @Override ZigBeeKey getZigBeeNetworkKey(); @Override ZigBeeStatus setTcLinkKey(ZigBeeKey key); @Override ZigBeeKey getTcLinkKey(); @Override void updateTransportConfig(TransportConfig configuration); @Override String getVersionString(); @Override boolean updateFirmware(final InputStream firmware, final ZigBeeTransportFirmwareCallback callback); void bootloadComplete(); @Override String getFirmwareVersion(); @Override boolean cancelUpdateFirmware(); Map<String, Long> getCounters(); }
ZigBeeDongleEzsp implements ZigBeeTransportTransmit, ZigBeeTransportFirmwareUpdate, EzspFrameHandler { @Override public ZigBeeKey getTcLinkKey() { EmberNcp ncp = getEmberNcp(); EmberKeyStruct key = ncp.getKey(EmberKeyType.EMBER_TRUST_CENTER_LINK_KEY); return emberKeyToZigBeeKey(key); } ZigBeeDongleEzsp(final ZigBeePort serialPort);  ZigBeeDongleEzsp(final ZigBeePort serialPort, final EmberSerialProtocol protocol); void setEmberNcpResetProvider(EmberNcpResetProvider resetProvider); Integer updateDefaultConfiguration(EzspConfigId configId, Integer value); EzspDecisionId updateDefaultPolicy(EzspPolicyId policyId, EzspDecisionId decisionId); EmberMfglib getEmberMfglib(EmberMfglibListener mfglibListener); @Override void setDefaultProfileId(int defaultProfileId); @Override void setDefaultDeviceId(int defaultDeviceId); @Override ZigBeeStatus initialize(); @Override ZigBeeStatus startup(boolean reinitialize); void setPollRate(int pollRate); @Override void shutdown(); void passLoopbackMessages(boolean passLoopbackMessages); EmberNcp getEmberNcp(); EmberCbkeProvider getEmberCbkeProvider(); @Override IeeeAddress getIeeeAddress(); @Override Integer getNwkAddress(); @Override void sendCommand(final int msgTag, final ZigBeeApsFrame apsFrame); @Override void setZigBeeTransportReceive(ZigBeeTransportReceive zigbeeTransportReceive); @Override void setNodeDescriptor(IeeeAddress ieeeAddress, NodeDescriptor nodeDescriptor); @Override void handlePacket(EzspFrame response); @Override void handleLinkStateChange(final boolean linkState); @Override ZigBeeChannel getZigBeeChannel(); @Override ZigBeeStatus setZigBeeChannel(ZigBeeChannel channel); @Override int getZigBeePanId(); @Override ZigBeeStatus setZigBeePanId(int panId); @Override ExtendedPanId getZigBeeExtendedPanId(); @Override ZigBeeStatus setZigBeeExtendedPanId(ExtendedPanId extendedPanId); @Override ZigBeeStatus setZigBeeNetworkKey(final ZigBeeKey key); @Override ZigBeeKey getZigBeeNetworkKey(); @Override ZigBeeStatus setTcLinkKey(ZigBeeKey key); @Override ZigBeeKey getTcLinkKey(); @Override void updateTransportConfig(TransportConfig configuration); @Override String getVersionString(); @Override boolean updateFirmware(final InputStream firmware, final ZigBeeTransportFirmwareCallback callback); void bootloadComplete(); @Override String getFirmwareVersion(); @Override boolean cancelUpdateFirmware(); Map<String, Long> getCounters();  }