Search in sources :

Example 1 with AttributeStatusRecord

use of com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConfigureReportingResponseTest method testErrorInvalidDataType.

@Test
public void testErrorInvalidDataType() {
    int[] packet = getPacketData("08 6C 07 8D 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.INVALID_DATA_TYPE, 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 2 with AttributeStatusRecord

use of com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord 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)

Aggregations

CommandTest (com.zsmartsystems.zigbee.CommandTest)2 DefaultDeserializer (com.zsmartsystems.zigbee.serialization.DefaultDeserializer)2 ZclFieldDeserializer (com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer)2 ZclHeader (com.zsmartsystems.zigbee.zcl.ZclHeader)2 AttributeStatusRecord (com.zsmartsystems.zigbee.zcl.field.AttributeStatusRecord)2 Test (org.junit.Test)2