use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class DefaultSerializerTest method testSerialize_IEEE_ADDRESS.
@Test
public void testSerialize_IEEE_ADDRESS() {
IeeeAddress valIn = new IeeeAddress("1234567890123456");
int[] valOut = { 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12 };
testSerializedData(valIn, valOut, ZclDataType.IEEE_ADDRESS);
}
use of com.zsmartsystems.zigbee.IeeeAddress 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.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZclClusterTest method getReporting.
@Test
public void getReporting() {
createNetworkManager();
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress());
node.setNetworkAddress(1234);
ZigBeeEndpoint device = new ZigBeeEndpoint(networkManager, node, 5);
ZclCluster cluster = new ZclOnOffCluster(networkManager, device);
ZclAttribute attribute = cluster.getAttribute(0);
cluster.getReporting(attribute);
assertEquals(1, commandCapture.getAllValues().size());
ZigBeeCommand command = commandCapture.getValue();
assertNotNull(command);
System.out.println(command);
assertTrue(command instanceof ReadReportingConfigurationCommand);
ReadReportingConfigurationCommand cfgCommand = (ReadReportingConfigurationCommand) command;
assertEquals(1, cfgCommand.getRecords().size());
AttributeRecord record = cfgCommand.getRecords().get(0);
assertEquals(0, record.getAttributeIdentifier());
assertEquals(0, record.getDirection());
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class DefaultDeserializerTest method testDeserialize_IEEE_ADDRESS.
@Test
public void testDeserialize_IEEE_ADDRESS() {
int[] valIn = { 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12 };
IeeeAddress valOut = new IeeeAddress("1234567890123456");
testDeserialize(valIn, valOut, ZclDataType.IEEE_ADDRESS);
}
use of com.zsmartsystems.zigbee.IeeeAddress in project com.zsmartsystems.zigbee by zsmartsystems.
the class IeeeAddressResponseTest method testReceiveShort.
@Test
public void testReceiveShort() {
// Short response - ie not extended. This is from the Ember response!
int[] packet = getPacketData("00 00 BF 32 17 00 00 A3 22 00 00 00 00");
IeeeAddressResponse addressResponse = new IeeeAddressResponse();
DefaultDeserializer deserializer = new DefaultDeserializer(packet);
ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
addressResponse.deserialize(fieldDeserializer);
System.out.println(addressResponse);
assertEquals(new IeeeAddress("0022A300001732BF"), addressResponse.getIeeeAddrRemoteDev());
assertEquals(0x8001, (int) addressResponse.getClusterId());
assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
}
Aggregations