From c5f22703a9dda65a9f9e420e051d24e02573c659 Mon Sep 17 00:00:00 2001 From: Diego Escalona Date: Mon, 8 Jul 2019 10:27:03 +0200 Subject: [PATCH] devices: remove casts to XBeeDevice class - New extensions or layers of the XBee Java library (such as the XBee Library for Android) can add new devices extending the AbstractXBeeDevice class. This means that we cannot expect to always have an XBeeDevice object in internal constructors or methods of the library. Thus, all casts to XBeeDevice had to disappear. - In order to remove casts to XBeeDevice, most methods and constructors that where using an XBeeDevice as parameter had to change to AbstractXBeeDevice. XBeeDevice inherits from AbstractXBeeDevice, so there shouldn't be any problem with examples or code already written by clients. - Moved the class DataReader to the root path of the library so that it can access the protected method 'getNetwork()' of XBee devices. DataReader is an internal class used by the AbstractXBeeDevice one. So again, there shouldn't be any problem with code already written. - Added IllegalArgumentException to some methods and constructors that are now using the AbstractXBeeDevice as parameter when the AbstractXBeeDevice is a remote device. - Updated references in test cases. Signed-off-by: Diego Escalona --- .../com/digi/xbee/api/AbstractXBeeDevice.java | 37 +++--- .../xbee/api/BluetoothAuthentication.java | 9 +- .../xbee/api/{connection => }/DataReader.java | 20 ++- .../java/com/digi/xbee/api/NodeDiscovery.java | 13 +- .../digi/xbee/api/RemoteDigiMeshDevice.java | 8 +- .../digi/xbee/api/RemoteDigiPointDevice.java | 8 +- .../com/digi/xbee/api/RemoteRaw802Device.java | 8 +- .../com/digi/xbee/api/RemoteThreadDevice.java | 16 +-- .../com/digi/xbee/api/RemoteXBeeDevice.java | 12 +- .../com/digi/xbee/api/RemoteZigBeeDevice.java | 8 +- .../java/com/digi/xbee/api/XBeeNetwork.java | 13 +- .../digi/xbee/api/IPDeviceReadDataTest.java | 5 +- .../digi/xbee/api/IPv6DeviceReadDataTest.java | 5 +- .../api/Remote802DeviceReadInfo16BitTest.java | 6 +- .../api/RemoteXBeeDeviceInstantiateTest.java | 12 +- .../digi/xbee/api/XBeeDeviceConnectTest.java | 5 +- .../XBeeDeviceDetermineOperatingModeTest.java | 5 +- .../digi/xbee/api/XBeeDeviceReadDataTest.java | 5 +- .../api/XBeeNetworkConfigurationTest.java | 6 +- ...aderGetRemoteXBeeDeviceFromPacketTest.java | 5 +- .../xbee/api/connection/DataReaderTest.java | 115 +++++++++--------- .../IDataReceiveListener802Test.java | 14 +-- .../IDataReceiveListenerXBeeTest.java | 16 +-- .../IExplicitDataReceiveListenerTest.java | 12 +- .../IIOSampleReceiveListener802Test.java | 4 +- .../IIOSampleReceiveListenerXBeeTest.java | 6 +- .../IIPDataReceiveListenerIPv6Test.java | 12 +- .../listeners/IIPDataReceiveListenerTest.java | 12 +- .../IModemStatusReceiveListenerTest.java | 12 +- .../listeners/IPacketReceiveListenerTest.java | 14 +-- .../listeners/ISMSReceiveListenerTest.java | 12 +- 31 files changed, 219 insertions(+), 216 deletions(-) rename library/src/main/java/com/digi/xbee/api/{connection => }/DataReader.java (99%) diff --git a/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java b/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java index fb0f0f03..f32d1971 100644 --- a/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java +++ b/library/src/main/java/com/digi/xbee/api/AbstractXBeeDevice.java @@ -30,7 +30,6 @@ import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.connection.bluetooth.AbstractBluetoothInterface; import com.digi.xbee.api.connection.ConnectionType; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortParameters; import com.digi.xbee.api.exceptions.ATCommandException; import com.digi.xbee.api.exceptions.BluetoothAuthenticationException; @@ -211,8 +210,8 @@ public abstract class AbstractXBeeDevice { * * @see #AbstractXBeeDevice(IConnectionInterface) * @see #AbstractXBeeDevice(String, SerialPortParameters) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress, XBee16BitAddress, String) * @see #AbstractXBeeDevice(String, int, int, int, int, int) */ public AbstractXBeeDevice(String port, int baudRate) { @@ -240,8 +239,8 @@ public AbstractXBeeDevice(String port, int baudRate) { * @see #AbstractXBeeDevice(IConnectionInterface) * @see #AbstractXBeeDevice(String, int) * @see #AbstractXBeeDevice(String, SerialPortParameters) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress, XBee16BitAddress, String) */ public AbstractXBeeDevice(String port, int baudRate, int dataBits, int stopBits, int parity, int flowControl) { this(port, new SerialPortParameters(baudRate, dataBits, stopBits, parity, flowControl)); @@ -259,8 +258,8 @@ public AbstractXBeeDevice(String port, int baudRate, int dataBits, int stopBits, * * @see #AbstractXBeeDevice(IConnectionInterface) * @see #AbstractXBeeDevice(String, int) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress, XBee16BitAddress, String) * @see #AbstractXBeeDevice(String, int, int, int, int, int) * @see com.digi.xbee.api.connection.serial.SerialPortParameters */ @@ -279,8 +278,8 @@ public AbstractXBeeDevice(String port, SerialPortParameters serialPortParameters * * @see #AbstractXBeeDevice(String, int) * @see #AbstractXBeeDevice(String, SerialPortParameters) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress, XBee16BitAddress, String) * @see #AbstractXBeeDevice(String, int, int, int, int, int) * @see com.digi.xbee.api.connection.IConnectionInterface */ @@ -311,11 +310,11 @@ public AbstractXBeeDevice(IConnectionInterface connectionInterface) { * @see #AbstractXBeeDevice(IConnectionInterface) * @see #AbstractXBeeDevice(String, int) * @see #AbstractXBeeDevice(String, SerialPortParameters) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress, XBee16BitAddress, String) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress, XBee16BitAddress, String) * @see #AbstractXBeeDevice(String, int, int, int, int, int) * @see com.digi.xbee.api.models.XBee16BitAddress */ - public AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { + public AbstractXBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64) { this(localXBeeDevice, addr64, null, null); } @@ -340,12 +339,12 @@ public AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { * @see #AbstractXBeeDevice(IConnectionInterface) * @see #AbstractXBeeDevice(String, int) * @see #AbstractXBeeDevice(String, SerialPortParameters) - * @see #AbstractXBeeDevice(XBeeDevice, XBee64BitAddress) + * @see #AbstractXBeeDevice(AbstractXBeeDevice, XBee64BitAddress) * @see #AbstractXBeeDevice(String, int, int, int, int, int) * @see com.digi.xbee.api.models.XBee16BitAddress * @see com.digi.xbee.api.models.XBee64BitAddress */ - public AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, + public AbstractXBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, XBee16BitAddress addr16, String id) { if (localXBeeDevice == null) throw new NullPointerException("Local XBee device cannot be null."); @@ -388,7 +387,7 @@ public AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, * * @since 1.2.1 */ - public AbstractXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { + public AbstractXBeeDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { this(localXBeeDevice, ipv6Addr, null); } @@ -416,7 +415,7 @@ public AbstractXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { * * @since 1.2.1 */ - public AbstractXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr, String id) { + public AbstractXBeeDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr, String id) { if (localXBeeDevice == null) throw new NullPointerException("Local XBee device cannot be null."); if (ipv6Addr == null) @@ -3112,7 +3111,7 @@ protected void open() throws XBeeException { logger.info(toString() + "Connection interface open."); // Initialize the data reader. - dataReader = new DataReader(connectionInterface, operatingMode, (XBeeDevice)this); + dataReader = new DataReader(connectionInterface, operatingMode, this); dataReader.start(); // Wait 10 milliseconds until the dataReader thread is started. @@ -3132,7 +3131,7 @@ protected void open() throws XBeeException { // Perform the Bluetooth authentication. try { logger.info(toString() + "Starting Bluetooth authentication..."); - BluetoothAuthentication auth = new BluetoothAuthentication((XBeeDevice)this, bluetoothPassword); + BluetoothAuthentication auth = new BluetoothAuthentication(this, bluetoothPassword); auth.authenticate(); ((AbstractBluetoothInterface) connectionInterface).setEncryptionKeys(auth.getKey(), auth.getTxNonce(), auth.getRxNonce()); logger.info(toString() + "Authentication finished successfully."); @@ -3313,7 +3312,7 @@ protected XBeeNetwork getNetwork() { throw new InterfaceNotOpenException(); if (network == null) - network = new XBeeNetwork((XBeeDevice)this); + network = new XBeeNetwork(this); return network; } @@ -4833,7 +4832,7 @@ private ExplicitXBeeMessage readExplicitDataPacket(RemoteXBeeDevice remoteXBeeDe if (remoteXBeeDevice != null) remoteDevice = remoteXBeeDevice; else - remoteDevice = new RemoteXBeeDevice((XBeeDevice)this, explicitDataPacket.get64BitSourceAddress()); + remoteDevice = new RemoteXBeeDevice(this, explicitDataPacket.get64BitSourceAddress()); getNetwork().addRemoteDevice(remoteDevice); } int sourceEndpoint = explicitDataPacket.getSourceEndpoint(); diff --git a/library/src/main/java/com/digi/xbee/api/BluetoothAuthentication.java b/library/src/main/java/com/digi/xbee/api/BluetoothAuthentication.java index a5c58c4b..669f187e 100644 --- a/library/src/main/java/com/digi/xbee/api/BluetoothAuthentication.java +++ b/library/src/main/java/com/digi/xbee/api/BluetoothAuthentication.java @@ -61,7 +61,7 @@ class BluetoothAuthentication { private static final int LENGTH_NONCE = 12; // Variables. - private final XBeeDevice device; + private final AbstractXBeeDevice device; private final String password; private final Object unlockLock = new Object(); @@ -82,10 +82,15 @@ class BluetoothAuthentication { * Class constructor. Instantiates a new {@code BluetoothAuthentication} * object with the given parameters. * + * @throws IllegalArgumentException If {@code device.isRemote() == true}. + * * @param device XBee device. * @param password Bluetooth password. */ - BluetoothAuthentication(XBeeDevice device, String password) { + BluetoothAuthentication(AbstractXBeeDevice device, String password) { + if (device.isRemote()) + throw new IllegalArgumentException("The given local XBee device is remote."); + this.device = device; this.password = password; diff --git a/library/src/main/java/com/digi/xbee/api/connection/DataReader.java b/library/src/main/java/com/digi/xbee/api/DataReader.java similarity index 99% rename from library/src/main/java/com/digi/xbee/api/connection/DataReader.java rename to library/src/main/java/com/digi/xbee/api/DataReader.java index a3202865..70637704 100644 --- a/library/src/main/java/com/digi/xbee/api/connection/DataReader.java +++ b/library/src/main/java/com/digi/xbee/api/DataReader.java @@ -13,7 +13,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -package com.digi.xbee.api.connection; +package com.digi.xbee.api; import java.io.IOException; import java.net.Inet6Address; @@ -25,14 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.digi.xbee.api.RemoteDigiMeshDevice; -import com.digi.xbee.api.RemoteDigiPointDevice; -import com.digi.xbee.api.RemoteRaw802Device; -import com.digi.xbee.api.RemoteThreadDevice; -import com.digi.xbee.api.RemoteXBeeDevice; -import com.digi.xbee.api.RemoteZigBeeDevice; -import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.XBeeNetwork; +import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.exceptions.XBeeException; import com.digi.xbee.api.io.IOSample; import com.digi.xbee.api.listeners.IExplicitDataReceiveListener; @@ -117,7 +110,7 @@ public class DataReader extends Thread { private XBeePacketsQueue xbeePacketsQueue; - private XBeeDevice xbeeDevice; + private AbstractXBeeDevice xbeeDevice; /** * Class constructor. Instantiates a new {@code DataReader} object for the @@ -131,16 +124,19 @@ public class DataReader extends Thread { * * @throws NullPointerException if {@code connectionInterface == null} or * {@code mode == null}. + * @throws IllegalArgumentException If {@code xbeeDevice.isRemote() == true}. * * @see IConnectionInterface * @see com.digi.xbee.api.XBeeDevice * @see com.digi.xbee.api.models.OperatingMode */ - public DataReader(IConnectionInterface connectionInterface, OperatingMode mode, XBeeDevice xbeeDevice) { + public DataReader(IConnectionInterface connectionInterface, OperatingMode mode, AbstractXBeeDevice xbeeDevice) { if (connectionInterface == null) throw new NullPointerException("Connection interface cannot be null."); if (mode == null) throw new NullPointerException("Operating mode cannot be null."); + if (xbeeDevice.isRemote()) + throw new IllegalArgumentException("The given local XBee device is remote."); this.connectionInterface = connectionInterface; this.mode = mode; @@ -1405,7 +1401,7 @@ private void notifyUserDataRelayReceived(UserDataRelayMessage relayMessage) { * @since 1.3.0 */ private void notifyUserDataRelayReceived(final UserDataRelayMessage relayMessage, final boolean notifyGeneric) { - ArrayList listenerList = new ArrayList<>(); + ArrayList listenerList = new ArrayList<>(); // Get the list of listeners that should be notified depending on the parameters. if (notifyGeneric) { diff --git a/library/src/main/java/com/digi/xbee/api/NodeDiscovery.java b/library/src/main/java/com/digi/xbee/api/NodeDiscovery.java index 8a20d1b6..b0c73b0e 100644 --- a/library/src/main/java/com/digi/xbee/api/NodeDiscovery.java +++ b/library/src/main/java/com/digi/xbee/api/NodeDiscovery.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -59,7 +59,7 @@ class NodeDiscovery { // Variables. private static int globalFrameID = 1; - private XBeeDevice xbeeDevice; + private AbstractXBeeDevice xbeeDevice; private List deviceList; @@ -76,12 +76,15 @@ class NodeDiscovery { * @param xbeeDevice XBee Device to perform the discovery operation. * * @throws NullPointerException If {@code xbeeDevice == null}. + * @throws IllegalArgumentException If {@code xbeeDevice.isRemote() == true}. * * @see XBeeDevice */ - public NodeDiscovery(XBeeDevice xbeeDevice) { + public NodeDiscovery(AbstractXBeeDevice xbeeDevice) { if (xbeeDevice == null) throw new NullPointerException("Local XBee device cannot be null."); + if (xbeeDevice.isRemote()) + throw new IllegalArgumentException("The given local XBee device is remote."); this.xbeeDevice = xbeeDevice; @@ -453,7 +456,7 @@ private byte[] getRemoteDeviceData(XBeeAPIPacket packet) { * * @return Discovered XBee device. */ - private RemoteXBeeDevice parseDiscoveryAPIData(byte[] data, XBeeDevice localDevice) { + private RemoteXBeeDevice parseDiscoveryAPIData(byte[] data, AbstractXBeeDevice localDevice) { if (data == null) return null; diff --git a/library/src/main/java/com/digi/xbee/api/RemoteDigiMeshDevice.java b/library/src/main/java/com/digi/xbee/api/RemoteDigiMeshDevice.java index a11f5f3c..92052aca 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteDigiMeshDevice.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteDigiMeshDevice.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -73,7 +73,7 @@ public RemoteDigiMeshDevice(DigiMeshDevice localXBeeDevice, XBee64BitAddress add * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { + public RemoteDigiMeshDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64) { super(localXBeeDevice, addr64); // Verify the local device has DigiMesh protocol. @@ -100,7 +100,7 @@ public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) { + public RemoteDigiMeshDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) { super(localXBeeDevice, addr64, null, id); // Verify the local device has DigiMesh protocol. diff --git a/library/src/main/java/com/digi/xbee/api/RemoteDigiPointDevice.java b/library/src/main/java/com/digi/xbee/api/RemoteDigiPointDevice.java index 2d4f015d..7fbebf3f 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteDigiPointDevice.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteDigiPointDevice.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -75,7 +75,7 @@ public RemoteDigiPointDevice(DigiPointDevice localXBeeDevice, XBee64BitAddress a * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { + public RemoteDigiPointDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64) { super(localXBeeDevice, addr64); // Verify the local device has point-to-multipoint protocol. @@ -103,7 +103,7 @@ public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64 * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) { + public RemoteDigiPointDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, String id) { super(localXBeeDevice, addr64, null, id); // Verify the local device has point-to-multipoint protocol. diff --git a/library/src/main/java/com/digi/xbee/api/RemoteRaw802Device.java b/library/src/main/java/com/digi/xbee/api/RemoteRaw802Device.java index 5ff957db..3f933b51 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteRaw802Device.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteRaw802Device.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -80,7 +80,7 @@ public RemoteRaw802Device(Raw802Device localXBeeDevice, XBee64BitAddress addr64) * @see com.digi.xbee.api.models.XBee16BitAddress * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteRaw802Device(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, + public RemoteRaw802Device(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, XBee16BitAddress addr16, String id) { super(localXBeeDevice, addr64, addr16, id); @@ -127,7 +127,7 @@ public RemoteRaw802Device(Raw802Device localXBeeDevice, XBee16BitAddress addr16) * * @see com.digi.xbee.api.models.XBee16BitAddress */ - public RemoteRaw802Device(XBeeDevice localXBeeDevice, XBee16BitAddress addr16) { + public RemoteRaw802Device(AbstractXBeeDevice localXBeeDevice, XBee16BitAddress addr16) { super(localXBeeDevice, XBee64BitAddress.UNKNOWN_ADDRESS); // Verify the local device has 802.15.4 protocol. diff --git a/library/src/main/java/com/digi/xbee/api/RemoteThreadDevice.java b/library/src/main/java/com/digi/xbee/api/RemoteThreadDevice.java index 1a74fc66..e743d665 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteThreadDevice.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteThreadDevice.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -57,8 +57,8 @@ public class RemoteThreadDevice extends RemoteXBeeDevice { * @throws NullPointerException if {@code localXBeeDevice == null} or * if {@code ipv6addr == null}. * - * @see #RemoteThreadDevice(XBeeDevice, Inet6Address) - * @see #RemoteThreadDevice(XBeeDevice, Inet6Address, String) + * @see #RemoteThreadDevice(AbstractXBeeDevice, Inet6Address) + * @see #RemoteThreadDevice(AbstractXBeeDevice, Inet6Address, String) * @see com.digi.xbee.api.ThreadDevice * @see java.net.Inet6Address */ @@ -82,11 +82,11 @@ public RemoteThreadDevice(ThreadDevice localXBeeDevice, Inet6Address ipv6Addr) { * if {@code ipv6addr == null}. * * @see #RemoteThreadDevice(ThreadDevice, Inet6Address) - * @see #RemoteThreadDevice(XBeeDevice, Inet6Address, String) + * @see #RemoteThreadDevice(AbstractXBeeDevice, Inet6Address, String) * @see com.digi.xbee.api.XBeeDevice * @see java.net.Inet6Address */ - public RemoteThreadDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { + public RemoteThreadDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { super(localXBeeDevice, ipv6Addr); // Verify the local device has Thread protocol. @@ -112,11 +112,11 @@ public RemoteThreadDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { * if {@code ipv6Address == null}. * * @see #RemoteThreadDevice(ThreadDevice, Inet6Address) - * @see #RemoteThreadDevice(XBeeDevice, Inet6Address) + * @see #RemoteThreadDevice(AbstractXBeeDevice, Inet6Address) * @see com.digi.xbee.api.XBeeDevice * @see java.net.Inet6Address */ - public RemoteThreadDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr, String ni) { + public RemoteThreadDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr, String ni) { super(localXBeeDevice, ipv6Addr, ni); // Verify the local device has Thread protocol. diff --git a/library/src/main/java/com/digi/xbee/api/RemoteXBeeDevice.java b/library/src/main/java/com/digi/xbee/api/RemoteXBeeDevice.java index 7b21833e..5d238db6 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteXBeeDevice.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteXBeeDevice.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -54,7 +54,7 @@ public class RemoteXBeeDevice extends AbstractXBeeDevice { * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { + public RemoteXBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64) { super(localXBeeDevice, addr64); } @@ -79,7 +79,7 @@ public RemoteXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { * @see com.digi.xbee.api.models.XBee16BitAddress * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, + public RemoteXBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, XBee16BitAddress addr16, String ni) { super(localXBeeDevice, addr64, addr16, ni); } @@ -100,7 +100,7 @@ public RemoteXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, * * @see java.net.Inet6Address */ - public RemoteXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { + public RemoteXBeeDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { super(localXBeeDevice, ipv6Addr); } @@ -122,7 +122,7 @@ public RemoteXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr) { * * @see java.net.Inet6Address */ - public RemoteXBeeDevice(XBeeDevice localXBeeDevice, Inet6Address ipv6Addr, + public RemoteXBeeDevice(AbstractXBeeDevice localXBeeDevice, Inet6Address ipv6Addr, String ni) { super(localXBeeDevice, ipv6Addr, ni); } diff --git a/library/src/main/java/com/digi/xbee/api/RemoteZigBeeDevice.java b/library/src/main/java/com/digi/xbee/api/RemoteZigBeeDevice.java index b632c163..d878d759 100644 --- a/library/src/main/java/com/digi/xbee/api/RemoteZigBeeDevice.java +++ b/library/src/main/java/com/digi/xbee/api/RemoteZigBeeDevice.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -75,7 +75,7 @@ public RemoteZigBeeDevice(ZigBeeDevice localXBeeDevice, XBee64BitAddress addr64) * * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteZigBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { + public RemoteZigBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64) { super(localXBeeDevice, addr64); // Verify the local device has ZigBee protocol. @@ -105,7 +105,7 @@ public RemoteZigBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64) { * @see com.digi.xbee.api.models.XBee16BitAddress * @see com.digi.xbee.api.models.XBee64BitAddress */ - public RemoteZigBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64, + public RemoteZigBeeDevice(AbstractXBeeDevice localXBeeDevice, XBee64BitAddress addr64, XBee16BitAddress addr16, String ni) { super(localXBeeDevice, addr64, addr16, ni); diff --git a/library/src/main/java/com/digi/xbee/api/XBeeNetwork.java b/library/src/main/java/com/digi/xbee/api/XBeeNetwork.java index c007147c..9b98e957 100644 --- a/library/src/main/java/com/digi/xbee/api/XBeeNetwork.java +++ b/library/src/main/java/com/digi/xbee/api/XBeeNetwork.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -46,7 +46,7 @@ public class XBeeNetwork { // Variables. - private XBeeDevice localDevice; + private AbstractXBeeDevice localDevice; private Map remotesBy64BitAddr; private Map remotesBy16BitAddr; @@ -63,12 +63,15 @@ public class XBeeNetwork { * @param device Local XBee device to get the network from. * * @throws NullPointerException if {@code device == null}. + * @throws IllegalArgumentException If {@code xbeeDevice.isRemote() == true}. * - * @see XBeeDevice + * @see AbstractXBeeDevice */ - XBeeNetwork(XBeeDevice device) { + XBeeNetwork(AbstractXBeeDevice device) { if (device == null) throw new NullPointerException("Local XBee device cannot be null."); + if (device.isRemote()) + throw new IllegalArgumentException("The given local XBee device is remote."); localDevice = device; remotesBy64BitAddr = new ConcurrentHashMap(); diff --git a/library/src/test/java/com/digi/xbee/api/IPDeviceReadDataTest.java b/library/src/test/java/com/digi/xbee/api/IPDeviceReadDataTest.java index 7118f22e..8a3bdaff 100644 --- a/library/src/test/java/com/digi/xbee/api/IPDeviceReadDataTest.java +++ b/library/src/test/java/com/digi/xbee/api/IPDeviceReadDataTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -36,7 +36,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortRxTx; import com.digi.xbee.api.exceptions.InterfaceNotOpenException; import com.digi.xbee.api.models.IPMessage; diff --git a/library/src/test/java/com/digi/xbee/api/IPv6DeviceReadDataTest.java b/library/src/test/java/com/digi/xbee/api/IPv6DeviceReadDataTest.java index f7b8d76f..4953bbaa 100644 --- a/library/src/test/java/com/digi/xbee/api/IPv6DeviceReadDataTest.java +++ b/library/src/test/java/com/digi/xbee/api/IPv6DeviceReadDataTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -36,7 +36,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortRxTx; import com.digi.xbee.api.exceptions.InterfaceNotOpenException; import com.digi.xbee.api.models.IPMessage; diff --git a/library/src/test/java/com/digi/xbee/api/Remote802DeviceReadInfo16BitTest.java b/library/src/test/java/com/digi/xbee/api/Remote802DeviceReadInfo16BitTest.java index 95f91a6e..47b57968 100644 --- a/library/src/test/java/com/digi/xbee/api/Remote802DeviceReadInfo16BitTest.java +++ b/library/src/test/java/com/digi/xbee/api/Remote802DeviceReadInfo16BitTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -77,7 +77,7 @@ public void setup() throws Exception { SerialPortRxTx mockPort = Mockito.mock(SerialPortRxTx.class); // Mock the local XBee device necessary to instantiate a remote one. - XBeeDevice localXBeeDevice = Mockito.mock(XBeeDevice.class); + AbstractXBeeDevice localXBeeDevice = Mockito.mock(XBeeDevice.class); Mockito.when(localXBeeDevice.getConnectionInterface()).thenReturn(mockPort); Mockito.when(localXBeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.RAW_802_15_4); diff --git a/library/src/test/java/com/digi/xbee/api/RemoteXBeeDeviceInstantiateTest.java b/library/src/test/java/com/digi/xbee/api/RemoteXBeeDeviceInstantiateTest.java index 1164383d..627172aa 100644 --- a/library/src/test/java/com/digi/xbee/api/RemoteXBeeDeviceInstantiateTest.java +++ b/library/src/test/java/com/digi/xbee/api/RemoteXBeeDeviceInstantiateTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -37,7 +37,7 @@ public class RemoteXBeeDeviceInstantiateTest { /** - * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(XBeeDevice, XBee64BitAddress)}. + * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(AbstractXBeeDevice, XBee64BitAddress)}. * *

Verify that a remote XBeeDevice object is not correctly instantiated when the local * XBee device associated is null or the remote XBee64BitAddress is null.

@@ -62,7 +62,7 @@ public void testInstantiateRemoteXBeeDeviceBadParameters() { } /** - * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(XBeeDevice, Inet6Address)}. + * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(AbstractXBeeDevice, Inet6Address)}. * *

Verify that a remote XBeeDevice object is not correctly instantiated when the local * XBee device associated is null or the remote Inet6Address is null.

@@ -87,7 +87,7 @@ public void testInstantiateRemoteXBeeDeviceBadParametersIPv6() { } /** - * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(XBeeDevice, XBee64BitAddress)}. + * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(AbstractXBeeDevice, XBee64BitAddress)}. * *

Verify that a remote XBeeDevice object can be instantiated correctly.

*/ @@ -111,7 +111,7 @@ public void testInstantiateRemoteXBeeDeviceSuccess() { } /** - * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(XBeeDevice, Inet6Address)}. + * Test method for {@link com.digi.xbee.api.RemoteXBeeDevice#RemoteXBeeDevice(AbstractXBeeDevice, Inet6Address)}. * *

Verify that a remote XBeeDevice object can be instantiated correctly.

*/ diff --git a/library/src/test/java/com/digi/xbee/api/XBeeDeviceConnectTest.java b/library/src/test/java/com/digi/xbee/api/XBeeDeviceConnectTest.java index 8828b15d..a3e2f0c6 100644 --- a/library/src/test/java/com/digi/xbee/api/XBeeDeviceConnectTest.java +++ b/library/src/test/java/com/digi/xbee/api/XBeeDeviceConnectTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,7 +27,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortRxTx; import com.digi.xbee.api.exceptions.InterfaceAlreadyOpenException; import com.digi.xbee.api.exceptions.InvalidOperatingModeException; diff --git a/library/src/test/java/com/digi/xbee/api/XBeeDeviceDetermineOperatingModeTest.java b/library/src/test/java/com/digi/xbee/api/XBeeDeviceDetermineOperatingModeTest.java index e384ca4b..b493079a 100644 --- a/library/src/test/java/com/digi/xbee/api/XBeeDeviceDetermineOperatingModeTest.java +++ b/library/src/test/java/com/digi/xbee/api/XBeeDeviceDetermineOperatingModeTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -34,7 +34,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortRxTx; import com.digi.xbee.api.exceptions.InterfaceNotOpenException; import com.digi.xbee.api.exceptions.InvalidOperatingModeException; diff --git a/library/src/test/java/com/digi/xbee/api/XBeeDeviceReadDataTest.java b/library/src/test/java/com/digi/xbee/api/XBeeDeviceReadDataTest.java index 0d8a3eb0..edb333fb 100644 --- a/library/src/test/java/com/digi/xbee/api/XBeeDeviceReadDataTest.java +++ b/library/src/test/java/com/digi/xbee/api/XBeeDeviceReadDataTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -34,7 +34,6 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.serial.SerialPortRxTx; import com.digi.xbee.api.exceptions.InterfaceNotOpenException; import com.digi.xbee.api.models.OperatingMode; diff --git a/library/src/test/java/com/digi/xbee/api/XBeeNetworkConfigurationTest.java b/library/src/test/java/com/digi/xbee/api/XBeeNetworkConfigurationTest.java index 0d9c7dba..bb9da22a 100644 --- a/library/src/test/java/com/digi/xbee/api/XBeeNetworkConfigurationTest.java +++ b/library/src/test/java/com/digi/xbee/api/XBeeNetworkConfigurationTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -73,7 +73,7 @@ public void setUp() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.XBeeNetwork#XBeeNetwork(XBeeDevice)}. + * Test method for {@link com.digi.xbee.api.XBeeNetwork#XBeeNetwork(AbstractXBeeDevice)}. * *

A {@code NullPointerException} exception must be thrown when passing a * {@code null} local device.

diff --git a/library/src/test/java/com/digi/xbee/api/connection/DataReaderGetRemoteXBeeDeviceFromPacketTest.java b/library/src/test/java/com/digi/xbee/api/connection/DataReaderGetRemoteXBeeDeviceFromPacketTest.java index 544153b1..36598cc1 100644 --- a/library/src/test/java/com/digi/xbee/api/connection/DataReaderGetRemoteXBeeDeviceFromPacketTest.java +++ b/library/src/test/java/com/digi/xbee/api/connection/DataReaderGetRemoteXBeeDeviceFromPacketTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -29,6 +29,7 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.modules.junit4.PowerMockRunner; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteDigiMeshDevice; import com.digi.xbee.api.RemoteDigiPointDevice; import com.digi.xbee.api.RemoteRaw802Device; diff --git a/library/src/test/java/com/digi/xbee/api/connection/DataReaderTest.java b/library/src/test/java/com/digi/xbee/api/connection/DataReaderTest.java index df51d1b1..31221ed6 100644 --- a/library/src/test/java/com/digi/xbee/api/connection/DataReaderTest.java +++ b/library/src/test/java/com/digi/xbee/api/connection/DataReaderTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public @@ -47,6 +47,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; @@ -305,7 +306,7 @@ private void waitForInitialization(long threadID) throws InterruptedException { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. + * Test method for {@link com.digi.xbee.api.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. */ @Test public final void testCreateDataReaderNullConnectionInterface() { @@ -318,7 +319,7 @@ public final void testCreateDataReaderNullConnectionInterface() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. + * Test method for {@link com.digi.xbee.api.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. */ @Test public final void testCreateDataReaderNullOperatingMode() { @@ -331,7 +332,7 @@ public final void testCreateDataReaderNullOperatingMode() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. + * Test method for {@link com.digi.xbee.api.DataReader#DataReader(IConnectionInterface, com.digi.xbee.api.models.OperatingMode, com.digi.xbee.api.XBeeDevice)}. * * @throws Exception */ @@ -348,7 +349,7 @@ public final void testCreateDataReader() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#setXBeeReaderMode(OperatingMode)}. + * Test method for {@link com.digi.xbee.api.DataReader#setXBeeReaderMode(OperatingMode)}. */ @Test public final void testSetXbeeReaderModeNullMode() { @@ -363,7 +364,7 @@ public final void testSetXbeeReaderModeNullMode() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#setXBeeReaderMode(OperatingMode)}. + * Test method for {@link com.digi.xbee.api.DataReader#setXBeeReaderMode(OperatingMode)}. */ @Test public final void testSetXbeeReaderMode() { @@ -379,7 +380,7 @@ public final void testSetXbeeReaderMode() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. */ @Test public final void testAddDataReceiveListenerNullListener() { @@ -395,7 +396,7 @@ public final void testAddDataReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. */ @Test public final void testAddDataReceiveListener() { @@ -413,7 +414,7 @@ public final void testAddDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. */ @Test public final void testAddDataReceiveListenerExistingListener() { @@ -437,7 +438,7 @@ public final void testAddDataReceiveListenerExistingListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. */ @Test public final void testRemoveDataReceiveListenerNonAdded() { @@ -459,7 +460,7 @@ public final void testRemoveDataReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IDataReceiveListener)}. */ @Test public final void testRemoveDataReceiveListener() { @@ -479,7 +480,7 @@ public final void testRemoveDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. */ @Test public final void testAddPacketReceiveListenerNullListener() { @@ -495,7 +496,7 @@ public final void testAddPacketReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. */ @Test public final void testAddPacketReceiveListener() { @@ -514,7 +515,7 @@ public final void testAddPacketReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addPacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. */ @Test public final void testAddPacketReceiveListenerExistingListener() { @@ -627,7 +628,7 @@ public final void testAddPacketReceiveListenerFrameIDExistingListenerDifferentID } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removePacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removePacketReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. */ @Test public final void testRemovePacketReceiveListenerNonAdded() { @@ -650,7 +651,7 @@ public final void testRemovePacketReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeDataReceiveListener(com.digi.xbee.api.listeners.IPacketReceiveListener)}. */ @Test public final void testRemovePacketReceiveListener() { @@ -670,7 +671,7 @@ public final void testRemovePacketReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. */ @Test public final void testAddIOSampleReceiveListenerNullListener() { @@ -686,7 +687,7 @@ public final void testAddIOSampleReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. */ @Test public final void testAddIOSampleReceiveListener() { @@ -704,7 +705,7 @@ public final void testAddIOSampleReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. */ @Test public final void testAddIOSampleReceiveListenerExistingListener() { @@ -728,7 +729,7 @@ public final void testAddIOSampleReceiveListenerExistingListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. */ @Test public final void testRemoveIOSampleReceiveListenerNonAdded() { @@ -750,7 +751,7 @@ public final void testRemoveIOSampleReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeIOSampleReceiveListener(com.digi.xbee.api.listeners.IIOSampleReceiveListener)}. */ @Test public final void testRemoveIOSampleReceiveListener() { @@ -770,7 +771,7 @@ public final void testRemoveIOSampleReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. */ @Test public final void testAddModemStatusReceiveListenerNullListener() { @@ -786,7 +787,7 @@ public final void testAddModemStatusReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. */ @Test public final void testAddModemStatusReceiveListener() { @@ -804,7 +805,7 @@ public final void testAddModemStatusReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. */ @Test public final void testAddModemStatuseReceiveListenerExistingListener() { @@ -828,7 +829,7 @@ public final void testAddModemStatuseReceiveListenerExistingListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. */ @Test public final void testRemoveModemStatusReceiveListenerNonAdded() { @@ -850,7 +851,7 @@ public final void testRemoveModemStatusReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeModemStatusReceiveListener(com.digi.xbee.api.listeners.IModemStatusReceiveListener)}. */ @Test public final void testRemoveModemStatusReceiveListener() { @@ -870,7 +871,7 @@ public final void testRemoveModemStatusReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. */ @Test public final void testAddExplicitDataReceiveListenerNullListener() { @@ -886,7 +887,7 @@ public final void testAddExplicitDataReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. */ @Test public final void testAddExplicitDataReceiveListener() { @@ -904,7 +905,7 @@ public final void testAddExplicitDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. */ @Test public final void testAddExplicitDataeReceiveListenerExistingListener() { @@ -928,7 +929,7 @@ public final void testAddExplicitDataeReceiveListenerExistingListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. */ @Test public final void testRemoveExplicitDataReceiveListenerNonAdded() { @@ -950,7 +951,7 @@ public final void testRemoveExplicitDataReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeExplicitDataReceiveListener(com.digi.xbee.api.listeners.IExplicitDataReceiveListener)}. */ @Test public final void testRemoveExplicitDataReceiveListener() { @@ -970,7 +971,7 @@ public final void testRemoveExplicitDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. */ @Test public final void testAddIPDataReceiveListenerNullListener() { @@ -986,7 +987,7 @@ public final void testAddIPDataReceiveListenerNullListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. */ @Test public final void testAddIPDataReceiveListener() { @@ -1004,7 +1005,7 @@ public final void testAddIPDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#addIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. */ @Test public final void testAddIPDataReceiveListenerExistingListener() { @@ -1028,7 +1029,7 @@ public final void testAddIPDataReceiveListenerExistingListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. */ @Test public final void testRemoveIPDataReceiveListenerNonAdded() { @@ -1050,7 +1051,7 @@ public final void testRemoveIPDataReceiveListenerNonAdded() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#removeIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. + * Test method for {@link com.digi.xbee.api.DataReader#removeIPDataReceiveListener(com.digi.xbee.api.listeners.IIPDataReceiveListener)}. */ @Test public final void testRemoveIPDataReceiveListener() { @@ -1070,7 +1071,7 @@ public final void testRemoveIPDataReceiveListener() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketBadHeaderByte() throws Exception { @@ -1107,7 +1108,7 @@ public Integer answer(InvocationOnMock invocation) throws Throwable { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketBadPacket() throws Exception { @@ -1142,7 +1143,7 @@ public XBeePacket answer(InvocationOnMock invocation) throws Throwable { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketNotContemplatedPacket() throws Exception { @@ -1188,7 +1189,7 @@ public final void testDataReaderReceivePacketNotContemplatedPacket() throws Exce } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketListentoFrameIDNotReceived() throws Exception { @@ -1234,7 +1235,7 @@ public final void testDataReaderReceivePacketListentoFrameIDNotReceived() throws } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketListentoFrameIDReceived() throws Exception { @@ -1280,7 +1281,7 @@ public final void testDataReaderReceivePacketListentoFrameIDReceived() throws Ex } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketATResponse() throws Exception { @@ -1326,7 +1327,7 @@ public final void testDataReaderReceivePacketATResponse() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRemoteATResponse() throws Exception { @@ -1372,7 +1373,7 @@ public final void testDataReaderReceivePacketRemoteATResponse() throws Exception } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRX64DataPacket() throws Exception { @@ -1418,7 +1419,7 @@ public final void testDataReaderReceivePacketRX64DataPacket() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXIPv6DataPacket() throws Exception { @@ -1464,7 +1465,7 @@ public final void testDataReaderReceivePacketRXIPv6DataPacket() throws Exception } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRX16DataPacket() throws Exception { @@ -1510,7 +1511,7 @@ public final void testDataReaderReceivePacketRX16DataPacket() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXDataPacket() throws Exception { @@ -1556,7 +1557,7 @@ public final void testDataReaderReceivePacketRXDataPacket() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXIO64DataPacket() throws Exception { @@ -1602,7 +1603,7 @@ public final void testDataReaderReceivePacketRXIO64DataPacket() throws Exception } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXIO16DataPacket() throws Exception { @@ -1648,7 +1649,7 @@ public final void testDataReaderReceivePacketRXIO16DataPacket() throws Exception } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXIOIPv6DataPacket() throws Exception { @@ -1694,7 +1695,7 @@ public final void testDataReaderReceivePacketRXIOIPv6DataPacket() throws Excepti } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketRXIOPacket() throws Exception { @@ -1740,7 +1741,7 @@ public final void testDataReaderReceivePacketRXIOPacket() throws Exception { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketModemStatusPacket() throws Exception { @@ -1786,7 +1787,7 @@ public final void testDataReaderReceivePacketModemStatusPacket() throws Exceptio } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketExplicitIndicatorDigiPacket() throws Exception { @@ -1832,7 +1833,7 @@ public final void testDataReaderReceivePacketExplicitIndicatorDigiPacket() throw } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketExplicitIndicatorPacket() throws Exception { @@ -1878,7 +1879,7 @@ public final void testDataReaderReceivePacketExplicitIndicatorPacket() throws Ex } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketIOExceptionWhenReading() throws Exception { @@ -1915,7 +1916,7 @@ public XBeePacket answer(InvocationOnMock invocation) throws Throwable { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketATmode() throws Exception { @@ -1952,7 +1953,7 @@ public InputStream getInputStream() { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#start()}. + * Test method for {@link com.digi.xbee.api.DataReader#start()}. */ @Test public final void testDataReaderReceivePacketNullInputStream() throws Exception { diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListener802Test.java b/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListener802Test.java index bc60d167..ca7e7e28 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListener802Test.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListener802Test.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,11 +31,11 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteRaw802Device; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.OperatingMode; import com.digi.xbee.api.models.XBee16BitAddress; @@ -212,7 +212,7 @@ public void testBroadcastDataReceiveEventRx64() { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive data, the callback is not * executed although an 802.15.4 data packet is received.

@@ -241,7 +241,7 @@ public void testDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a Rx16 packet is received, the data received * callback of the listener is executed.

@@ -275,7 +275,7 @@ public void testDataReceiveSubscribedRx16() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a Rx64 packet is received, the data received * callback of the listener is executed.

@@ -309,7 +309,7 @@ public void testDataReceiveSubscribedRx64() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a packet that does not correspond to * data, the callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListenerXBeeTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListenerXBeeTest.java index 6fcfa4da..455d3bc7 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListenerXBeeTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IDataReceiveListenerXBeeTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,10 +31,10 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.OperatingMode; import com.digi.xbee.api.models.XBee16BitAddress; @@ -163,7 +163,7 @@ public void testBroadcastDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive data, the callback is not * executed although a data packet is received.

@@ -191,7 +191,7 @@ public void testDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a Receive packet is received, the * callback of the listener is executed.

@@ -224,7 +224,7 @@ public void testDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a packet that does not correspond to * data, the callback of the listener is not executed.

@@ -254,7 +254,7 @@ public void testDataReceiveSubscribedInvalid() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and an Explicit Receive data packet for Digi transmissions * is received, the callback of the listener is executed.

@@ -293,7 +293,7 @@ public void testExplicitDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IDataReceiveListener#dataReceived(XBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and an Explicit Receive packet is received, the * callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IExplicitDataReceiveListenerTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IExplicitDataReceiveListenerTest.java index 99bfe012..e6a55d24 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IExplicitDataReceiveListenerTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IExplicitDataReceiveListenerTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,10 +31,10 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.ExplicitXBeeMessage; import com.digi.xbee.api.models.OperatingMode; @@ -169,7 +169,7 @@ public void testExplicitBroadcastDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IExplicitDataReceiveListener#explicitDataReceived(ExplicitXBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive explicit data, the callback is not * executed although an explicit data packet is received.

@@ -201,7 +201,7 @@ public void testExplicitDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IExplicitDataReceiveListener#explicitDataReceived(ExplicitXBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive explicit data and an Explicit Rx Indicator packet is received, * the callback of the listener is executed.

@@ -238,7 +238,7 @@ public void testExplicitDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IExplicitDataReceiveListener#explicitDataReceived(ExplicitXBeeMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive data and a packet that does not correspond to * data, the callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListener802Test.java b/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListener802Test.java index ed5e0903..209e80f2 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListener802Test.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListener802Test.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public @@ -31,11 +31,11 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteRaw802Device; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.io.IOSample; import com.digi.xbee.api.models.OperatingMode; diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListenerXBeeTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListenerXBeeTest.java index bbb614e6..f47673c9 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListenerXBeeTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IIOSampleReceiveListenerXBeeTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,10 +31,10 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.XBeeDevice; import com.digi.xbee.api.XBeeNetwork; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.io.IOSample; import com.digi.xbee.api.models.OperatingMode; diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerIPv6Test.java b/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerIPv6Test.java index 78d1a05c..796978d0 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerIPv6Test.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerIPv6Test.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -32,8 +32,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.IPMessage; import com.digi.xbee.api.models.IPProtocol; @@ -139,7 +139,7 @@ public void testDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive IPv6 data, the callback * is not executed although a data packet is received.

@@ -169,7 +169,7 @@ public void testDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive IPv6 data and an RXIPV4 packet is received, * the callback of the listener is executed.

@@ -204,7 +204,7 @@ public void testDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive IPv6 data and a packet that does not * correspond to IPv6 data is received, the callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerTest.java index 681723d7..a780071a 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IIPDataReceiveListenerTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -32,8 +32,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.IPMessage; import com.digi.xbee.api.models.IPProtocol; @@ -135,7 +135,7 @@ public void testDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive IP data, the callback * is not executed although a data packet is received.

@@ -165,7 +165,7 @@ public void testDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive IP data and an RXIPV4 packet is received, * the callback of the listener is executed.

@@ -200,7 +200,7 @@ public void testDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IIPDataReceiveListener#ipDataReceived(IPMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive IP data and a packet that does not * correspond to IP data is received, the callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IModemStatusReceiveListenerTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IModemStatusReceiveListenerTest.java index 4f4e1311..b669e263 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IModemStatusReceiveListenerTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IModemStatusReceiveListenerTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,8 +31,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.ModemStatusEvent; import com.digi.xbee.api.models.OperatingMode; @@ -106,7 +106,7 @@ public void testModemStausReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IModemStatusReceiveListener#modemStatusEventReceived(ModemStatusEvent)} - * and {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * and {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive Modem Status events, the callback is not * executed although a Modem Status packet is received.

@@ -128,7 +128,7 @@ public void testModemStatusReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IModemStatusReceiveListener#modemStatusEventReceived(ModemStatusEvent)} - * and {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * and {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive Modem Status events and a ModemStatusPacket is received, * the callback of the listener is executed.

@@ -154,7 +154,7 @@ public void testModemStatusReceiveSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IModemStatusReceiveListener#modemStatusEventReceived(ModemStatusEvent)} - * and {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * and {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive Modem Status events and a packet that does not correspond to a Modem * Status event is received, the callback of the listener is not executed.

diff --git a/library/src/test/java/com/digi/xbee/api/listeners/IPacketReceiveListenerTest.java b/library/src/test/java/com/digi/xbee/api/listeners/IPacketReceiveListenerTest.java index 783487a6..47c29a02 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/IPacketReceiveListenerTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/IPacketReceiveListenerTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -32,8 +32,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.OperatingMode; import com.digi.xbee.api.packet.XBeeAPIPacket; @@ -119,7 +119,7 @@ public Object answer(InvocationOnMock invocation) { } /** - * Test method for {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * Test method for {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that the callback of the IPacketReceiveListener interface is executed correctly.

*/ @@ -134,7 +134,7 @@ public void testUnicastDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.IPacketReceiveListener#packetReceived(XBeePacket)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive packets, the callback is not * executed although a packet is received.

@@ -158,7 +158,7 @@ public void testPacketReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IPacketReceiveListener#packetReceived(XBeePacket)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive packets with any frame ID, and any packet is received, the * callback of the listener is always executed.

@@ -187,7 +187,7 @@ public void testPacketReceiveSubscribedAllFrameIDs() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.IPacketReceiveListener#packetReceived(XBeePacket)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive packets of a specific frame ID, and a packet with that ID is * received, the callback of the listener is executed, but next time that the same packet or other packets diff --git a/library/src/test/java/com/digi/xbee/api/listeners/ISMSReceiveListenerTest.java b/library/src/test/java/com/digi/xbee/api/listeners/ISMSReceiveListenerTest.java index 5143c2cd..4598533e 100644 --- a/library/src/test/java/com/digi/xbee/api/listeners/ISMSReceiveListenerTest.java +++ b/library/src/test/java/com/digi/xbee/api/listeners/ISMSReceiveListenerTest.java @@ -1,5 +1,5 @@ -/** - * Copyright 2017, Digi International Inc. +/* + * Copyright 2017-2019, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -31,8 +31,8 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import com.digi.xbee.api.DataReader; import com.digi.xbee.api.XBeeDevice; -import com.digi.xbee.api.connection.DataReader; import com.digi.xbee.api.connection.IConnectionInterface; import com.digi.xbee.api.models.OperatingMode; import com.digi.xbee.api.models.SMSMessage; @@ -118,7 +118,7 @@ public void testBroadcastDataReceiveEvent() { /** * Test method for {@link com.digi.xbee.api.listeners.ISMSReceiveListener#smsReceived(SMSMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that if the listener is not subscribed to receive SMS, the callback * is not executed although an SMS packet is received.

@@ -142,7 +142,7 @@ public void testDataReceiveNotSubscribed() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.ISMSReceiveListener#smsReceived(SMSMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive SMS and an RXSMS packet is received, * the callback of the listener is executed.

@@ -171,7 +171,7 @@ public void testDataReceiveSubscribedReceive() throws Exception { /** * Test method for {@link com.digi.xbee.api.listeners.ISMSReceiveListener#smsReceived(SMSMessage)} and - * {@link com.digi.xbee.api.connection.DataReader#packetReceived(XBeePacket)}. + * {@link com.digi.xbee.api.DataReader#packetReceived(XBeePacket)}. * *

Verify that, when subscribed to receive SMS and a packet that does not * correspond to SMS is received, the callback of the listener is not executed.