gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-14 08:27:31 26 4
gpt4 key购买 nike

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

ZigBeeNetworkManager.addCommandListener介绍

暂无

代码示例

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

/**
 * Constructor
 *
 * @param networkManager the {@link ZigBeeNetworkManager} to which this matcher is linked
 */
public ClusterMatcher(ZigBeeNetworkManager networkManager) {
  logger.debug("ClusterMatcher starting");
  this.networkManager = networkManager;
  networkManager.addCommandListener(this);
}

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

/**
 * Starts up ZigBee network discoverer. This adds a listener to wait for the network to go online.
 */
protected void startup() {
  logger.debug("Network discovery task: starting");
  initialized = true;
  networkManager.addCommandListener(this);
  networkManager.addAnnounceListener(this);
  // Start discovery from root node.
  startNodeDiscovery(0);
}

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

@Override
public ZigBeeStatus extensionStartup() {
  logger.debug("DISCOVERY Extension: Startup");
  networkManager.addNetworkNodeListener(this);
  networkManager.addCommandListener(this);
  networkDiscoverer = new ZigBeeNetworkDiscoverer(networkManager);
  networkDiscoverer.startup();
  if (updatePeriod != 0) {
    startScheduler(10);
  }
  extensionStarted = true;
  return ZigBeeStatus.SUCCESS;
}

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

private ZigBeeNetworkManager mockZigBeeNetworkManager() {
  mockedTransport = Mockito.mock(ZigBeeTransportTransmit.class);
  mockedStateListener = Mockito.mock(ZigBeeNetworkStateListener.class);
  mockedNodeListener = Mockito.mock(ZigBeeNetworkNodeListener.class);
  nodeNodeListenerCapture = new ArrayList<ZigBeeNode>();
  networkStateListenerCapture = new ArrayList<ZigBeeTransportState>();
  final ZigBeeNetworkManager networkManager = new ZigBeeNetworkManager(mockedTransport);
  networkManager.addNetworkNodeListener(mockedNodeListener);
  commandListenerCapture = new ArrayList<>();
  networkManager.addNetworkNodeListener(this);
  networkManager.addNetworkStateListener(this);
  networkManager.addCommandListener(this);
  Mockito.when(mockedTransport.setZigBeeChannel(ArgumentMatchers.any(ZigBeeChannel.class)))
      .thenReturn(ZigBeeStatus.SUCCESS);
  Mockito.when(mockedTransport.setZigBeePanId(ArgumentMatchers.anyInt())).thenReturn(ZigBeeStatus.SUCCESS);
  Mockito.when(mockedTransport.setZigBeeExtendedPanId(ArgumentMatchers.any(ExtendedPanId.class)))
      .thenReturn(ZigBeeStatus.SUCCESS);
  Mockito.when(mockedTransport.getZigBeePanId()).thenReturn(0xFFFFABCD);
  Mockito.when(mockedTransport.getZigBeeChannel()).thenReturn(ZigBeeChannel.CHANNEL_11);
  Mockito.when(mockedTransport.getZigBeeExtendedPanId()).thenReturn(new ExtendedPanId("1"));
  mockedApsFrameListener = ArgumentCaptor.forClass(ZigBeeApsFrame.class);
  Mockito.doNothing().when(mockedTransport).sendCommand(mockedApsFrameListener.capture());
  return networkManager;
}

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

networkManager.addCommandListener(new ZigBeeCommandListener() {
  @Override
  public void commandReceived(ZigBeeCommand command) {

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

.addNetworkNodeListener(ArgumentMatchers.any(ZigBeeNetworkNodeListener.class));
Mockito.verify(networkManager, Mockito.timeout(1000).atLeast(1))
    .addCommandListener(ArgumentMatchers.any(ZigBeeCommandListener.class));

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

@Test
public void testNormal() {
  // Add all the required responses to a list
  IeeeAddressResponse ieeeResponse = new IeeeAddressResponse();
  ieeeResponse.setStatus(ZdoStatus.SUCCESS);
  ieeeResponse.setSourceAddress(new ZigBeeEndpointAddress(0));
  ieeeResponse.setDestinationAddress(new ZigBeeEndpointAddress(0));
  ieeeResponse.setIeeeAddrRemoteDev(new IeeeAddress("1234567890ABCDEF"));
  responses.put(ZdoCommandType.IEEE_ADDRESS_REQUEST.getClusterId(), ieeeResponse);
  ZigBeeNetworkDiscoverer discoverer = new ZigBeeNetworkDiscoverer(networkManager);
  discoverer.setRetryPeriod(1);
  discoverer.startup();
  // Check it registers listeners
  Mockito.verify(networkManager).addCommandListener(discoverer);
  Mockito.verify(networkManager).addAnnounceListener(discoverer);
  // Then wait for the node to be added
  Mockito.verify(networkManager, Mockito.timeout(TIMEOUT).times(1)).addNode(nodeCapture.capture());
  ZigBeeNode node = nodeCapture.getValue();
  assertNotNull(node);
  assertEquals(Integer.valueOf(0), node.getNetworkAddress());
  assertEquals(new IeeeAddress("1234567890ABCDEF"), node.getIeeeAddress());
  assertEquals(0, node.getEndpoints().size());
}

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