本文整理了Java中com.zsmartsystems.zigbee.security.ZigBeeKey.setAddress()
方法的一些代码示例,展示了ZigBeeKey.setAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeKey.setAddress()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.security.ZigBeeKey
类名称:ZigBeeKey
方法名:setAddress
暂无
代码示例来源:origin: openhab/org.openhab.binding.zigbee
/**
* Process the adding of an install code
*
* @param installCode the string representation of the install code
* @param transportConfig the {@link TransportConfig} to populate with the configuration
*/
private void addInstallCode(String installCode) {
if (installCode == null || installCode.isEmpty()) {
return;
}
// Split the install code and the address
String[] codeParts = installCode.split(":");
if (codeParts.length != 2) {
logger.warn("{}: Incorrectly formatted install code configuration {}", nodeIeeeAddress, installCode);
return;
}
MmoHash mmoHash = new MmoHash(codeParts[1].replace("-", ""));
ZigBeeKey key = new ZigBeeKey(mmoHash.getHash());
key.setAddress(new IeeeAddress(codeParts[0]));
networkManager.setZigBeeInstallKey(key);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
throws IllegalArgumentException {
if (args.length < 2 || args.length > 3) {
throw new IllegalArgumentException("Incorrect number of arguments.");
}
IeeeAddress partner;
try {
partner = new IeeeAddress(args[1]);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Partner address is incorrect format.");
}
MmoHash hash;
ZigBeeKey installKey;
try {
hash = new MmoHash(args[2]);
installKey = new ZigBeeKey(hash.getHash());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Install key is incorrect format.");
}
installKey.setAddress(partner);
ZigBeeStatus result = networkManager.setZigBeeInstallKey(installKey);
out.println("Install key " + hash.toString() + " for address " + partner + " was "
+ (result == ZigBeeStatus.SUCCESS ? "" : "not") + " set.");
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void setZigBeeInstallKey() {
ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class);
ZigBeeNetworkManager manager = new ZigBeeNetworkManager(transport);
ZigBeeKey key = new ZigBeeKey();
assertEquals(ZigBeeStatus.INVALID_ARGUMENTS, manager.setZigBeeInstallKey(key));
key.setAddress(new IeeeAddress());
manager.setZigBeeInstallKey(key);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testAddress() {
ZigBeeKey key = new ZigBeeKey("11223344556677889900AABBCCDDEEFF");
assertFalse(key.hasAddress());
assertNull(key.getAddress());
key.setAddress(new IeeeAddress("1234567890ABCDE"));
assertTrue(key.hasAddress());
assertEquals(new IeeeAddress("1234567890ABCDE"), key.getAddress());
}
内容来源于网络,如有侵权,请联系作者删除!