Search in sources :

Example 26 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class QueryNextImageCommandTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 0C 11 62 00 03 05 02 01");
    QueryNextImageCommand command = new QueryNextImageCommand();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    command.deserialize(fieldDeserializer);
    System.out.println(command);
    assertEquals(Integer.valueOf(4364), command.getManufacturerCode());
    assertEquals(Integer.valueOf(98), command.getImageType());
    assertEquals(Integer.valueOf(0x1020503), command.getFileVersion());
    assertNull(command.getHardwareVersion());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 27 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class QueryNextImageCommandTest method testReceiveHwVersion.

@Test
public void testReceiveHwVersion() {
    int[] packet = getPacketData("01 0C 11 62 00 03 05 02 01 33 44");
    QueryNextImageCommand command = new QueryNextImageCommand();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    command.deserialize(fieldDeserializer);
    System.out.println(command);
    assertEquals(Integer.valueOf(4364), command.getManufacturerCode());
    assertEquals(Integer.valueOf(98), command.getImageType());
    assertEquals(Integer.valueOf(0x1020503), command.getFileVersion());
    assertEquals(Integer.valueOf(0x4433), command.getHardwareVersion());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 28 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class ActiveEndpointsResponseTest method testReceive2.

@Test
public void testReceive2() {
    int[] packet = getPacketData("00 00 BD 97 06 01 02 03 04 C8 E8");
    ActiveEndpointsResponse endpointsResponse = new ActiveEndpointsResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    endpointsResponse.deserialize(fieldDeserializer);
    System.out.println(endpointsResponse);
    assertEquals(6, endpointsResponse.getActiveEpList().size());
    assertEquals(0x8005, (int) endpointsResponse.getClusterId());
    assertEquals(ZdoStatus.SUCCESS, endpointsResponse.getStatus());
    assertEquals(0x97bd, (int) endpointsResponse.getNwkAddrOfInterest());
    assertEquals(1, (int) endpointsResponse.getActiveEpList().get(0));
    assertEquals(2, (int) endpointsResponse.getActiveEpList().get(1));
    assertEquals(3, (int) endpointsResponse.getActiveEpList().get(2));
    assertEquals(4, (int) endpointsResponse.getActiveEpList().get(3));
    assertEquals(0xc8, (int) endpointsResponse.getActiveEpList().get(4));
    assertEquals(0xe8, (int) endpointsResponse.getActiveEpList().get(5));
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 29 with DefaultDeserializer

use of com.zsmartsystems.zigbee.serialization.DefaultDeserializer in project com.zsmartsystems.zigbee by zsmartsystems.

the class IeeeAddressResponseTest method testReceiveVeryShort.

@Test
public void testReceiveVeryShort() {
    // Short response - ie not extended. This is from the Ember response!
    int[] packet = getPacketData("00 00 42 CC 12 00 00 24 E5 7C AD B8");
    IeeeAddressResponse addressResponse = new IeeeAddressResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    addressResponse.deserialize(fieldDeserializer);
    System.out.println(addressResponse);
    assertEquals(ZdoStatus.SUCCESS, addressResponse.getStatus());
    assertEquals(new IeeeAddress("7CE524000012CC42"), addressResponse.getIeeeAddrRemoteDev());
    assertEquals(Integer.valueOf(47277), addressResponse.getNwkAddrRemoteDev());
    assertEquals(0x8001, (int) addressResponse.getClusterId());
}
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 30 with DefaultDeserializer

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

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