use of com.zsmartsystems.zigbee.zdo.command.UnbindRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method unbind.
@Test
public void unbind() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
cluster.unbind(new IeeeAddress("1234567890ABCDEF"), 11);
assertEquals(1, commandCapture.getAllValues().size());
ZigBeeCommand command = commandCapture.getValue();
assertNotNull(command);
System.out.println(command);
assertTrue(command instanceof UnbindRequest);
UnbindRequest unbindCommand = (UnbindRequest) command;
assertEquals(new ZigBeeEndpointAddress(1234, 0), unbindCommand.getDestinationAddress());
assertEquals(new IeeeAddress("1234567890ABCDEF"), unbindCommand.getDstAddress());
assertEquals(Integer.valueOf(5), unbindCommand.getSrcEndpoint());
assertEquals(Integer.valueOf(11), unbindCommand.getDstEndpoint());
assertEquals(Integer.valueOf(3), unbindCommand.getDstAddrMode());
assertEquals(Integer.valueOf(0x0022), unbindCommand.getClusterId());
assertEquals(Integer.valueOf(6), unbindCommand.getBindCluster());
}
use of com.zsmartsystems.zigbee.zdo.command.UnbindRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclCluster method unbind.
/**
* Removes a binding from the cluster to the destination {@link ZigBeeEndpoint}.
*
* @param address the destination {@link IeeeAddress}
* @param endpointId the destination endpoint ID
* @return Command future
*/
public Future<CommandResult> unbind(IeeeAddress address, int endpointId) {
final UnbindRequest command = new UnbindRequest();
command.setDestinationAddress(new ZigBeeEndpointAddress(zigbeeEndpoint.getEndpointAddress().getAddress()));
command.setSrcAddress(zigbeeEndpoint.getIeeeAddress());
command.setSrcEndpoint(zigbeeEndpoint.getEndpointId());
command.setBindCluster(clusterId);
// 64 bit addressing
command.setDstAddrMode(3);
command.setDstAddress(address);
command.setDstEndpoint(endpointId);
return zigbeeManager.unicast(command, new UnbindRequest());
}
Aggregations