Search in sources :

Example 31 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer 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 32 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer 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 33 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer 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

DefaultDeserializer (com.zsmartsystems.zigbee.serialization.DefaultDeserializer)33 CommandTest (com.zsmartsystems.zigbee.CommandTest)32 Test (org.junit.Test)32 ZclFieldDeserializer (com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer)28 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)7 ZclHeader (com.zsmartsystems.zigbee.zcl.ZclHeader)6 ReadAttributeStatusRecord (com.zsmartsystems.zigbee.zcl.field.ReadAttributeStatusRecord)3 DefaultSerializer (com.zsmartsystems.zigbee.serialization.DefaultSerializer)2 AttributeStatusRecord (com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord)2 NeighborTable (com.zsmartsystems.zigbee.zdo.field.NeighborTable)2 PowerDescriptor (com.zsmartsystems.zigbee.zdo.field.PowerDescriptor)2 SimpleDescriptor (com.zsmartsystems.zigbee.zdo.field.SimpleDescriptor)2 ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)1 AttributeInformation (com.zsmartsystems.zigbee.zcl.field.AttributeInformation)1 BindingTable (com.zsmartsystems.zigbee.zdo.field.BindingTable)1 NodeDescriptor (com.zsmartsystems.zigbee.zdo.field.NodeDescriptor)1 RoutingTable (com.zsmartsystems.zigbee.zdo.field.RoutingTable)1