本文整理了Java中com.zsmartsystems.zigbee.ZigBeeNode.getIeeeAddress()
方法的一些代码示例,展示了ZigBeeNode.getIeeeAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeNode.getIeeeAddress()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.ZigBeeNode
类名称:ZigBeeNode
方法名:getIeeeAddress
[英]Gets the IeeeAddress of the node
[中]获取节点的IeeeAddress
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Gets the {@link IeeeAddress} for this endpoint from it's parent {@link ZigBeeNode}
*
* @return the node {@link IeeeAddress}
*/
public IeeeAddress getIeeeAddress() {
return node.getIeeeAddress();
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Stops service discovery and removes any scheduled tasks
*/
public void stopDiscovery() {
if (futureTask != null) {
futureTask.cancel(true);
}
logger.debug("{}: Node SVC Discovery: stopped", node.getIeeeAddress());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Creates the discoverer
*
* @param networkManager the {@link ZigBeeNetworkManager} for the network
* @param node the {@link ZigBeeNode} whose services we want to discover
*/
public ZigBeeNodeServiceDiscoverer(ZigBeeNetworkManager networkManager, ZigBeeNode node) {
this.networkManager = networkManager;
this.node = node;
retryPeriod = DEFAULT_RETRY_PERIOD + new Random().nextInt(RETRY_RANDOM_TIME);
logger.debug("{}: Node SVC Discovery: created discoverer", node.getIeeeAddress());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void nodeAdded(ZigBeeNode node) {
if (nodeDiscovery.containsKey(node.getIeeeAddress())) {
return;
}
logger.debug("DISCOVERY Extension: Adding discoverer for {}", node.getIeeeAddress());
startDiscovery(node);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void nodeRemoved(ZigBeeNode node) {
logger.debug("DISCOVERY Extension: Removing discoverer for {}", node.getIeeeAddress());
stopDiscovery(node);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
protected void stopDiscovery(ZigBeeNode node) {
ZigBeeNodeServiceDiscoverer discoverer = nodeDiscovery.remove(node.getIeeeAddress());
if (discoverer != null) {
discoverer.stopDiscovery();
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void run() {
logger.debug("DISCOVERY Extension: Starting mesh update");
for (ZigBeeNodeServiceDiscoverer node : nodeDiscovery.values()) {
logger.debug("DISCOVERY Extension: Starting mesh update for {}", node.getNode().getIeeeAddress());
node.updateMesh();
}
}
};
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void nodeUpdated(ZigBeeNode node) {
// We need to handle the cases where the node changes to ONLINE, or to OFFLINE
if (node.getNodeState() == ZigBeeNodeState.ONLINE && !nodeDiscovery.containsKey(node.getIeeeAddress())) {
// If the state is ONLINE, then ensure discovery is running
startDiscovery(node);
} else if (node.getNodeState() != ZigBeeNodeState.ONLINE && nodeDiscovery.containsKey(node.getIeeeAddress())) {
// If state is not ONLINE, then stop discovery
stopDiscovery(node);
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
protected void startDiscovery(ZigBeeNode node) {
ZigBeeNodeServiceDiscoverer nodeDiscoverer = new ZigBeeNodeServiceDiscoverer(networkManager, node);
nodeDiscovery.put(node.getIeeeAddress(), nodeDiscoverer);
nodeDiscoverer.startDiscovery();
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Starts service discovery for the node in order to update the mesh. This adds the
* {@link NodeDiscoveryTask#NEIGHBORS} and {@link NodeDiscoveryTask#ROUTES} tasks to the task list.
* <p>
* Note that {@link NodeDiscoveryTask#ROUTES} is not added for end devices.
*/
public void updateMesh() {
logger.debug("{}: Node SVC Discovery: Update mesh", node.getIeeeAddress());
Set<NodeDiscoveryTask> tasks = new HashSet<NodeDiscoveryTask>();
tasks.add(NodeDiscoveryTask.NEIGHBORS);
if (node.getNodeDescriptor().getLogicalType() != LogicalType.END_DEVICE) {
tasks.add(NodeDiscoveryTask.ROUTES);
}
startDiscovery(tasks);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
private void displayNodeMesh(ZigBeeNode node, ZigBeeNodeServiceDiscoverer discoverer, PrintStream out) {
out.println("IEEE Address : " + node.getIeeeAddress().toString());
out.println("NWK Address : " + node.getNetworkAddress().toString());
out.println("Last discovery started : " + discoverer.getLastDiscoveryStarted() == null ? NEVER
: dfIso8601.format(discoverer.getLastDiscoveryStarted().getTime()));
out.println("Last discovery completed : " + discoverer.getLastDiscoveryCompleted() == null ? NEVER
: dfIso8601.format(discoverer.getLastDiscoveryStarted().getTime()));
out.println("Current tasks : " + tasksToString(discoverer.getTasks()));
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
private void outputDiscoveryTasks(ZigBeeDiscoveryExtension extension, PrintStream out) {
out.println("Mesh update period : " + extension.getUpdatePeriod() + " seconds");
out.println();
out.println("Address Nwk Last Start Last Complete Current Tasks");
for (ZigBeeNodeServiceDiscoverer discoverer : extension.getNodeDiscoverers()) {
ZigBeeNode node = discoverer.getNode();
out.println(String.format("%s %-5d %-20s %-20s %s", node.getIeeeAddress(), node.getNetworkAddress(),
discoverer.getLastDiscoveryStarted() == null ? NEVER
: dfIso8601.format(discoverer.getLastDiscoveryStarted().getTime()),
discoverer.getLastDiscoveryCompleted() == null ? NEVER
: dfIso8601.format(discoverer.getLastDiscoveryCompleted().getTime()),
tasksToString(discoverer.getTasks())));
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
private ZigBeeNodeServiceDiscoverer getNodeDiscoverer(ZigBeeDiscoveryExtension extension, IeeeAddress ieeeAddress) {
for (ZigBeeNodeServiceDiscoverer discoverer : extension.getNodeDiscoverers()) {
if (discoverer.getNode().getIeeeAddress().equals(ieeeAddress)) {
return discoverer;
}
}
return null;
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void nodeRemoved(ZigBeeNode node) {
// Make sure it's our node that's updated
if (!node.getIeeeAddress().equals(nodeIeeeAddress)) {
return;
}
// Clear some properties
Map<String, String> properties = editProperties();
properties.put(ZigBeeBindingConstants.THING_PROPERTY_LASTUPDATE, "");
properties.put(ZigBeeBindingConstants.THING_PROPERTY_ROUTES, "[]");
properties.put(ZigBeeBindingConstants.THING_PROPERTY_NEIGHBORS, "[]");
properties.put(ZigBeeBindingConstants.THING_PROPERTY_ASSOCIATEDDEVICES, "[]");
updateProperties(properties);
if (getThing().getStatus() != ThingStatus.REMOVING) {
updateStatus(ThingStatus.OFFLINE);
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
throws IllegalArgumentException {
if (args.length > 3) {
throw new IllegalArgumentException("Invalid number of arguments");
}
ZigBeeNode leaver = getNode(networkManager, args[1]);
if (args.length == 2) {
networkManager.leave(leaver.getNetworkAddress(), leaver.getIeeeAddress());
return;
}
if (args.length == 3) {
ZigBeeNode parent = getNode(networkManager, args[2]);
networkManager.leave(parent.getNetworkAddress(), leaver.getIeeeAddress());
return;
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void startScan() {
for (ZigBeeCoordinatorHandler coordinator : coordinatorHandlers) {
if (discoveryServiceCallback != null) {
for (ZigBeeNode node : coordinator.getNodes()) {
if (node.getNetworkAddress() == 0) {
continue;
}
logger.debug("{}: Discovery: Starting discovery for existing device", node.getIeeeAddress());
nodeDiscovered(coordinator, node);
}
}
logger.debug("Starting ZigBee scan for {}", coordinator.getUID());
coordinator.scanStart();
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public DiscoveryResult createResult(ThingUID bridgeUID, ZigBeeNode node, Map<String, Object> properties) {
ThingTypeUID thingTypeUID = matcher.matchThingType(properties);
if (thingTypeUID == null) {
return null;
}
ThingUID thingUID = new ThingUID(thingTypeUID, bridgeUID,
node.getIeeeAddress().toString().toLowerCase().replaceAll("[^a-z0-9_/]", ""));
String label;
// If we know the manufacturer and model, then give this device a name
if ((properties.get(Thing.PROPERTY_VENDOR) != null) && (properties.get(Thing.PROPERTY_MODEL_ID) != null)) {
label = properties.get(Thing.PROPERTY_VENDOR) + " " + properties.get(Thing.PROPERTY_MODEL_ID);
} else {
label = "Unknown ZigBee Device";
}
return DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID).withProperties(properties)
.withBridge(bridgeUID).withLabel(label).build();
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Override
public void nodeAdded(ZigBeeNode node) {
for (ZigBeeEndpoint endpoint : node.getEndpoints()) {
if (endpoint.getInputCluster(ZclIasZoneCluster.CLUSTER_ID) != null) {
endpoint.addApplication(new ZclIasZoneClient(networkManager.getNode(0).getIeeeAddress(), 0));
break;
}
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void sendTransaction() {
ZigBeeNetworkManager networkManager = Mockito.mock(ZigBeeNetworkManager.class);
ZigBeeCommand command = Mockito.mock(ZigBeeCommand.class);
Mockito.when(command.getDestinationAddress()).thenReturn(new ZigBeeEndpointAddress(123));
ZigBeeTransactionMatcher responseMatcher = Mockito.mock(ZigBeeTransactionMatcher.class);
ZigBeeNode node = Mockito.mock(ZigBeeNode.class);
Mockito.when(node.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF"));
Mockito.when(networkManager.getNode(123)).thenReturn(node);
ZigBeeTransactionManager transactionManager = new ZigBeeTransactionManager(networkManager);
transactionManager.sendTransaction(command);
Future<CommandResult> cmdResult = transactionManager.sendTransaction(command, responseMatcher);
assertNotNull(cmdResult);
ZigBeeCommand unknownCommand = Mockito.mock(ZigBeeCommand.class);
Mockito.when(unknownCommand.getDestinationAddress()).thenReturn(new ZigBeeEndpointAddress(456));
cmdResult = transactionManager.sendTransaction(unknownCommand, responseMatcher);
// assertNull(cmdResult);
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testSetIeeeAddress() {
ZigBeeNode node = new ZigBeeNode(Mockito.mock(ZigBeeNetworkManager.class), new IeeeAddress("17880100dc880b"));
assertEquals(new IeeeAddress("17880100dc880b"), node.getIeeeAddress());
System.out.println(node.toString());
}
内容来源于网络,如有侵权,请联系作者删除!