public class WifiNetworkManager
extends java.lang.Object
WifiManager
,
NetworkInterfaceManager
Constructor and Description |
---|
WifiNetworkManager()
Instantiates a WifiNetworkManager with a default
AccessPointConfiguration and
SoftAPConfiguration . |
WifiNetworkManager(AccessPointConfiguration configurationAP,
ej.ecom.wifi.SoftAPConfiguration softAPConfiguration)
Instantiates a WifiNetworkManager.
|
Modifier and Type | Method and Description |
---|---|
AccessPointConfiguration |
getAPConfiguration()
Gets the configurationAP.
|
ej.ecom.wifi.WifiCapability |
getCapabilities()
Gets the
WifiCapability . |
java.lang.String |
getInterfaceName()
Gets the interfaceName.
|
ej.ecom.wifi.AccessPoint |
getJoinedAccessPoint()
Gets the joined access.
|
ej.ecom.wifi.SoftAPConfiguration |
getSoftAPConfiguration()
Gets the softAPConfiguration.
|
ej.ecom.wifi.WifiManager |
getWifiManager()
Gets the Wi-FI manager used.
|
boolean |
isConnected()
Checks if the Wi-FI is connected to network.
|
boolean |
isInit()
Checks if the Wi-FI Manager is initialized.
|
boolean |
isSoftAPEnabled()
Checks if the Wi-FI is has enabled the softAP.
|
void |
joinAccessPoint(ej.ecom.wifi.AccessPoint access,
java.lang.String password,
int timeout)
Joins a specific
AccessPoint . |
void |
joinAccessPoint(int timeout)
Joins the access point configuration selected.
|
void |
joinAccessPoint(java.lang.String ssid,
java.lang.String password,
ej.ecom.wifi.SecurityMode securityMode,
int timeout)
Joins a particular Access Point.
|
void |
leaveAccessPoint()
Leaves the joined Access Point.
|
void |
mountSoftAccessPoint()
Mounts a Soft Access Point.
|
void |
mountSoftAccessPoint(ej.ecom.wifi.SoftAPConfiguration config)
Mounts a Soft Access Point.
|
ej.ecom.wifi.AccessPoint[] |
scanAccessPoints()
Scans Access Points.
|
void |
setAPConfiguration(AccessPointConfiguration configurationAP)
Sets the configurationAP.
|
void |
setClientIPConfigure(ej.ecom.network.IPConfiguration ipConfiguration)
Sets the
IPConfiguration for the interface while in client mode. |
void |
setInterfaceName(java.lang.String interfaceName)
Sets the interfaceName.
|
void |
setScanWhileSoftAP(boolean scanWhileSoftAP)
Sets whether it supports scan while mounted.
|
void |
setSoftAPConfiguration(ej.ecom.wifi.SoftAPConfiguration softAPConfiguration)
Sets the softAPConfiguration.
|
void |
setSoftAPIPConfigure(ej.ecom.network.IPConfiguration softAPIPConfiguration)
Sets the
IPConfiguration for the interface while in softAP. |
boolean |
supportScanWhileSoftAP()
Gets whether it supports scan while in softAP.
|
void |
unmountSoftAccessPoint()
Unmounts a Soft Access Point.
|
public WifiNetworkManager() throws java.io.IOException
AccessPointConfiguration
and
SoftAPConfiguration
.java.io.IOException
- When initialise fail.WifiNetworkManager(AccessPointConfiguration, SoftAPConfiguration)
public WifiNetworkManager(@NonNull AccessPointConfiguration configurationAP, @NonNull ej.ecom.wifi.SoftAPConfiguration softAPConfiguration) throws java.io.IOException, java.lang.NullPointerException
configurationAP
- the configurationAP to use.softAPConfiguration
- the softAPConfiguration to use.java.io.IOException
- When initialise fail.java.lang.NullPointerException
- if parameters are null
or WifiManager
not found.WifiManager.getInstance()
public boolean isInit()
true
if the Wi-FI manager is initialized.NetworkInterfaceManager.isEnabled(NetworkInterface)
public ej.ecom.wifi.AccessPoint[] scanAccessPoints() throws java.io.IOException
java.io.IOException
- if an error occurred.WifiManager.scan()
public void joinAccessPoint(int timeout) throws java.io.IOException, java.lang.NullPointerException, java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
timeout
- the timeout to wait for an IP, 0 for unlimited, cannot be less than 0.java.io.IOException
- if an error occurred.java.lang.NullPointerException
- if AP is not set.java.lang.UnsupportedOperationException
- If the Wi-Fi does not support client mode.java.lang.IllegalArgumentException
- if timeout is less than 0.getAPConfiguration()
,
AccessPointConfiguration.setAccessPoint(AccessPoint)
,
joinAccessPoint(AccessPoint, String, int)
,
joinAccessPoint(AccessPoint, String, int)
,
joinAccessPoint(String, String, SecurityMode, int)
public void joinAccessPoint(@NonNull ej.ecom.wifi.AccessPoint access, @Nullable java.lang.String password, int timeout) throws java.io.IOException, java.lang.NullPointerException, java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
AccessPoint
.access
- the AccessPoint
to join.password
- the AccessPoint
password.timeout
- the timeout to wait for an IP, 0 for unlimited, cannot be less than 0.java.io.IOException
- if an error occurred.java.lang.NullPointerException
- if the AP is null
.java.lang.UnsupportedOperationException
- If the Wi-Fi does not support client mode.java.lang.IllegalArgumentException
- if timeout is less than 0.WifiManager.join(AccessPoint, String)
public void joinAccessPoint(@NonNull java.lang.String ssid, @Nullable java.lang.String password, @Nullable ej.ecom.wifi.SecurityMode securityMode, int timeout) throws java.io.IOException, java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
ssid
- the AP SSID.password
- the AP password.securityMode
- the security Mode to use.timeout
- the timeout to wait for an IP, 0 for unlimited, cannot be less than 0.java.io.IOException
- if an error occurred.java.lang.UnsupportedOperationException
- If the Wi-Fi does not support client mode.java.lang.IllegalArgumentException
- if timeout is less than 0.WifiManager.join(String, String)
public void leaveAccessPoint() throws java.io.IOException
java.io.IOException
- if an error occurred.WifiManager.leave()
public boolean isConnected() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.WifiManager.getJoined()
public boolean isSoftAPEnabled() throws java.io.IOException
java.io.IOException
- If an I/O error occurs.WifiManager.isSoftAPEnabled()
public ej.ecom.wifi.AccessPoint getJoinedAccessPoint() throws java.io.IOException
null
if none.java.io.IOException
- If an I/O error occurs.WifiManager.getJoined()
public AccessPointConfiguration getAPConfiguration()
public void setAPConfiguration(@NonNull AccessPointConfiguration configurationAP)
configurationAP
- the configurationAP to set.public ej.ecom.wifi.SoftAPConfiguration getSoftAPConfiguration()
public void setSoftAPConfiguration(@NonNull ej.ecom.wifi.SoftAPConfiguration softAPConfiguration) throws java.lang.NullPointerException
softAPConfiguration
- the softAPConfiguration to set, cannot be null
.java.lang.NullPointerException
- if SoftAPConfiguration
is null
.public void mountSoftAccessPoint() throws java.io.IOException
java.io.IOException
- if an error occurred.WifiManager.enableSoftAP(SoftAPConfiguration)
public void mountSoftAccessPoint(@NonNull ej.ecom.wifi.SoftAPConfiguration config) throws java.io.IOException, java.lang.UnsupportedOperationException
config
- the configuration to use.java.io.IOException
- if an error occurred.java.lang.UnsupportedOperationException
- If the Wi-Fi does not support SoftAP mode.WifiManager.enableSoftAP(SoftAPConfiguration)
public void unmountSoftAccessPoint() throws java.io.IOException
java.io.IOException
- if an error occurred.WifiManager.disableSoftAP()
public boolean supportScanWhileSoftAP()
true
if scan while mounted is supported.public void setScanWhileSoftAP(boolean scanWhileSoftAP)
scanWhileSoftAP
- true
if scan while mounted is supported.public ej.ecom.wifi.WifiCapability getCapabilities() throws java.io.IOException
WifiCapability
.java.io.IOException
- If an I/O error occurs.WifiManager.getCapability()
public void setClientIPConfigure(@Nullable ej.ecom.network.IPConfiguration ipConfiguration)
IPConfiguration
for the interface while in client mode. This will be taken in account on the
next join.ipConfiguration
- the IPConfiguration
to use, can be null
then it won't be used.public void setSoftAPIPConfigure(@Nullable ej.ecom.network.IPConfiguration softAPIPConfiguration)
IPConfiguration
for the interface while in softAP. This will be taken in account on the next
mountSoftAccessPoint()
.softAPIPConfiguration
- the IPConfiguration
to use when in softAP.public java.lang.String getInterfaceName()
public void setInterfaceName(@Nullable java.lang.String interfaceName)
interfaceName
- the interfaceName to set.public ej.ecom.wifi.WifiManager getWifiManager()