gpt4 book ai didi

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

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

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

ZigBeeEndpointAddress.<init>介绍

[英]Constructor for ZDO ZigBee devices where only the address is defined
[中]仅定义地址的ZDO ZigBee设备的构造函数

代码示例

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

/**
 * Gets the endpoint address
 *
 * @return the {@link ZigBeeEndpointAddress}
 */
public ZigBeeEndpointAddress getEndpointAddress() {
  return new ZigBeeEndpointAddress(node.getNetworkAddress(), endpointId);
}

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

/**
 * Enables or disables devices to join the whole network.
 * <p>
 * Devices can only join the network when joining is enabled. It is not advised to leave joining enabled permanently
 * since it allows devices to join the network without the installer knowing.
 *
 * @param duration sets the duration of the join enable. Setting this to 0 disables joining. As per ZigBee 3, a
 *            value of 255 is not permitted and will be ignored.
 * @return {@link ZigBeeStatus} with the status of function
 */
public ZigBeeStatus permitJoin(final int duration) {
  return permitJoin(new ZigBeeEndpointAddress(ZigBeeBroadcastDestination.BROADCAST_ROUTERS_AND_COORD.getKey()),
      duration);
}

代码示例来源:origin: openhab/org.openhab.binding.zigbee

/**
 * Permit joining only for the specified node
 *
 * @param address the 16 bit network address of the node to enable joining
 * @param duration the duration of the join
 */
public boolean permitJoin(IeeeAddress address, int duration) {
  logger.debug("{}: ZigBee join command", address);
  ZigBeeNode node = networkManager.getNode(address);
  if (node == null) {
    logger.debug("{}: ZigBee join command - node not found", address);
    return false;
  }
  logger.debug("{}: ZigBee join command to {}", address, node.getNetworkAddress());
  networkManager.permitJoin(new ZigBeeEndpointAddress(node.getNetworkAddress()), duration);
  return true;
}

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

private void createEndpoint() {
  endpoint = Mockito.mock(ZigBeeEndpoint.class);
  Mockito.when(endpoint.getEndpointId()).thenReturn(5);
  Mockito.when(endpoint.getEndpointAddress()).thenReturn(new ZigBeeEndpointAddress(1234, 5));
  commandCapture = ArgumentCaptor.forClass(ZigBeeCommand.class);
  matcherCapture = ArgumentCaptor.forClass(ZigBeeTransactionMatcher.class);
  Mockito.when(endpoint.sendTransaction(commandCapture.capture(), matcherCapture.capture())).thenReturn(null);
}

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

@Test
public void testCompareToZdo() {
  ZigBeeEndpointAddress address1 = new ZigBeeEndpointAddress(25000);
  ZigBeeEndpointAddress address2 = new ZigBeeEndpointAddress(25000);
  assertEquals(0, address1.compareTo(address2));
  ZigBeeEndpointAddress address3 = new ZigBeeEndpointAddress("25001");
  assertEquals(-1, address1.compareTo(address3));
}

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

@Test
  public void testHashRemove() {
    ZigBeeEndpointAddress address1 = new ZigBeeEndpointAddress("25000/33");
    ZigBeeEndpointAddress address2 = new ZigBeeEndpointAddress("25000/33");
    final Set<ZigBeeEndpointAddress> set = new HashSet<ZigBeeEndpointAddress>();
    set.add(address1);
    set.add(address2);

    assertEquals(1, set.size());
    assertTrue(set.contains(address1));
    assertTrue(set.contains(address2));
    set.remove(address2);
    assertEquals(0, set.size());
  }
}

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

@Test
public void testEquals() {
  ZigBeeEndpointAddress address1 = new ZigBeeEndpointAddress("25000/33");
  ZigBeeEndpointAddress address2 = new ZigBeeEndpointAddress("25000/33");
  assertTrue(address1.equals(address2));
  ZigBeeEndpointAddress address3 = new ZigBeeEndpointAddress("25001/33");
  assertFalse(address1.equals(address3));
  ZigBeeEndpointAddress address4 = new ZigBeeEndpointAddress(25000, 33);
  assertTrue(address1.equals(address4));
}

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

@Test
public void testCompareTo() {
  ZigBeeEndpointAddress address1 = new ZigBeeEndpointAddress("25000/33");
  ZigBeeEndpointAddress address2 = new ZigBeeEndpointAddress("25000/33");
  assertEquals(0, address1.compareTo(address2));
  ZigBeeEndpointAddress address3 = new ZigBeeEndpointAddress("25001/33");
  assertTrue(address1.compareTo(address3) < 0);
  ZigBeeEndpointAddress address4 = new ZigBeeEndpointAddress("24999/33");
  assertTrue(address1.compareTo(address4) > 0);
  ZigBeeEndpointAddress address5 = new ZigBeeEndpointAddress("25000/30");
  assertTrue(address1.compareTo(address5) > 0);
  ZigBeeEndpointAddress address6 = new ZigBeeEndpointAddress("25000/36");
  assertTrue(address1.compareTo(address6) < 0);
}

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

