Search in sources :

Example 26 with ZclFieldDeserializer

use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class IeeeAddressResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 EC A1 A5 01 00 8D 15 00 35 38 00 01 2A 2F");
    IeeeAddressResponse addressResponse = new IeeeAddressResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    addressResponse.deserialize(fieldDeserializer);
    System.out.println(addressResponse);
    assertEquals(new IeeeAddress("00158D0001A5A1EC"), addressResponse.getIeeeAddrRemoteDev());
    assertEquals(0x8001, (int) addressResponse.getClusterId());
    assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 27 with ZclFieldDeserializer

use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class ManagementBindResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 01 00 01 43 1D A5 00 AA 3E B0 7C 03 06 00 03 62 39 05 0D 00 6F 0D 00 01");
    ManagementBindResponse response = new ManagementBindResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    response.deserialize(fieldDeserializer);
    System.out.println(response);
    assertEquals(1, (int) response.getBindingTableEntries());
    assertEquals(0, (int) response.getStartIndex());
    List<BindingTable> table = response.getBindingTableList();
    assertEquals(1, table.size());
    BindingTable entry = table.get(0);
    assertEquals(6, entry.getClusterId());
    assertEquals(3, entry.getDstAddrMode());
    assertEquals(new IeeeAddress("7CB03EAA00A51D43"), entry.getSrcAddr());
    assertEquals(3, entry.getSrcEndpoint());
    assertEquals(new IeeeAddress("000D6F000D053962"), entry.getDstNodeAddr());
    assertEquals(1, entry.getDstNodeEndpoint());
}
Also used : BindingTable(com.zsmartsystems.zigbee.zdo.field.BindingTable) DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 28 with ZclFieldDeserializer

use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class ManagementRoutingResponseTest method testReceive.

@Test
public void testReceive() {
    // Short response - ie not extended
    int[] packet = getPacketData("00 00 01 00 01 2A 2F 00 35 38");
    ManagementRoutingResponse routingResponse = new ManagementRoutingResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    routingResponse.deserialize(fieldDeserializer);
    System.out.println(routingResponse);
    assertEquals(1, (int) routingResponse.getRoutingTableEntries());
    assertEquals(0, (int) routingResponse.getStartIndex());
    List<RoutingTable> routes = routingResponse.getRoutingTableList();
    assertEquals(1, routes.size());
    assertEquals(12074, (int) routes.get(0).getDestinationAddress());
    assertEquals(14389, (int) routes.get(0).getNextHopAddress());
    assertEquals(DiscoveryState.ACTIVE, routes.get(0).getStatus());
}
Also used : RoutingTable(com.zsmartsystems.zigbee.zdo.field.RoutingTable) DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 29 with ZclFieldDeserializer

use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class MatchDescriptorRequestTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("2E FD FF 04 01 00 01 00 05");
    MatchDescriptorRequest request = new MatchDescriptorRequest();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    request.deserialize(fieldDeserializer);
    System.out.println(request);
    assertEquals(Integer.valueOf(65533), request.getNwkAddrOfInterest());
    assertEquals(Integer.valueOf(260), request.getProfileId());
    assertEquals(0, request.getInClusterList().size());
    assertEquals(1, request.getOutClusterList().size());
    assertEquals(Integer.valueOf(1280), request.getOutClusterList().get(0));
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Aggregations

ZclFieldDeserializer (com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer)29 CommandTest (com.zsmartsystems.zigbee.CommandTest)28 DefaultDeserializer (com.zsmartsystems.zigbee.serialization.DefaultDeserializer)28 Test (org.junit.Test)28 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)6 ZclHeader (com.zsmartsystems.zigbee.zcl.ZclHeader)6 ReadAttributeStatusRecord (com.zsmartsystems.zigbee.zcl.field.ReadAttributeStatusRecord)3 AttributeStatusRecord (com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord)2 PowerDescriptor (com.zsmartsystems.zigbee.zdo.field.PowerDescriptor)2 SimpleDescriptor (com.zsmartsystems.zigbee.zdo.field.SimpleDescriptor)2 ZigBeeDeserializer (com.zsmartsystems.zigbee.serialization.ZigBeeDeserializer)1 AttributeInformation (com.zsmartsystems.zigbee.zcl.field.AttributeInformation)1 BindingTable (com.zsmartsystems.zigbee.zdo.field.BindingTable)1 NeighborTable (com.zsmartsystems.zigbee.zdo.field.NeighborTable)1 NodeDescriptor (com.zsmartsystems.zigbee.zdo.field.NodeDescriptor)1 RoutingTable (com.zsmartsystems.zigbee.zdo.field.RoutingTable)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1