public class WiFiDevice extends IPDevice
CellularDevice
,
DigiPointDevice
,
DigiMeshDevice
,
Raw802Device
,
ThreadDevice
,
XBeeDevice
,
ZigBeeDevice
BROADCAST_IP
Constructor and Description |
---|
WiFiDevice(IConnectionInterface connectionInterface)
Class constructor.
|
WiFiDevice(String port,
int baudRate)
Class constructor.
|
WiFiDevice(String port,
int baudRate,
int dataBits,
int stopBits,
int parity,
int flowControl)
Class constructor.
|
WiFiDevice(String port,
SerialPortParameters serialPortParameters)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
connect(AccessPoint accessPoint,
String password)
Connects to the provided access point.
|
boolean |
connect(String ssid,
String password)
Connects to the access point with provided SSID.
|
boolean |
disconnect()
Disconnects from the access point the device is connected to.
|
AccessPoint |
getAccessPoint(String ssid)
Finds and reports the access point that matches the supplied SSID.
|
int |
getAccessPointTimeout()
Returns the configured access point timeout for connecting,
disconnecting and scanning access points.
|
Inet4Address |
getDNSAddress()
Returns the IP address of domain name server.
|
Inet4Address |
getGatewayIPAddress()
Returns the IP address of the gateway.
|
IPAddressingMode |
getIPAddressingMode()
Returns the IP addressing mode.
|
Inet4Address |
getIPAddressMask()
Returns the IP address subnet mask.
|
WiFiAssociationIndicationStatus |
getWiFiAssociationIndicationStatus()
Returns the current association status of this Wi-Fi device.
|
XBeeProtocol |
getXBeeProtocol()
Returns the XBee Protocol of this XBee device.
|
boolean |
isConnected()
Returns whether the device is connected to an access point or not.
|
void |
open()
Opens the connection interface associated with this XBee device.
|
List<AccessPoint> |
scanAccessPoints()
Performs a scan to search for access points in the vicinity.
|
void |
setAccessPointTimeout(int accessPointTimeout)
Configures the access point timeout in milliseconds for connecting,
disconnecting and scanning access points.
|
void |
setDNSAddress(Inet4Address address)
Sets the IP address of domain name server.
|
void |
setGatewayIPAddress(Inet4Address address)
Sets the IP address of the gateway.
|
void |
setIPAddress(Inet4Address address)
Sets the IP address of the module.
|
void |
setIPAddressingMode(IPAddressingMode mode)
Sets the IP addressing mode.
|
void |
setIPAddressMask(Inet4Address address)
Sets the IP address subnet mask.
|
addIPDataListener, getDestinationIPAddress, getIPAddress, readDeviceInfo, readIPData, readIPData, readIPDataFrom, readIPDataFrom, removeIPDataListener, sendBroadcastIPData, sendIPData, sendIPData, sendIPDataAsync, sendIPDataAsync, setDestinationIPAddress, startListening, stopListening
addBluetoothDataListener, addDataListener, addIOSampleListener, addMicroPythonDataListener, addModemStatusListener, addPacketListener, addUserDataRelayListener, close, getNetwork, getNextFrameID, getOperatingMode, getReceiveTimeout, isOpen, isRemote, 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, isApplyConfigurationChangesEnabled, readIOSample, setDestinationAddress, setDIOChangeDetection, setDIOValue, setIOConfiguration, setIOSamplingRate, setIPv6DestinationAddress, setNodeID, setPANID, setParameter, setPowerLevel, setPWMDutyCycle, updateBluetoothPassword, updateDeviceDataFrom, writeChanges
public WiFiDevice(IConnectionInterface connectionInterface)
WiFiDevice
object with
the given connection interface.connectionInterface
- The connection interface with the physical
Wi-Fi device.NullPointerException
- if connectionInterface == null
WiFiDevice(String, int)
,
WiFiDevice(String, SerialPortParameters)
,
WiFiDevice(String, int, int, int, int, int)
,
IConnectionInterface
public WiFiDevice(String port, int baudRate)
WiFiDevice
object in
the given port name and baud rate.port
- Serial port name where Wi-Fi 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
.WiFiDevice(IConnectionInterface)
,
WiFiDevice(String, SerialPortParameters)
,
WiFiDevice(String, int, int, int, int, int)
public WiFiDevice(String port, int baudRate, int dataBits, int stopBits, int parity, int flowControl)
WiFiDevice
object in
the given serial port name and settings.port
- Serial port name where Wi-Fi 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
.WiFiDevice(IConnectionInterface)
,
WiFiDevice(String, int)
,
WiFiDevice(String, SerialPortParameters)
public WiFiDevice(String port, SerialPortParameters serialPortParameters)
WiFiDevice
object in
the given serial port name and parameters.port
- Serial port name where Wi-Fi device is attached to.serialPortParameters
- Object containing the serial port parameters.NullPointerException
- if port == null
or
if serialPortParameters == null
.WiFiDevice(IConnectionInterface)
,
WiFiDevice(String, int)
,
WiFiDevice(String, int, int, int, int, int)
,
SerialPortParameters
public boolean connect(AccessPoint accessPoint, String password) throws TimeoutException, XBeeException
This method blocks until the connection with the access point is established or the configured access point timeout expires.
The access point timeout is configured using the
setAccessPointTimeout
method and can be consulted with
getAccessPointTimeout
method.
Once the module is connected to the access point, you can issue
the writeSettings
method to save the connection settings. This
way the module will try to connect to the access point every time it
is powered on.
accessPoint
- The access point to connect to.password
- The password for the access point, null
if it
does not have any encryption enabled.true
if the module connected to the access point
successfully, false
otherwise.InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if accessPoint == null
.TimeoutException
- if there is a timeout sending the connect
commands.XBeeException
- if there is any other XBee related exception.connect(String, String)
,
disconnect()
,
getAccessPoint(String)
,
getAccessPointTimeout()
,
scanAccessPoints()
,
setAccessPointTimeout(int)
,
AccessPoint
public boolean connect(String ssid, String password) throws TimeoutException, XBeeException
This method blocks until the connection with the access point is established or the configured access point timeout expires.
The access point timeout is configured using the
setAccessPointTimeout
method and can be consulted with
getAccessPointTimeout
method.
Once the module is connected to the access point, you can issue
the AbstractXBeeDevice.writeChanges()
method to save the connection settings. This
way the module will try to connect to the access point every time it
is powered on.
ssid
- The SSID of the access point to connect to.password
- The password for the access point, null
if it
does not have any encryption enabled.true
if the module connected to the access point
successfully, false
otherwise.InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ssid == null
.TimeoutException
- if there is a timeout sending the connect
commands.XBeeException
- if the SSID provided is null
or if there
is any other XBee related exception.connect(AccessPoint, String)
,
disconnect()
,
getAccessPoint(String)
,
getAccessPointTimeout()
,
scanAccessPoints()
,
setAccessPointTimeout(int)
public boolean disconnect() throws TimeoutException, XBeeException
This method blocks until the device disconnects totally from the access point or the configured access point timeout expires.
The access point timeout is configured using the
setAccessPointTimeout
method and can be consulted with
getAccessPointTimeout
method.
true
if the module disconnected from the access point
successfully, false
otherwise.InterfaceNotOpenException
- if this device connection is not open.TimeoutException
- if there is a timeout sending the disconnect
command.XBeeException
- if there is any other XBee related exception.connect(AccessPoint, String)
,
connect(String, String)
,
getAccessPointTimeout()
,
setAccessPointTimeout(int)
public AccessPoint getAccessPoint(String ssid) throws XBeeException
This method blocks until the access point is discovered or the configured access point timeout expires.
The access point timeout is configured using the
setAccessPointTimeout
method and can be consulted with
getAccessPointTimeout
method.
ssid
- The SSID of the access point to discover.null
if the timeout expires and the access point was not found.InterfaceNotOpenException
- if this device connection is not open.NullPointerException
- if ssid == null
.TimeoutException
- if there is a timeout getting the access point.XBeeException
- if there is an error sending the discovery command.getAccessPointTimeout()
,
scanAccessPoints()
,
setAccessPointTimeout(int)
public int getAccessPointTimeout()
setAccessPointTimeout(int)
public Inet4Address getDNSAddress() throws TimeoutException, XBeeException
TimeoutException
- if there is a timeout reading the DNS address.XBeeException
- if there is any other XBee related exception.setDNSAddress(Inet4Address)
,
Inet4Address
public Inet4Address getGatewayIPAddress() throws TimeoutException, XBeeException
TimeoutException
- if there is a timeout reading the gateway IP
address.XBeeException
- if there is any other XBee related exception.setGatewayIPAddress(Inet4Address)
,
Inet4Address
public IPAddressingMode getIPAddressingMode() throws TimeoutException, XBeeException
TimeoutException
- if there is a timeout reading the IP addressing
mode.XBeeException
- if there is any other XBee related exception.setIPAddressingMode(IPAddressingMode)
,
IPAddressingMode
public Inet4Address getIPAddressMask() throws TimeoutException, XBeeException
TimeoutException
- if there is a timeout reading the IP address
mask.XBeeException
- if there is any other XBee related exception.setIPAddressMask(Inet4Address)
,
Inet4Address
public WiFiAssociationIndicationStatus getWiFiAssociationIndicationStatus() throws TimeoutException, XBeeException
It indicates occurrences of errors during the Wi-Fi transceiver initialization and connection.
InterfaceNotOpenException
- if this device connection is not open.TimeoutException
- if there is a timeout getting the association
indication status.XBeeException
- if there is any other XBee related exception.WiFiAssociationIndicationStatus
public XBeeProtocol getXBeeProtocol()
AbstractXBeeDevice
To refresh this value use the AbstractXBeeDevice.readDeviceInfo()
method.
getXBeeProtocol
in class AbstractXBeeDevice
XBeeProtocol
public boolean isConnected() throws TimeoutException, XBeeException
true
if the device is connected to an access point,
false
otherwise.InterfaceNotOpenException
- if this device connection is not open.TimeoutException
- if there is a timeout getting the association
indication status.XBeeException
- if there is any other XBee related exception.getWiFiAssociationIndicationStatus()
,
WiFiAssociationIndicationStatus
public void open() throws XBeeException
AbstractXBeeDevice
When opening the device an information reading process is automatically performed. This includes:
open
in class XBeeDevice
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 List<AccessPoint> scanAccessPoints() throws XBeeException
This method blocks until all the access points are discovered or the configured access point timeout expires.
The access point timeout is configured using the
setAccessPointTimeout
method and can be consulted with
getAccessPointTimeout
method.
InterfaceNotOpenException
- if this device connection is not open.TimeoutException
- if there is a timeout scanning the access points.XBeeException
- if there is any other XBee related exception.getAccessPoint(String)
,
getAccessPointTimeout()
,
setAccessPointTimeout(int)
public void setAccessPointTimeout(int accessPointTimeout)
accessPointTimeout
- The new access point timeout in milliseconds.IllegalArgumentException
- if accessPointTimeout < 0
.getAccessPointTimeout()
public void setDNSAddress(Inet4Address address) throws TimeoutException, XBeeException
address
- DNS address.NullPointerException
- if address == null
.TimeoutException
- if there is a timeout setting the DNS address.XBeeException
- if there is any other XBee related exception.getDNSAddress()
,
Inet4Address
public void setGatewayIPAddress(Inet4Address address) throws TimeoutException, XBeeException
This method can only be called if the module is configured in
IPAddressingMode.STATIC
mode. Otherwise an XBeeException
will be thrown.
address
- IP address of the gateway.NullPointerException
- if address == null
.TimeoutException
- if there is a timeout setting the gateway IP
address.XBeeException
- if the module is in IPAddressingMode.DHCP
mode or there is any other XBee related exception.getGatewayIPAddress()
,
getIPAddressingMode()
,
Inet4Address
public void setIPAddress(Inet4Address address) throws TimeoutException, XBeeException
This method can only be called if the module is configured in
IPAddressingMode.STATIC
mode. Otherwise an XBeeException
will be thrown.
address
- IP address.NullPointerException
- if address == null
.TimeoutException
- if there is a timeout setting the IP address.XBeeException
- if the module is in IPAddressingMode.DHCP
mode or there is any other XBee related exception.IPDevice.getIPAddress()
,
getIPAddressingMode()
,
Inet4Address
public void setIPAddressingMode(IPAddressingMode mode) throws TimeoutException, XBeeException
mode
- IP addressing mode.NullPointerException
- if mode == null
.TimeoutException
- if there is a timeout setting the IP addressing
mode.XBeeException
- if there is any other XBee related exception.getIPAddressingMode()
,
IPAddressingMode
public void setIPAddressMask(Inet4Address address) throws TimeoutException, XBeeException
This method can only be called if the module is configured in
IPAddressingMode.STATIC
mode. Otherwise an XBeeException
will be thrown.
address
- IP address subnet mask.NullPointerException
- if address == null
.TimeoutException
- if there is a timeout setting the IP address
mask.XBeeException
- if the module is in IPAddressingMode.DHCP
mode or there is any other XBee related exception.getIPAddressingMode()
,
getIPAddressMask()
,
Inet4Address
© Copyright 2014 - 2024 Digi International Inc. All rights reserved.