public class XBeeDevice extends AbstractXBeeDevice
Constructor and Description |
---|
XBeeDevice(IConnectionInterface connectionInterface)
Class constructor.
|
XBeeDevice(String port,
int baudRate)
Class constructor.
|
XBeeDevice(String port,
int baudRate,
int dataBits,
int stopBits,
int parity,
int flowControl)
Class constructor.
|
XBeeDevice(String port,
SerialPortParameters serialPortParameters)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addBluetoothDataListener(IBluetoothDataReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new data from the Bluetooth interface is received in a User Data
Relay frame.
|
void |
addDataListener(IDataReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new data from a remote XBee device is received.
|
void |
addIOSampleListener(IIOSampleReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new IO samples are received.
|
void |
addMicroPythonDataListener(IMicroPythonDataReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new data from the MicroPython interface is received in a User
Data Relay frame.
|
void |
addModemStatusListener(IModemStatusReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new Modem Status events are received.
|
void |
addPacketListener(IPacketReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new packets are received.
|
void |
addUserDataRelayListener(IUserDataRelayReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new User Data Relay message is received.
|
void |
close()
Closes the connection interface associated with this XBee device.
|
XBeeNetwork |
getNetwork()
Returns the network associated with this XBee device.
|
int |
getNextFrameID()
Returns the next Frame ID of this XBee device.
|
OperatingMode |
getOperatingMode()
Returns the Operating mode (AT, API or API escaped) of this XBee device
for a local device, and the operating mode of the local device used as
communication interface for a remote device.
|
int |
getReceiveTimeout()
Returns this XBee device configured timeout for receiving packets in
synchronous operations.
|
boolean |
isOpen()
Returns whether the connection interface associated to this device is
already open.
|
boolean |
isRemote()
Returns whether this XBee device is a remote device.
|
void |
open()
Opens the connection interface associated with this XBee device.
|
XBeeMessage |
readData()
Reads new data received by this XBee device during the configured
receive timeout.
|
XBeeMessage |
readData(int timeout)
Reads new data received by this XBee device during the provided timeout.
|
XBeeMessage |
readDataFrom(RemoteXBeeDevice remoteXBeeDevice)
Reads new data received from the given remote XBee device during the
configured receive timeout.
|
XBeeMessage |
readDataFrom(RemoteXBeeDevice remoteXBeeDevice,
int timeout)
Reads new data received from the given remote XBee device during the
provided timeout.
|
XBeePacket |
readPacket()
Reads new packet received by this XBee device during the configured
receive timeout.
|
XBeePacket |
readPacket(int timeout)
Reads new packet received by this XBee device during the provided
timeout.
|
XBeePacket |
readPacketFrom(RemoteXBeeDevice remoteXBeeDevice)
Reads new packet received from the given remote XBee device during the
configured receive timeout.
|
XBeePacket |
readPacketFrom(RemoteXBeeDevice remoteXBeeDevice,
int timeout)
Reads new packet received from the given remote XBee device during the
provided timeout.
|
void |
removeBluetoothDataListener(IBluetoothDataReceiveListener listener)
Removes the provided listener from the list of data receive listeners
for the Bluetooth interface.
|
void |
removeDataListener(IDataReceiveListener listener)
Removes the provided listener from the list of data listeners for remote
XBee devices.
|
void |
removeIOSampleListener(IIOSampleReceiveListener listener)
Removes the provided listener from the list of IO samples listeners.
|
void |
removeMicroPythonDataListener(IMicroPythonDataReceiveListener listener)
Removes the provided listener from the list of data receive listeners
for the MicroPython interface.
|
void |
removeModemStatusListener(IModemStatusReceiveListener listener)
Removes the provided listener from the list of Modem Status listeners.
|
void |
removePacketListener(IPacketReceiveListener listener)
Removes the provided listener from the list of packets listeners.
|
void |
removeUserDataRelayListener(IUserDataRelayReceiveListener listener)
Removes the provided listener from the list of User Data Relay listeners.
|
void |
reset()
Performs a software reset on this XBee device and blocks until the
process is completed.
|
void |
sendBluetoothData(byte[] data)
Sends the given data to the XBee Bluetooth interface in a User Data Relay
frame.
|
void |
sendBroadcastData(byte[] data)
Sends the provided data to all the XBee nodes of the network (broadcast).
|
void |
sendData(RemoteXBeeDevice remoteXBeeDevice,
byte[] data)
Sends the provided data to the given XBee device choosing the optimal
send method depending on the protocol of the local XBee device.
|
void |
sendDataAsync(RemoteXBeeDevice remoteXBeeDevice,
byte[] data)
Sends the provided data to the provided XBee device asynchronously
choosing the optimal send method depending on the protocol of the local
XBee device.
|
void |
sendMicroPythonData(byte[] data)
Sends the given data to the XBee MicroPython interface in a User Data
Relay frame.
|
XBeePacket |
sendPacket(XBeePacket packet)
Sends the given XBee packet synchronously and blocks until the response
is received or the configured receive timeout expires.
|
void |
sendPacket(XBeePacket packet,
IPacketReceiveListener packetReceiveListener)
Sends the given XBee packet and registers the given packet listener
(if not
null ) to be notified when the answers is received. |
void |
sendPacketAsync(XBeePacket packet)
Sends the given XBee packet asynchronously.
|
void |
sendUserDataRelay(XBeeLocalInterface destInterface,
byte[] data)
Sends the given data to the given XBee local interface.
|
void |
setReceiveTimeout(int receiveTimeout)
Configures this XBee device timeout in milliseconds for receiving
packets in synchronous operations.
|
String |
toString() |
applyChanges, disableBluetooth, enableApplyConfigurationChanges, enableBluetooth, executeParameter, get16BitAddress, get64BitAddress, getADCValue, getBluetoothMacAddress, getConnectionInterface, getDestinationAddress, getDIOChangeDetection, getDIOValue, getFirmwareVersion, getHardwareVersion, getIOConfiguration, getIOSamplingRate, getIPv6Address, getIPv6DestinationAddress, getNodeID, getPANID, getParameter, getPowerLevel, getPWMDutyCycle, getXBeeProtocol, isApplyConfigurationChangesEnabled, readDeviceInfo, readIOSample, setDestinationAddress, setDIOChangeDetection, setDIOValue, setIOConfiguration, setIOSamplingRate, setIPv6DestinationAddress, setNodeID, setPANID, setParameter, setPowerLevel, setPWMDutyCycle, updateBluetoothPassword, updateDeviceDataFrom, writeChanges
public XBeeDevice(IConnectionInterface connectionInterface)
XBeeDevice
object with the
given connection interface.connectionInterface
- The connection interface with the physical
XBee device.NullPointerException
- if connectionInterface == null
.XBeeDevice(String, int)
,
XBeeDevice(String, SerialPortParameters)
,
XBeeDevice(String, int, int, int, int, int)
,
IConnectionInterface
public XBeeDevice(String port, int baudRate)
XBeeDevice
object
physically connected to the given port name and configured at the
provided baud rate.port
- Serial port name where XBee device is attached to.baudRate
- Serial port baud rate to communicate with the device.
Other connection parameters will be set as default (8
data bits, 1 stop bit, no parity, no flow control).IllegalArgumentException
- if baudRate < 0
.NullPointerException
- if port == null
.XBeeDevice(IConnectionInterface)
,
XBeeDevice(String, SerialPortParameters)
,
XBeeDevice(String, int, int, int, int, int)
public XBeeDevice(String port, int baudRate, int dataBits, int stopBits, int parity, int flowControl)
XBeeDevice
object
physically connected to the given port name and configured to communicate
with the provided serial settings.port
- Serial port name where XBee device is attached to.baudRate
- Serial port baud rate to communicate with the device.dataBits
- Serial port data bits.stopBits
- Serial port data bits.parity
- Serial port data bits.flowControl
- Serial port data bits.IllegalArgumentException
- if baudRate < 0
or
if dataBits < 0
or
if stopBits < 0
or
if parity < 0
or
if flowControl < 0
.NullPointerException
- if port == null
.XBeeDevice(IConnectionInterface)
,
XBeeDevice(String, int)
,
XBeeDevice(String, SerialPortParameters)
public XBeeDevice(String port, SerialPortParameters serialPortParameters)
XBeeDevice
object
physically connected to the given port name and configured to communicate
with the provided serial settings.port
- Serial port name where XBee device is attached to.serialPortParameters
- Object containing the serial port parameters.NullPointerException
- if port == null
or
if serialPortParameters == null
.XBeeDevice(IConnectionInterface)
,
XBeeDevice(String, int)
,
XBeeDevice(String, int, int, int, int, int)
,
SerialPortParameters
public void addBluetoothDataListener(IBluetoothDataReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new data from the Bluetooth
interface is received.AbstractXBeeDevice.removeBluetoothDataListener(IBluetoothDataReceiveListener)
,
IBluetoothDataReceiveListener
public void addDataListener(IDataReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new data from a remote XBee
device is received.AbstractXBeeDevice.removeDataListener(IDataReceiveListener)
,
IDataReceiveListener
public void addIOSampleListener(IIOSampleReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new IO samples are received.AbstractXBeeDevice.removeIOSampleListener(IIOSampleReceiveListener)
,
IIOSampleReceiveListener
public void addMicroPythonDataListener(IMicroPythonDataReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new data from the
MicroPython interface is received.AbstractXBeeDevice.removeMicroPythonDataListener(IMicroPythonDataReceiveListener)
,
IMicroPythonDataReceiveListener
public void addModemStatusListener(IModemStatusReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new Modem Status events are
received.AbstractXBeeDevice.removeModemStatusListener(IModemStatusReceiveListener)
,
IModemStatusReceiveListener
public void addPacketListener(IPacketReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included, this method does nothing.
listener
- Listener to be notified when new packets are received.AbstractXBeeDevice.removePacketListener(IPacketReceiveListener)
,
IPacketReceiveListener
public void addUserDataRelayListener(IUserDataRelayReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new User Data Relay message
is received.AbstractXBeeDevice.removeUserDataRelayListener(IUserDataRelayReceiveListener)
,
IUserDataRelayReceiveListener
public void close()
AbstractXBeeDevice
public XBeeNetwork getNetwork()
AbstractXBeeDevice
XBeeNetwork
public int getNextFrameID()
AbstractXBeeDevice
public OperatingMode getOperatingMode()
AbstractXBeeDevice
AbstractXBeeDevice.isRemote()
,
OperatingMode
public int getReceiveTimeout()
AbstractXBeeDevice
AbstractXBeeDevice.setReceiveTimeout(int)
public boolean isOpen()
AbstractXBeeDevice
true
if the interface is open, false
otherwise.AbstractXBeeDevice.close()
,
AbstractXBeeDevice.open()
public boolean isRemote()
AbstractXBeeDevice
isRemote
in class AbstractXBeeDevice
true
if this XBee device is a remote device,
false
otherwise.public void open() throws XBeeException
AbstractXBeeDevice
When opening the device an information reading process is automatically performed. This includes:
BluetoothAuthenticationException
- if there is any problem in the
Bluetooth authentication.XBeeException
- if there is any problem opening this device
connection.AbstractXBeeDevice.close()
,
AbstractXBeeDevice.isOpen()
public XBeeMessage readData()
AbstractXBeeDevice
This method blocks until new data is received or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
For non-blocking operations, register a IDataReceiveListener
using the method AbstractXBeeDevice.addDataListener(IDataReceiveListener)
.
XBeeMessage
object containing the data and the source
address of the remote node that sent the data. null
if
this did not receive new data during the configured receive
timeout.AbstractXBeeDevice.readData(int)
,
AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice)
,
AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice, int)
,
XBeeMessage
public XBeeMessage readData(int timeout)
AbstractXBeeDevice
This method blocks until new data is received or the provided timeout expires.
For non-blocking operations, register a IDataReceiveListener
using the method AbstractXBeeDevice.addDataListener(IDataReceiveListener)
.
timeout
- The time to wait for new data in milliseconds.XBeeMessage
object containing the data and the source
address of the remote node that sent the data. null
if
this device did not receive new data during timeout
milliseconds.AbstractXBeeDevice.readData()
,
AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice)
,
AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice, int)
,
XBeeMessage
public XBeeMessage readDataFrom(RemoteXBeeDevice remoteXBeeDevice)
AbstractXBeeDevice
This method blocks until new data from the provided remote XBee device is received or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
For non-blocking operations, register a IDataReceiveListener
using the method AbstractXBeeDevice.addDataListener(IDataReceiveListener)
.
remoteXBeeDevice
- The remote device to read data from.XBeeMessage
object containing the data and the source
address of the remote node that sent the data. null
if
this device did not receive new data from the provided remote
XBee device during the configured receive timeout.AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice, int)
,
AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.readData()
,
AbstractXBeeDevice.readData(int)
,
RemoteXBeeDevice
,
XBeeMessage
public XBeeMessage readDataFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
AbstractXBeeDevice
This method blocks until new data from the provided remote XBee device is received or the given timeout expires.
For non-blocking operations, register a IDataReceiveListener
using the method AbstractXBeeDevice.addDataListener(IDataReceiveListener)
.
remoteXBeeDevice
- The remote device to read data from.timeout
- The time to wait for new data in milliseconds.XBeeMessage
object containing the data and the source
address of the remote node that sent the data. null
if
this device did not receive new data from the provided remote
XBee device during timeout
milliseconds.AbstractXBeeDevice.readDataFrom(RemoteXBeeDevice)
,
AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.readData()
,
AbstractXBeeDevice.readData(int)
,
RemoteXBeeDevice
,
XBeeMessage
public XBeePacket readPacket()
AbstractXBeeDevice
This method blocks until new packet is received or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
For non-blocking operations, register a IPacketReceiveListener
using the method AbstractXBeeDevice.addPacketListener(IPacketReceiveListener)
.
null
if none was received
during the configured timeout.AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.readPacket(int)
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice)
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice, int)
,
XBeePacket
public XBeePacket readPacket(int timeout)
AbstractXBeeDevice
This method blocks until new packet is received or the provided timeout expires.
For non-blocking operations, register a IPacketReceiveListener
using the method AbstractXBeeDevice.addPacketListener(IPacketReceiveListener)
.
timeout
- The time to wait for new packet in milliseconds.null
if none was received
during the provided timeout.AbstractXBeeDevice.readPacket()
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice)
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice, int)
,
XBeePacket
public XBeePacket readPacketFrom(RemoteXBeeDevice remoteXBeeDevice)
AbstractXBeeDevice
This method blocks until new packet from the provided remote XBee device is received or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
For non-blocking operations, register a IPacketReceiveListener
using the method AbstractXBeeDevice.addPacketListener(IPacketReceiveListener)
.
remoteXBeeDevice
- The remote device to read packet from.null
if none was received
from the given remote device during the configured timeout.AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.readPacket()
,
AbstractXBeeDevice.readPacket(int)
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice, int)
,
XBeePacket
public XBeePacket readPacketFrom(RemoteXBeeDevice remoteXBeeDevice, int timeout)
AbstractXBeeDevice
This method blocks until new packet from the provided remote XBee device is received or the given timeout expires.
For non-blocking operations, register a IPacketReceiveListener
using the method AbstractXBeeDevice.addPacketListener(IPacketReceiveListener)
.
remoteXBeeDevice
- The remote device to read packet from.timeout
- The time to wait for new packet in milliseconds.null
if none was received
from the given remote device during the provided timeout.AbstractXBeeDevice.readPacket()
,
AbstractXBeeDevice.readPacket(int)
,
AbstractXBeeDevice.readPacketFrom(RemoteXBeeDevice)
,
XBeePacket
public void removeBluetoothDataListener(IBluetoothDataReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addBluetoothDataListener(IBluetoothDataReceiveListener)
,
IBluetoothDataReceiveListener
public void removeDataListener(IDataReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addDataListener(IDataReceiveListener)
,
IDataReceiveListener
public void removeIOSampleListener(IIOSampleReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addIOSampleListener(IIOSampleReceiveListener)
,
IIOSampleReceiveListener
public void removeMicroPythonDataListener(IMicroPythonDataReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addMicroPythonDataListener(IMicroPythonDataReceiveListener)
,
IMicroPythonDataReceiveListener
public void removeModemStatusListener(IModemStatusReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addModemStatusListener(IModemStatusReceiveListener)
,
IModemStatusReceiveListener
public void removePacketListener(IPacketReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addPacketListener(IPacketReceiveListener)
,
IPacketReceiveListener
public void removeUserDataRelayListener(IUserDataRelayReceiveListener listener)
AbstractXBeeDevice
If the listener was not in the list this method does nothing.
listener
- Listener to be removed from the list of listeners.AbstractXBeeDevice.addUserDataRelayListener(IUserDataRelayReceiveListener)
,
IUserDataRelayReceiveListener
public void reset() throws TimeoutException, XBeeException
AbstractXBeeDevice
reset
in class AbstractXBeeDevice
TimeoutException
- if the configured time expires while waiting
for the command reply.XBeeException
- if there is any other XBee related exception.public void sendBluetoothData(byte[] data) throws XBeeException
AbstractXBeeDevice
data
- Data to send.XBeeException
- if there is any XBee related exception sending the
data.AbstractXBeeDevice.sendMicroPythonData(byte[])
,
AbstractXBeeDevice.sendUserDataRelay(XBeeLocalInterface, byte[])
public void sendBroadcastData(byte[] data) throws TimeoutException, XBeeException
AbstractXBeeDevice
This method blocks till a success or error transmit status arrives or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
data
- Byte array containing the data to be sent.TimeoutException
- if there is a timeout sending the data.XBeeException
- if there is any other XBee related exception.AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
public void sendData(RemoteXBeeDevice remoteXBeeDevice, byte[] data) throws TimeoutException, XBeeException
AbstractXBeeDevice
This method blocks till a success or error response arrives or the configured receive timeout expires.
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
For non-blocking operations use the method
AbstractXBeeDevice.sendDataAsync(RemoteXBeeDevice, byte[])
.
remoteXBeeDevice
- The XBee device of the network that will receive
the data.data
- Byte array containing the data to be sent.TimeoutException
- if there is a timeout sending the data.XBeeException
- if there is any other XBee related exception.AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
AbstractXBeeDevice.sendData(XBee64BitAddress, byte[])
,
AbstractXBeeDevice.sendData(XBee64BitAddress, XBee16BitAddress, byte[])
,
AbstractXBeeDevice.sendDataAsync(RemoteXBeeDevice, byte[])
,
AbstractXBeeDevice.sendDataAsync(XBee64BitAddress, byte[])
,
AbstractXBeeDevice.sendDataAsync(XBee64BitAddress, XBee16BitAddress, byte[])
,
RemoteXBeeDevice
public void sendDataAsync(RemoteXBeeDevice remoteXBeeDevice, byte[] data) throws XBeeException
AbstractXBeeDevice
Asynchronous transmissions do not wait for answer from the remote device or for transmit status packet.
remoteXBeeDevice
- The XBee device of the network that will receive the
data.data
- Byte array containing the data to be sent.XBeeException
- if there is any XBee related exception.AbstractXBeeDevice.sendData(RemoteXBeeDevice, byte[])
,
AbstractXBeeDevice.sendData(XBee64BitAddress, byte[])
,
AbstractXBeeDevice.sendData(XBee64BitAddress, XBee16BitAddress, byte[])
,
AbstractXBeeDevice.sendDataAsync(XBee64BitAddress, byte[])
,
AbstractXBeeDevice.sendDataAsync(XBee64BitAddress, XBee16BitAddress, byte[])
,
RemoteXBeeDevice
public void sendMicroPythonData(byte[] data) throws XBeeException
AbstractXBeeDevice
data
- Data to send.XBeeException
- if there is any XBee related exception sending the
data.AbstractXBeeDevice.sendBluetoothData(byte[])
,
AbstractXBeeDevice.sendUserDataRelay(XBeeLocalInterface, byte[])
public XBeePacket sendPacket(XBeePacket packet) throws TimeoutException, XBeeException
AbstractXBeeDevice
The receive timeout is configured using the setReceiveTimeout
method and can be consulted with getReceiveTimeout
method.
Use sendXBeePacketAsync(XBeePacket)
or
#sendXBeePacket(XBeePacket, IPacketReceiveListener)
for
non-blocking operations.
packet
- XBee packet to be sent.XBeePacket
object containing the response of the sent
packet or null
if there is no response.TimeoutException
- if there is a timeout sending the XBee packet.XBeeException
- if there is any other XBee related exception.AbstractXBeeDevice.getReceiveTimeout()
,
AbstractXBeeDevice.sendXBeePacket(XBeePacket, IPacketReceiveListener)
,
AbstractXBeeDevice.sendXBeePacketAsync(XBeePacket)
,
AbstractXBeeDevice.setReceiveTimeout(int)
,
XBeePacket
public void sendPacket(XBeePacket packet, IPacketReceiveListener packetReceiveListener) throws XBeeException
AbstractXBeeDevice
null
) to be notified when the answers is received.
This is a non-blocking operation. To wait for the answer use
sendPacket(XBeePacket)
.
packet
- XBee packet to be sent.packetReceiveListener
- Listener for the operation, null
not to be notified when the answer arrives.XBeeException
- if there is any other XBee related exception.AbstractXBeeDevice.sendPacket(XBeePacket)
,
AbstractXBeeDevice.sendPacketAsync(XBeePacket)
,
IPacketReceiveListener
,
XBeePacket
public void sendPacketAsync(XBeePacket packet) throws XBeeException
AbstractXBeeDevice
This is a non-blocking operation that do not wait for the answer and is never notified when it arrives.
To be notified when the answer is received, use
AbstractXBeeDevice.sendXBeePacket(XBeePacket, IPacketReceiveListener)
.
packet
- XBee packet to be sent asynchronously.XBeeException
- if there is any other XBee related exception.AbstractXBeeDevice.sendXBeePacket(XBeePacket)
,
AbstractXBeeDevice.sendXBeePacket(XBeePacket, IPacketReceiveListener)
,
XBeePacket
public void sendUserDataRelay(XBeeLocalInterface destInterface, byte[] data) throws XBeeException
AbstractXBeeDevice
destInterface
- Destination XBee local interface.data
- Data to send.XBeeException
- if there is any XBee related exception sending the
User Data Relay message.XBeeLocalInterface
public void setReceiveTimeout(int receiveTimeout)
AbstractXBeeDevice
receiveTimeout
- The new receive timeout in milliseconds.AbstractXBeeDevice.getReceiveTimeout()
public String toString()
toString
in class AbstractXBeeDevice
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.