gpt4 book ai didi

com.zsmartsystems.zigbee.zcl.ZclCluster.getAttribute()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 15:53:31 25 4
gpt4 key购买 nike

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

ZclCluster.getAttribute介绍

[英]Gets an attribute from the attribute ID
[中]从属性ID获取属性

代码示例

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);
Object reportableChange = null;
if (args.length > 4) {
ZclAttribute zclAttribute = cluster.getAttribute(attributeId);
if (zclAttribute == null) {
  out.println("Attribute not known.");

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

@Override
  public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
      throws IllegalArgumentException, InterruptedException, ExecutionException {
    if (args.length != 3) {
      throw new IllegalArgumentException("Invalid number of arguments");
    }

    final ZigBeeEndpoint endpoint = getEndpoint(networkManager, args[1]);
    ZclCluster cluster = getCluster(endpoint, args[2]);

    final Future<Boolean> future = cluster.discoverAttributes(false);
    Boolean result = future.get();
    if (result) {
      out.println("Supported attributes for " + printCluster(cluster));
      out.println("AttrId  Data Type                  Name");
      for (Integer attributeId : cluster.getSupportedAttributes()) {
        out.print(" ");
        ZclAttribute attribute = cluster.getAttribute(attributeId);
        out.print(printAttributeId(attributeId));
        if (attribute != null) {
          out.print("  " + printZclDataType(attribute.getDataType()) + "  " + attribute.getName());
        }
        out.println();
      }
    } else {
      out.println("Failed to retrieve supported attributes");
    }
  }
}

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);
Object reportableChange = null;
if (args.length > 6) {
ZclAttribute zclAttribute = cluster.getAttribute(attributeId);
if (zclAttribute == null) {
  out.println("Attribute not known.");

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);
if (attribute == null) {
  throw new IllegalArgumentException(

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);
if (attribute == null) {
  throw new IllegalArgumentException("Could not find attribute with ID " + attributeId);

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

final ZclAttribute attribute = cluster.getAttribute(attributeId);
if (attribute == null) {
  throw new IllegalArgumentException(

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

ZclAttribute attribute = cluster.getAttribute(attributeId);
if (attribute == null) {
  attributeName = "Attribute " + attributeId;

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

@Test
public void getReporting() {
  createEndpoint();
  ZclCluster cluster = new ZclOnOffCluster(endpoint);
  ZclAttribute attribute = cluster.getAttribute(0);
  cluster.getReporting(attribute);
  assertEquals(1, commandCapture.getAllValues().size());
  ZigBeeCommand command = commandCapture.getValue();
  assertNotNull(command);
  System.out.println(command);
  assertTrue(command instanceof ReadReportingConfigurationCommand);
  ReadReportingConfigurationCommand cfgCommand = (ReadReportingConfigurationCommand) command;
  assertEquals(1, cfgCommand.getRecords().size());
  AttributeRecord record = cfgCommand.getRecords().get(0);
  assertEquals(0, record.getAttributeIdentifier());
  assertEquals(0, record.getDirection());
}

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

@Test
public void setReporting() {
  createEndpoint();
  ZclCluster cluster = new ZclOnOffCluster(endpoint);
  ZclAttribute attribute = cluster.getAttribute(0);
  cluster.setReporting(attribute, 22, 33);
  assertEquals(1, commandCapture.getAllValues().size());
  ZigBeeCommand command = commandCapture.getValue();
  assertNotNull(command);
  System.out.println(command);
  assertTrue(command instanceof ConfigureReportingCommand);
  ConfigureReportingCommand cfgCommand = (ConfigureReportingCommand) command;
  assertEquals(1, cfgCommand.getRecords().size());
  AttributeReportingConfigurationRecord record = cfgCommand.getRecords().get(0);
  assertEquals(0, record.getAttributeIdentifier());
  assertEquals(0, record.getDirection());
}

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

@Test
public void handleAttributeReport() {
  createEndpoint();
  ZclCluster cluster = new ZclOnOffCluster(endpoint);
  ZclAttributeListener listenerMock = Mockito.mock(ZclAttributeListener.class);
  ArgumentCaptor<ZclAttribute> attributeCapture = ArgumentCaptor.forClass(ZclAttribute.class);
  cluster.addAttributeListener(listenerMock);
  cluster.addAttributeListener(listenerMock);
  List<AttributeReport> attributeList = new ArrayList<AttributeReport>();
  AttributeReport report;
  report = new AttributeReport();
  report.setAttributeDataType(ZclDataType.SIGNED_8_BIT_INTEGER);
  report.setAttributeIdentifier(0);
  report.setAttributeValue(Integer.valueOf(1));
  System.out.println(report);
  attributeList.add(report);
  cluster.handleAttributeReport(attributeList);
  ZclAttribute attribute = cluster.getAttribute(0);
  assertTrue(attribute.getLastValue() instanceof Boolean);
  Mockito.verify(listenerMock, Mockito.timeout(1000).times(1)).attributeUpdated(attributeCapture.capture());
  attribute = attributeCapture.getValue();
  assertTrue(attribute.getLastValue() instanceof Boolean);
  assertEquals(ZclDataType.BOOLEAN, attribute.getDataType());
  assertEquals(0, attribute.getId());
  assertEquals(true, attribute.getLastValue());
  cluster.removeAttributeListener(listenerMock);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com