public class SoftAPConnector
extends java.lang.Object
Constructor and Description |
---|
SoftAPConnector()
Instantiates a
SoftAPConnector with a DefaultConfigurationManager as default implementation for
managing access points configuration. |
SoftAPConnector(ConfigurationManager configurationManager)
Instantiates a
SoftAPConnector with a given ConfigurationManager . |
SoftAPConnector(ConfigurationManager configurationManager,
ej.net.util.wifi.WifiNetworkManager wifiNetworkManager)
Instantiates a
SoftAPConnector with a given ConfigurationManager . |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ConnectorListener connectorListener)
Adds a
ConnectorListener . |
ConfigurationManager |
getConfigurationManager()
Gets the configuration manager.
|
ej.net.util.wifi.WifiNetworkManager |
getManager()
Gets the Wi-Fi manager.
|
boolean |
join(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
Joins an
AccessPoint , if the join fail, mount a SoftAP. |
protected void |
mountSoftAP()
Mounts the SoftAp.
|
protected void |
onJoin(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
Called before a join.
|
protected void |
onMount(ej.ecom.wifi.SoftAPConfiguration softAPConfiguration)
Called when the softAP has been mounted.
|
protected void |
onScan(ej.ecom.wifi.AccessPoint[] accessPoints)
Called when a scan is done.
|
protected void |
onSuccessfulJoin(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
Called when a successful join is done.
|
protected void |
onUnmount()
Called when the softAP has been unmounted.
|
void |
removeListener(ConnectorListener connectorListener)
Removes a
ConnectorListener . |
ej.ecom.wifi.AccessPoint[] |
scan()
Scans the available
AccessPoint . |
void |
setConfigurationManager(ConfigurationManager configurationManager)
Sets the configuration manager, can not be
null . |
void |
setIPConfiguration(ej.ecom.network.IPConfiguration configuration,
ej.ecom.network.IPConfiguration softAPConfiguration)
Sets the IP configuration.
|
void |
start()
Starts the
SoftAPConnector :
Sets the Wi-Fi network manager configuration.
Tries to join the ConfigurationManager
If the ConfigurationManager does not provide one or if the join fails, mounts the SoftAP.
|
void |
stop()
Stops the
SoftAPConnector . |
protected void |
unmountSoftAP()
Unmounts the softAp.
|
public SoftAPConnector() throws java.io.IOException
SoftAPConnector
with a DefaultConfigurationManager
as default implementation for
managing access points configuration.java.io.IOException
- When initialisation fails.public SoftAPConnector(@NonNull ConfigurationManager configurationManager) throws java.io.IOException, java.lang.NullPointerException
SoftAPConnector
with a given ConfigurationManager
.configurationManager
- the ConfigurationManager
to use to get the softAp and AP parameters.java.io.IOException
- When initialization fails.java.lang.NullPointerException
- If configurationManager or WifiNetworkManager
is null
.public SoftAPConnector(@NonNull ConfigurationManager configurationManager, @NonNull ej.net.util.wifi.WifiNetworkManager wifiNetworkManager) throws java.io.IOException, java.lang.NullPointerException
SoftAPConnector
with a given ConfigurationManager
.configurationManager
- the ConfigurationManager
to use to get the softAp and AP parameters.wifiNetworkManager
- the WifiNetworkManager
, cannot be null
java.io.IOException
- When initialization fails.java.lang.NullPointerException
- If configurationManager or WifiNetworkManager
is null
.public void setConfigurationManager(ConfigurationManager configurationManager)
null
.configurationManager
- The ConfigurationManager
to use for managing access points configuration.java.lang.NullPointerException
- If configurationManager is null
.public ConfigurationManager getConfigurationManager()
public void start() throws java.io.IOException
SoftAPConnector
:
ConfigurationManager
ConfigurationManager
does not provide one or if the join fails, mounts the SoftAP.java.io.IOException
- if an IOException
occurs.join(AccessPointConfiguration)
,
ConfigurationManager.loadAPConfiguration()
public void stop()
SoftAPConnector
.public ej.ecom.wifi.AccessPoint[] scan() throws java.io.IOException
AccessPoint
.AccessPoint
.java.io.IOException
- if an IOException
occurs.WifiNetworkManager.scanAccessPoints()
public boolean join(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
AccessPoint
, if the join fail, mount a SoftAP.apConfiguration
- the AccessPointConfiguration
to use.WifiNetworkManager.joinAccessPoint(int)
,
WifiNetworkManager.mountSoftAccessPoint()
protected void onJoin(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
apConfiguration
- the apConfiguration joined.protected void onSuccessfulJoin(ej.net.util.wifi.AccessPointConfiguration apConfiguration)
apConfiguration
- the apConfiguration joined.protected void onScan(ej.ecom.wifi.AccessPoint[] accessPoints)
accessPoints
- the accesspoints.protected void mountSoftAP() throws java.io.IOException
java.io.IOException
- if an IOException occured during the mount.protected void unmountSoftAP() throws java.io.IOException
java.io.IOException
- if an IOException
occurs during unmount.protected void onUnmount()
protected void onMount(ej.ecom.wifi.SoftAPConfiguration softAPConfiguration)
softAPConfiguration
- the configuration used, not null
.public void addListener(ConnectorListener connectorListener)
ConnectorListener
.connectorListener
- the listener, cannot be null
.public void removeListener(ConnectorListener connectorListener)
ConnectorListener
.connectorListener
- the listener, cannot be null
.public ej.net.util.wifi.WifiNetworkManager getManager()
WifiNetworkManager
.public void setIPConfiguration(ej.ecom.network.IPConfiguration configuration, ej.ecom.network.IPConfiguration softAPConfiguration)
start()
.configuration
- the IPConfiguration
to use for the client mode, can be null
.softAPConfiguration
- IPConfiguration
to use for the softAP, can be null
.