本文整理了Java中com.zsmartsystems.zigbee.transport.ZigBeeTransportTransmit.getIeeeAddress()
方法的一些代码示例,展示了ZigBeeTransportTransmit.getIeeeAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeTransportTransmit.getIeeeAddress()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.transport.ZigBeeTransportTransmit
类名称:ZigBeeTransportTransmit
方法名:getIeeeAddress
[英]Returns the IeeeAddress of the local device
[中]返回本地设备的IeeeAddress
代码示例来源: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
localIeeeAddress = transport.getIeeeAddress();
代码示例来源: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
@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);
}
内容来源于网络,如有侵权,请联系作者删除!