gpt4 book ai didi

com.zsmartsystems.zigbee.ZigBeeGroupAddress.getLabel()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 11:45:31 26 4
gpt4 key购买 nike

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

ZigBeeGroupAddress.getLabel介绍

[英]Gets group label.
[中]获取组标签。

代码示例

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

/**
   * {@inheritDoc}
   */
  @Override
  public boolean process(final ZigBeeApi zigbeeApi, final String[] args, PrintStream out) {
    final List<ZigBeeGroupAddress> groups = zigbeeApi.getGroups();
    for (final ZigBeeGroupAddress group : groups) {
      print(StringUtils.leftPad(Integer.toString(group.getGroupId()), 10) + "      " + group.getLabel(), out);
    }
    return true;
  }
}

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

/**
 * Gets destination by device identifier or group ID.
 *
 * @param zigbeeApi the ZigBee API
 * @param destinationIdentifier the device identifier or group ID
 * @return the device
 */
private ZigBeeAddress getDestination(final ZigBeeApi zigbeeApi, final String destinationIdentifier,
    final PrintStream out) {
  final ZigBeeEndpoint device = getDevice(zigbeeApi, destinationIdentifier);
  if (device != null) {
    return device.getEndpointAddress();
  }
  try {
    for (final ZigBeeGroupAddress group : zigbeeApi.getGroups()) {
      if (destinationIdentifier.equals(group.getLabel())) {
        return group;
      }
    }
    final int groupId = Integer.parseInt(destinationIdentifier);
    return zigbeeApi.getGroup(groupId);
  } catch (final NumberFormatException e) {
    return null;
  }
}

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

@Test
public void testAddRemoveGroup() {
  ZigBeeNetworkManager networkManager = mockZigBeeNetworkManager();
  networkManager.addGroup(new ZigBeeGroupAddress(1));
  assertEquals(1, networkManager.getGroups().size());
  networkManager.addGroup(new ZigBeeGroupAddress(1));
  assertEquals(1, networkManager.getGroups().size());
  networkManager.addGroup(new ZigBeeGroupAddress(2));
  assertEquals(2, networkManager.getGroups().size());
  networkManager.removeGroup(2);
  assertEquals(1, networkManager.getGroups().size());
  assertNull(networkManager.getGroup(1).getLabel());
  ZigBeeGroupAddress group = networkManager.getGroup(1);
  assertEquals(1, group.getGroupId());
  group.setLabel("Group Label");
  networkManager.updateGroup(group);
  assertEquals(1, networkManager.getGroups().size());
  assertEquals("Group Label", networkManager.getGroup(1).getLabel());
}

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

@Test
  public void testGroupAddress() {
    ZigBeeGroupAddress group1 = new ZigBeeGroupAddress(1);
    assertTrue(group1.isGroup());

    ZigBeeGroupAddress group2 = new ZigBeeGroupAddress(1);
    assertTrue(group1.equals(group2));
    assertEquals(0, group1.compareTo(group2));
    assertEquals(1, group1.getGroupId());

    // Test that label doesn't matter
    group2 = new ZigBeeGroupAddress(1, "Test Label");
    assertTrue(group1.equals(group2));
    assertEquals("Test Label", group2.getLabel());

    group2 = new ZigBeeGroupAddress();
    group2.setGroupId(1);
    assertEquals(1, group1.getGroupId());
    group2.setLabel("Test Label");
    assertEquals("Test Label", group2.getLabel());

    group2.setGroupId(2);
    assertEquals(1, group1.compareTo(group2));

    System.out.println(group2);
  }
}

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