com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(13.8k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer.<init>()方法的一些代码示例,展示了ZclFieldDeserializer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclFieldDeserializer.<init>()方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.ZclFieldDeserializer
类名称:ZclFieldDeserializer
方法名:<init>

ZclFieldDeserializer.<init>介绍

[英]Constructor for setting the payload and start index.
[中]用于设置有效负载和启动索引的构造函数。

代码示例

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testReceiveNull() {
  int[] packet = getPacketData("01 00 86");
  ReadAttributesResponse response = new ReadAttributesResponse();
  DefaultDeserializer deserializer = new DefaultDeserializer(packet);
  ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
  response.deserialize(fieldDeserializer);
  System.out.println(response);
  List<ReadAttributeStatusRecord> records = response.getRecords();
  ReadAttributeStatusRecord record = records.get(0);
  assertEquals(ZclStatus.UNSUPPORTED_ATTRIBUTE, record.getStatus());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void test() {
  int[] packet = getPacketData("09 63 01 0D 00 4E 10");
  ZoneEnrollRequestCommand command = new ZoneEnrollRequestCommand();
  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(13), command.getZoneType());
  assertEquals(Integer.valueOf(4174), command.getManufacturerCode());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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));
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testReceive() {
  int[] packet = getPacketData("01");
  DiscoverCommandsGeneratedResponse response = new DiscoverCommandsGeneratedResponse();
  DefaultDeserializer deserializer = new DefaultDeserializer(packet);
  ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
  response.deserialize(fieldDeserializer);
  System.out.println(response);
  assertNull(response.getCommandIdentifiers());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testReceive() {
  int[] packet = getPacketData("00 02 00 21 03 00 21 04 00 21 07 00 21 08 00 30");
  DiscoverAttributesResponse response = new DiscoverAttributesResponse();
  DefaultDeserializer deserializer = new DefaultDeserializer(packet);
  ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
  response.deserialize(fieldDeserializer);
  System.out.println(response);
  List<AttributeInformation> records = response.getAttributeInformation();
  assertEquals(5, records.size());
  AttributeInformation record = records.get(0);
  assertEquals(ZclDataType.UNSIGNED_16_BIT_INTEGER, record.getDataType());
  assertEquals(2, record.getIdentifier());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
  public void testReceiveNotSupported() {
    int[] packet = getPacketData("84 84");

    PowerDescriptorResponse descriptorResponse = new PowerDescriptorResponse();

    DefaultDeserializer deserializer = new DefaultDeserializer(packet);
    ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);

    descriptorResponse.deserialize(fieldDeserializer);

    System.out.println(descriptorResponse);
    assertEquals(ZdoStatus.NOT_SUPPORTED, descriptorResponse.getStatus());

    PowerDescriptor powerDescriptor = descriptorResponse.getPowerDescriptor();
    assertEquals(null, powerDescriptor);
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testReceiveError() {
  // int[] packet = getPacketData("00 00 00 00 10 C1");
  int[] packet = getPacketData("00 81 00 01");
  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();
  assertNull(simpleDescriptor);
  assertEquals(ZdoStatus.DEVICE_NOT_FOUND, descriptorResponse.getStatus());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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));
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@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());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testDeserialize2() {
  int[] packet = getPacketData("08 99 88");
  DefaultDeserializer deserializer = new DefaultDeserializer(packet);
  ZclFieldDeserializer fieldDeserializer = new ZclFieldDeserializer(deserializer);
  ZclHeader zclHeader = new ZclHeader(fieldDeserializer);
  System.out.println(zclHeader);
  assertEquals(0x88, zclHeader.getCommandId());
  assertEquals(ZclFrameType.ENTIRE_PROFILE_COMMAND, zclHeader.getFrameType());
  assertEquals(false, zclHeader.isManufacturerSpecific());
  assertEquals(false, zclHeader.isDisableDefaultResponse());
  assertEquals(0x99, zclHeader.getSequenceNumber());
  DefaultSerializer serializer = new DefaultSerializer();
  ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
  assertTrue(Arrays.equals(packet, zclHeader.serialize(fieldSerializer, new int[] {})));
}

相关文章