Search in sources :

Example 6 with ZclFieldDeserializer

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

the class ZoneStatusChangeNotificationCommandTest method test.

@Test
public void test() {
    int[] packet = getPacketData("09 7B 00 24 00 00 00 00 00");
    ZoneStatusChangeNotificationCommand command = new ZoneStatusChangeNotificationCommand();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
    System.out.println(zclHeader);
    command.deserialize(fieldDeserializer);
    System.out.println(command);
    assertEquals(Integer.valueOf(0x500), command.getClusterId());
    assertEquals(Integer.valueOf(36), command.getZoneStatus());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) ZclHeader(com.zsmartsystems.zigbee.zcl.ZclHeader) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 7 with ZclFieldDeserializer

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

the class OffWithEffectCommandTest method deserialize.

@Test
public void deserialize() {
    int[] packet = getPacketData("01 12 40 00 00");
    OffWithEffectCommand command = new OffWithEffectCommand();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
    System.out.println(zclHeader);
    command.deserialize(fieldDeserializer);
    System.out.println(command);
    assertEquals(Integer.valueOf(0), command.getEffectIdentifier());
    assertEquals(Integer.valueOf(0), command.getEffectVariant());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) ZclHeader(com.zsmartsystems.zigbee.zcl.ZclHeader) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 8 with ZclFieldDeserializer

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

the class ActiveEndpointsResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 00 00 01 01");
    ActiveEndpointsResponse endpointsResponse = new ActiveEndpointsResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    endpointsResponse.deserialize(fieldDeserializer);
    System.out.println(endpointsResponse);
    assertEquals(1, endpointsResponse.getActiveEpList().size());
    assertEquals(0x8005, (int) endpointsResponse.getClusterId());
    assertEquals(ZdoStatus.SUCCESS, endpointsResponse.getStatus());
    assertEquals(0, (int) endpointsResponse.getNwkAddrOfInterest());
    assertEquals(1, (int) endpointsResponse.getActiveEpList().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)

Example 9 with ZclFieldDeserializer

use of com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer 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());
}
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 10 with ZclFieldDeserializer

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

the class ManagementLqiResponseTest method testReceive.

@Test
public void testReceive() {
    // Short response - ie not extended
    int[] packet = getPacketData("00 00 02 00 02 14 D4 F1 02 00 4B 12 00 0B 88 DC 00 01 88 17 00 8F 22 15 02 01 3B 14 D4 F1 02 00 4B 12 00 EC A1 A5 01 00 8D 15 00 35 38 15 02 01 58");
    ManagementLqiResponse lqiResponse = new ManagementLqiResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    lqiResponse.deserialize(fieldDeserializer);
    System.out.println(lqiResponse);
    assertEquals(2, (int) lqiResponse.getNeighborTableEntries());
    assertEquals(0, (int) lqiResponse.getStartIndex());
    List<NeighborTable> neighbors = lqiResponse.getNeighborTableList();
    assertEquals(2, neighbors.size());
    assertEquals(59, (int) neighbors.get(0).getLqi());
    assertEquals(NeighborTableJoining.UNKNOWN, neighbors.get(0).getPermitJoining());
    assertEquals(1, (int) neighbors.get(0).getDepth());
    assertEquals(NeighborTableRelationship.CHILD, neighbors.get(0).getRelationship());
    assertEquals(LogicalType.ROUTER, neighbors.get(0).getDeviceType());
    assertEquals(NeighborTableRxState.RX_ON, neighbors.get(0).getRxOnWhenIdle());
    assertEquals(new IeeeAddress("0017880100DC880B"), neighbors.get(0).getExtendedAddress());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) NeighborTable(com.zsmartsystems.zigbee.zdo.field.NeighborTable) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) 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