gpt4 book ai didi

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

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

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

ZigBeeTransportTransmit.getNwkAddress介绍

[英]Returns the network address of the local device
[中]返回本地设备的网络地址

代码示例

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

private void addLocalNode() {
  Integer nwkAddress = transport.getNwkAddress();
  IeeeAddress ieeeAddress = transport.getIeeeAddress();
  if (nwkAddress != null && ieeeAddress != null) {
    ZigBeeNode node = getNode(ieeeAddress);
    if (node == null) {
      logger.debug("{}: Adding local node to network, NWK={}", ieeeAddress, nwkAddress);
      node = new ZigBeeNode(this, ieeeAddress);
      node.setNetworkAddress(nwkAddress);
      addNode(node);
    }
  }
}

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

localNwkAddress = transport.getNwkAddress();
localIeeeAddress = transport.getIeeeAddress();

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

@Test
public void initialize() {
  ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class);
  Mockito.when(transport.initialize()).thenReturn(ZigBeeStatus.COMMUNICATION_ERROR);
  ZigBeeNetworkManager manager = new ZigBeeNetworkManager(transport);
  ZigBeeStatus response = manager.initialize();
  assertEquals(ZigBeeStatus.COMMUNICATION_ERROR, response);
  transport = Mockito.mock(ZigBeeTransportTransmit.class);
  Mockito.when(transport.initialize()).thenReturn(ZigBeeStatus.SUCCESS);
  Mockito.when(transport.getNwkAddress()).thenReturn(Integer.valueOf(123));
  Mockito.when(transport.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF"));
  manager = new ZigBeeNetworkManager(transport);
  response = manager.initialize();
  assertEquals(ZigBeeStatus.SUCCESS, response);
  ZigBeeNode node = manager.getNode(new IeeeAddress("1234567890ABCDEF"));
  assertNotNull(node);
  assertEquals(Integer.valueOf(123), node.getNetworkAddress());
  manager.shutdown();
  Mockito.verify(transport, Mockito.times(1)).shutdown();
}

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

@Test
public void testNetworkStateListener() {
  // ZigBeeNetworkManager networkManager = mockZigBeeNetworkManager();
  ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class);
  ZigBeeNetworkManager manager = new ZigBeeNetworkManager(transport);
  ZigBeeNetworkStateListener stateListener = Mockito.mock(ZigBeeNetworkStateListener.class);
  manager.addNetworkStateListener(stateListener);
  Mockito.when(transport.getNwkAddress()).thenReturn(Integer.valueOf(123));
  Mockito.when(transport.getIeeeAddress()).thenReturn(new IeeeAddress("1234567890ABCDEF"));
  // This will be ignored as an illegal state transition
  manager.setNetworkState(ZigBeeTransportState.INITIALISING);
  manager.setNetworkState(ZigBeeTransportState.UNINITIALISED);
  Mockito.verify(stateListener, Mockito.timeout(TIMEOUT)).networkStateUpdated(ZigBeeTransportState.UNINITIALISED);
  manager.setNetworkState(ZigBeeTransportState.INITIALISING);
  Mockito.verify(stateListener, Mockito.timeout(TIMEOUT)).networkStateUpdated(ZigBeeTransportState.INITIALISING);
  manager.setNetworkState(ZigBeeTransportState.ONLINE);
  Mockito.verify(stateListener, Mockito.timeout(TIMEOUT)).networkStateUpdated(ZigBeeTransportState.ONLINE);
  assertEquals(Integer.valueOf(123), manager.getLocalNwkAddress());
  assertEquals(new IeeeAddress("1234567890ABCDEF"), manager.getLocalIeeeAddress());
  manager.removeNetworkStateListener(mockedStateListener);
}

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

/**
   * Tests that after {@link ZigBeeTransportTransmit#startup()} has been called,
   * {@link ZigBeeTransportTransmit#getNwkAddress()} does not return null.
   */
  @Test
  public void getNwkAddress() {
    assertEquals(ZigBeeStatus.SUCCESS, transport.initialize());
    assertEquals(ZigBeeStatus.SUCCESS, transport.startup(false));
    assertNotNull(transport.getNwkAddress());
  }
}

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