public class IPv6Device extends XBeeDevice
ThreadDevice
Modifier and Type | Method and Description |
---|---|
void |
addIPDataListener(IIPDataReceiveListener listener)
Adds the provided listener to the list of listeners to be notified
when new IP data is received.
|
void |
readDeviceInfo()
Reads some parameters from this device and obtains its protocol.
|
IPMessage |
readIPData()
Reads new IPv6 data received by this XBee device during the
configured receive timeout.
|
IPMessage |
readIPData(int timeout)
Reads new IPv6 data received by this XBee device during the provided
timeout.
|
IPMessage |
readIPDataFrom(Inet6Address ipv6Address)
Reads new IPv6 data received from the given IPv6 address during the
configured receive timeout.
|
IPMessage |
readIPDataFrom(Inet6Address ipv6Address,
int timeout)
Reads new IPv6 data received from the given IPv6 address during the
provided timeout.
|
void |
removeIPDataListener(IIPDataReceiveListener listener)
Removes the provided listener from the list of IP data listeners.
|
void |
sendIPData(Inet6Address ipv6Address,
int destPort,
IPProtocol protocol,
byte[] data)
Sends the provided IPv6 data to the given IPv6 address and port using
the specified IPv6 protocol.
|
void |
sendIPDataAsync(Inet6Address ipv6Address,
int destPort,
IPProtocol protocol,
byte[] data)
Sends the provided IPv6 data to the given IPv6 address and port
asynchronously using the specified IPv6 protocol.
|
void |
startListening(int sourcePort)
Starts listening for incoming IPv6 transmissions in the provided port.
|
void |
stopListening()
Stops listening for incoming IPv6 transmissions.
|
addBluetoothDataListener, addDataListener, addIOSampleListener, addMicroPythonDataListener, addModemStatusListener, addPacketListener, addUserDataRelayListener, close, getNetwork, getNextFrameID, getOperatingMode, getReceiveTimeout, isOpen, isRemote, open, readData, readData, readDataFrom, readDataFrom, readPacket, readPacket, readPacketFrom, readPacketFrom, removeBluetoothDataListener, removeDataListener, removeIOSampleListener, removeMicroPythonDataListener, removeModemStatusListener, removePacketListener, removeUserDataRelayListener, reset, sendBluetoothData, sendBroadcastData, sendData, sendDataAsync, sendMicroPythonData, sendPacket, sendPacket, sendPacketAsync, sendUserDataRelay, setReceiveTimeout, 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, readIOSample, setDestinationAddress, setDIOChangeDetection, setDIOValue, setIOConfiguration, setIOSamplingRate, setIPv6DestinationAddress, setNodeID, setPANID, setParameter, setPowerLevel, setPWMDutyCycle, updateBluetoothPassword, updateDeviceDataFrom, writeChanges
public void addIPDataListener(IIPDataReceiveListener listener)
AbstractXBeeDevice
If the listener has been already included this method does nothing.
listener
- Listener to be notified when new IP data is
received.AbstractXBeeDevice.removeIPDataListener(IIPDataReceiveListener)
,
IIPDataReceiveListener
public void readDeviceInfo() throws TimeoutException, XBeeException
AbstractXBeeDevice
This method refresh the values of:
readDeviceInfo
in class AbstractXBeeDevice
TimeoutException
- if there is a timeout reading the parameters.XBeeException
- if there is any error trying to read the device information or
if there is any other XBee related exception.AbstractXBeeDevice.get16BitAddress()
,
AbstractXBeeDevice.get64BitAddress()
,
AbstractXBeeDevice.getHardwareVersion()
,
AbstractXBeeDevice.getNodeID()
,
AbstractXBeeDevice.getFirmwareVersion()
,
AbstractXBeeDevice.getXBeeProtocol()
,
AbstractXBeeDevice.setNodeID(String)
public IPMessage readIPData()
This method blocks until new IPv6 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 IIPDataReceiveListener
using the method addIPDataListener(IIPDataReceiveListener)
.
Before reading IPv6 data you need to start listening for incoming
IPv6 data at a specific port. Use the startListening
method
for that purpose. When finished, you can use the stopListening
method to stop listening for incoming IPv6 data.
IPMessage
object containing the IPv6 data and
the IPv6 address that sent the data. null
if this did not
receive new IPv6 data during the configured receive timeout.InterfaceNotOpenException
- if this device connection is not open.XBeeDevice.getReceiveTimeout()
,
readIPData(int)
,
readIPDataFrom(Inet6Address)
,
readIPDataFrom(Inet6Address, int)
,
XBeeDevice.setReceiveTimeout(int)
,
startListening(int)
,
stopListening()
,
IPMessage
public IPMessage readIPData(int timeout)
This method blocks until new IPv6 data is received or the provided timeout expires.
For non-blocking operations, register a IIPDataReceiveListener
using the method addIPDataListener(IIPDataReceiveListener)
.
Before reading IPv6 data you need to start listening for incoming
IPv6 data at a specific port. Use the startListening
method
for that purpose. When finished, you can use the stopListening
method to stop listening for incoming IPv6 data.
timeout
- The time to wait for new IPv6 data in milliseconds.IPMessage
object containing the data and the IPv6
address that sent the data. null
if this device did not
receive new data during timeout
milliseconds.IllegalArgumentException
- if timeout < 0
.InterfaceNotOpenException
- if this device connection is not open.readIPData()
,
readIPDataFrom(Inet6Address)
,
readIPDataFrom(Inet6Address, int)
,
startListening(int)
,
stopListening()
,
IPMessage
public IPMessage readIPDataFrom(Inet6Address ipv6Address)
This method blocks until new data from the provided IPv6 address 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 IIPDataReceiveListener
using the method addIPDataListener(IIPDataReceiveListener)
.
Before reading IPv6 data you need to start listening for incoming
IPv6 data at a specific port. Use the startListening
method
for that purpose. When finished, you can use the stopListening
method to stop listening for incoming IPv6 data.
ipv6Address
- The IPv6 address to read data from.IPMessage
object containing the IPv6 data and
the IPv6 address of the remote node that sent the data.
null
if this device did not receive new IPv6 data
from the provided IPv6 address during the configured receive
timeout.InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ipv6Address == null
.XBeeDevice.getReceiveTimeout()
,
readIPData()
,
readIPData(int)
,
readIPDataFrom(Inet6Address, int)
,
XBeeDevice.setReceiveTimeout(int)
,
startListening(int)
,
stopListening()
,
IPMessage
,
Inet6Address
public IPMessage readIPDataFrom(Inet6Address ipv6Address, int timeout)
This method blocks until new IPv6 data from the provided IPv6 address is received or the given timeout expires.
For non-blocking operations, register a IIPDataReceiveListener
using the method addIPDataListener(IIPDataReceiveListener)
.
Before reading IPv6 data you need to start listening for incoming
IPv6 data at a specific port. Use the startListening
method
for that purpose. When finished, you can use the stopListening
method to stop listening for incoming IPv6 data.
ipv6Address
- The IPv6 address to read data from.timeout
- The time to wait for new IPv6 data in milliseconds.IPMessage
object containing the IPv6 data and
the IPv6 address that sent the data. null
if this device
did not receive new IPv6 data from the provided IPv6 address
during timeout
milliseconds.IllegalArgumentException
- if timeout < 0
.InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ipv6Address == null
.readIPDataFrom(Inet6Address)
,
readIPData()
,
readIPData(int)
,
startListening(int)
,
stopListening()
,
IPMessage
,
Inet6Address
public void removeIPDataListener(IIPDataReceiveListener 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.addIPDataListener(IIPDataReceiveListener)
,
IIPDataReceiveListener
public void sendIPData(Inet6Address ipv6Address, int destPort, IPProtocol protocol, byte[] data) throws TimeoutException, XBeeException
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
sendIPDataAsync(Inet6Address, int, IPProtocol, byte[])
.
ipv6Address
- The IPv6 address to send IPv6 data to.destPort
- The destination port of the transmission.protocol
- The IPv6 protocol used for the transmission.data
- Byte array containing the IPv6 data to be sent.IllegalArgumentException
- if destPort < 0
or
if destPort > 65535
InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ipv6Address == null
or
if protocol == null
or
if data == null
.TimeoutException
- if there is a timeout sending the data.XBeeException
- if there is any other XBee related exception.XBeeDevice.getReceiveTimeout()
,
sendIPDataAsync(Inet6Address, int, IPProtocol, byte[])
,
XBeeDevice.setReceiveTimeout(int)
,
IPProtocol
,
Inet6Address
public void sendIPDataAsync(Inet6Address ipv6Address, int destPort, IPProtocol protocol, byte[] data) throws XBeeException
Asynchronous transmissions do not wait for answer from the remote device or for transmit status packet.
ipv6Address
- The IPv6 address to send IPv6 data to.destPort
- The destination port of the transmission.protocol
- The IPv6 protocol used for the transmission.data
- Byte array containing the IPv6 data to be sent.IllegalArgumentException
- if destPort < 0
or
if destPort > 65535
InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ipv6Address == null
or
if protocol == null
or
if data == null
.TimeoutException
- if there is a timeout sending the data.XBeeException
- if there is any other XBee related exception.sendIPData(Inet6Address, int, IPProtocol, byte[])
,
IPProtocol
,
Inet6Address
public void startListening(int sourcePort) throws TimeoutException, XBeeException
sourcePort
- Port to listen for incoming transmissions.IllegalArgumentException
- if sourcePort < 0
or
if sourcePort > 65535
.TimeoutException
- if there is a timeout setting the source port.XBeeException
- if there is any error setting the source port.stopListening()
public void stopListening() throws TimeoutException, XBeeException
TimeoutException
- if there is a timeout processing the operation.XBeeException
- if there is any other XBee related exception.startListening(int)
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.