Search in sources :

Example 16 with ZclFieldDeserializer

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

the class NetworkAddressResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 43 1D A5 00 AA 3E B0 7C 74 3B");
    NetworkAddressResponse addressResponse = new NetworkAddressResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    addressResponse.deserialize(fieldDeserializer);
    System.out.println(addressResponse);
    assertEquals(new IeeeAddress("7CB03EAA00A51D43"), addressResponse.getIeeeAddrRemoteDev());
    assertEquals(0x8000, (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 17 with ZclFieldDeserializer

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

the class PowerDescriptorResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 00 00 10 C1");
    PowerDescriptorResponse descriptorResponse = new PowerDescriptorResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    descriptorResponse.deserialize(fieldDeserializer);
    System.out.println(descriptorResponse);
    PowerDescriptor powerDescriptor = descriptorResponse.getPowerDescriptor();
    assertEquals(ZdoStatus.SUCCESS, descriptorResponse.getStatus());
    assertEquals(PowerLevelType.FULL, powerDescriptor.getPowerLevel());
    assertEquals(CurrentPowerModeType.RECEIVER_ON_IDLE, powerDescriptor.getCurrentPowerMode());
    assertEquals(PowerSourceType.MAINS, powerDescriptor.getCurrentPowerSource());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) PowerDescriptor(com.zsmartsystems.zigbee.zdo.field.PowerDescriptor) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 18 with ZclFieldDeserializer

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

the class SimpleDescriptorResponseTest method testReceive.

@Test
public void testReceive() {
    int[] packet = getPacketData("00 00 00 00 14 01 04 01 00 00 00 03 00 00 01 00 06 00 03 00 00 01 00 06 00");
    SimpleDescriptorResponse descriptorResponse = new SimpleDescriptorResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    descriptorResponse.deserialize(fieldDeserializer);
    System.out.println(descriptorResponse);
    SimpleDescriptor simpleDescriptor = descriptorResponse.getSimpleDescriptor();
    assertEquals(ZdoStatus.SUCCESS, descriptorResponse.getStatus());
    assertEquals(0, (int) descriptorResponse.getNwkAddrOfInterest());
    assertEquals(1, simpleDescriptor.getEndpoint());
    assertEquals(0x104, simpleDescriptor.getProfileId());
    assertEquals(3, simpleDescriptor.getInputClusterList().size());
    assertTrue(simpleDescriptor.getInputClusterList().contains(0));
    assertTrue(simpleDescriptor.getInputClusterList().contains(1));
    assertTrue(simpleDescriptor.getInputClusterList().contains(6));
    assertEquals(3, simpleDescriptor.getOutputClusterList().size());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) SimpleDescriptor(com.zsmartsystems.zigbee.zdo.field.SimpleDescriptor) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 19 with ZclFieldDeserializer

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

the class ConfigureReportingResponseTest method test.

@Test
public void test() {
    int[] packet = getPacketData("18 1B 07 00 00 00 00");
    ConfigureReportingResponse response = new ConfigureReportingResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
    System.out.println(zclHeader);
    response.deserialize(fieldDeserializer);
    System.out.println(response);
    assertNull(response.getStatus());
    assertEquals(1, response.getRecords().size());
    AttributeStatusRecord record = response.getRecords().get(0);
    assertEquals(0, record.getAttributeIdentifier());
    assertEquals(ZclStatus.SUCCESS, record.getStatus());
}
Also used : DefaultDeserializer(com.zsmartsystems.zigbee.serialization.DefaultDeserializer) ZclFieldDeserializer(com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer) AttributeStatusRecord(com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord) ZclHeader(com.zsmartsystems.zigbee.zcl.ZclHeader) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Example 20 with ZclFieldDeserializer

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

the class ConfigureReportingResponseTest method testStatusOnly.

@Test
public void testStatusOnly() {
    int[] packet = getPacketData("18 11 07 00");
    ConfigureReportingResponse response = new ConfigureReportingResponse();
    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
    ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
    System.out.println(zclHeader);
    response.deserialize(fieldDeserializer);
    System.out.println(response);
    assertEquals(ZclStatus.SUCCESS, response.getStatus());
    assertNull(response.getRecords());
}
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)

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