gpt4 book ai didi

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

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

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

ZigBeeTransportTransmit.initialize介绍

[英]Initialize the transport interface. Following the call to initialize the configuration methods may be used to configure the transport layer.

During the initialize() method, the provider must initialize the ports and perform any configuration required to get the stack ready for use. If the dongle has already joined a network, then this method will return ZigBeeStatus#SUCCESS.

At the completion of the initialize method, the #getIeeeAddress() method must return the valid address for the coordinator.
[中]初始化传输接口。在调用初始化之后,可以使用配置方法来配置传输层。
在initialize()方法期间,提供程序必须初始化端口,并执行使堆栈准备好使用所需的任何配置。如果加密狗已加入网络,则此方法将返回ZigBeeStatus#SUCCESS。
初始化方法完成时,#getIeeeAddress()方法必须返回协调器的有效地址。

代码示例

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

@Test
public void getTransportVersionString() {
  ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class);
  Mockito.when(transport.initialize()).thenReturn(ZigBeeStatus.COMMUNICATION_ERROR);
  ZigBeeNetworkManager manager = new ZigBeeNetworkManager(transport);
  Mockito.when(transport.getVersionString()).thenReturn("Version!");
  assertEquals("Version!", manager.getTransportVersionString());
}

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

@Test
public void startup() {
  ZigBeeTransportTransmit transport = Mockito.mock(ZigBeeTransportTransmit.class);
  Mockito.when(transport.initialize()).thenReturn(ZigBeeStatus.COMMUNICATION_ERROR);
  ZigBeeNetworkManager manager = new ZigBeeNetworkManager(transport);
  assertEquals(transport, manager.getZigBeeTransport());
  Mockito.when(transport.startup(false)).thenReturn(ZigBeeStatus.COMMUNICATION_ERROR);
  Mockito.when(transport.startup(true)).thenReturn(ZigBeeStatus.SUCCESS);
  assertEquals(ZigBeeStatus.COMMUNICATION_ERROR, manager.startup(false));
  Mockito.verify(transport, Mockito.times(1)).startup(false);
  assertEquals(ZigBeeStatus.SUCCESS, manager.startup(true));
  Mockito.verify(transport, Mockito.times(1)).startup(true);
}

代码示例来源: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

ZigBeeStatus transportResponse = transport.initialize();
if (transportResponse != ZigBeeStatus.SUCCESS) {
  setNetworkState(ZigBeeTransportState.OFFLINE);

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

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

代码示例来源: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