@Test
public void testIsGroup() {
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress("25000/33");
  assertFalse(address.isGroup());
}

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

@Test
public void testToString() {
  String stringAddress = "25000/44";
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress(stringAddress);
  assertEquals(stringAddress, address.toString());
}

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

@Test
public void testMatcherNoMatch() {
  ClusterMatcher matcher = getMatcher();
  matcher.addCluster(0x500);
  List<Integer> clusterListIn = new ArrayList<Integer>();
  List<Integer> clusterListOut = new ArrayList<Integer>();
  MatchDescriptorRequest request = new MatchDescriptorRequest();
  request.setSourceAddress(new ZigBeeEndpointAddress(1234, 5));
  request.setProfileId(0x104);
  request.setInClusterList(clusterListIn);
  request.setOutClusterList(clusterListOut);
  matcher.commandReceived(request);
  assertEquals(0, mockedCommandCaptor.getAllValues().size());
}

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

@Test
public void testMatcherMatchIn() {
  ClusterMatcher matcher = getMatcher();
  matcher.addCluster(0x500);
  matcher.addCluster(0x600);
  List<Integer> clusterListIn = new ArrayList<Integer>();
  List<Integer> clusterListOut = new ArrayList<Integer>();
  clusterListIn.add(0x500);
  MatchDescriptorRequest request = new MatchDescriptorRequest();
  request.setSourceAddress(new ZigBeeEndpointAddress(1234, 5));
  request.setProfileId(0x104);
  request.setInClusterList(clusterListIn);
  request.setOutClusterList(clusterListOut);
  matcher.commandReceived(request);
  assertEquals(1, mockedCommandCaptor.getAllValues().size());
}

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

@Test
public void testConstructor() {
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress(25000, 33);
  assertEquals(25000, address.getAddress());
  assertEquals(33, address.getEndpoint());
}

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

@Test
public void testStringConstructorZdo() {
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress("25000");
  assertEquals(25000, address.getAddress());
  assertEquals(0, address.getEndpoint());
}

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

@Test
public void testStringConstructor() {
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress("25000/33");
  assertEquals(25000, address.getAddress());
  assertEquals(33, address.getEndpoint());
}

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

@Test
public void testConstructorZdo() {
  ZigBeeEndpointAddress address = new ZigBeeEndpointAddress(25000);
  assertEquals(25000, address.getAddress());
  assertEquals(0, address.getEndpoint());
}

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

@Test
public void testSendEndpoint1() {
  MatchDescriptorResponse matchResponse = new MatchDescriptorResponse();
  matchResponse.setStatus(ZdoStatus.SUCCESS);
  List<Integer> matchList = new ArrayList<Integer>();
  matchList.add(1);
  matchResponse.setMatchList(matchList);
  matchResponse.setDestinationAddress(new ZigBeeEndpointAddress(1234, 5));
  matchResponse.setNwkAddrOfInterest(1234);
  System.out.println(matchResponse);
  ZigBeeSerializer serializer = new DefaultSerializer();
  ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
  matchResponse.serialize(fieldSerializer);
  assertTrue(Arrays.equals(getPacketData("00 00 D2 04 01 01"), serializer.getPayload()));
}

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

@Test
  public void testMatch() {
    ZdoTransactionMatcher matcher = new ZdoTransactionMatcher();

    ZdoRequest zdoCommand = new BindRequest();
    BindResponse zdoResponse = new BindResponse();

    zdoCommand.setDestinationAddress(new ZigBeeEndpointAddress(1234));
    zdoResponse.setSourceAddress(new ZigBeeEndpointAddress(1234));
    assertTrue(matcher.isTransactionMatch(zdoCommand, zdoResponse));

    zdoResponse.setSourceAddress(new ZigBeeEndpointAddress(5678));
    assertFalse(matcher.isTransactionMatch(zdoCommand, zdoResponse));

    ZclCommand zclResponse = new OffCommand();
    assertFalse(matcher.isTransactionMatch(zdoCommand, zclResponse));
  }
}

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

@Test
public void testSingle() {
  int[] packet = getPacketData("04 00");
  ReadAttributesCommand command = new ReadAttributesCommand();
  command.setClusterId(0);
  command.setDestinationAddress(new ZigBeeEndpointAddress(57337, 3));
  command.setIdentifiers(Arrays.asList(4));
  command.setTransactionId(1);
  DefaultSerializer serializer = new DefaultSerializer();
  ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
  command.serialize(fieldSerializer);
  assertTrue(Arrays.equals(packet, serializer.getPayload()));
}

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

@Test
  public void testReceive() {
    // Short response - ie not extended
    int[] packet = getPacketData("00 FF 01");

    ManagementPermitJoiningRequest request = new ManagementPermitJoiningRequest();
    request.setDestinationAddress(new ZigBeeEndpointAddress(0));
    request.setTcSignificance(true);
    request.setPermitDuration(255);

    DefaultSerializer serializer = new DefaultSerializer();
    ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);

    request.serialize(fieldSerializer);
    assertTrue(Arrays.equals(packet, serializer.getPayload()));
  }
}

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