public class RestSoftAPConnector extends SoftAPConnector
SoftAPConfiguration
using rest endpoints. Three endpoints are available:
ScanEndPoint
at url /scan
JoinEndPoint
at url /join
DiagnosticEndPoint
at url /diagnostic
Modifier and Type | Class and Description |
---|---|
static class |
RestSoftAPConnector.STATE
The server states.
|
Constructor and Description |
---|
RestSoftAPConnector()
Instantiates a
RestSoftAPConnector . |
RestSoftAPConnector(ConfigurationManager configurationManager)
Instantiates a RestSoftAPConnector with a
ConfigurationManager . |
RestSoftAPConnector(ConfigurationManager configurationManager,
int port)
Instantiates a RestSoftAPConnector with a
ConfigurationManager . |
RestSoftAPConnector(ConfigurationManager configurationManager,
int port,
WifiNetworkManager manager)
Instantiates a RestSoftAPConnector with a
ConfigurationManager . |
RestSoftAPConnector(int port)
Instantiates a
RestSoftAPConnector with a given port. |
Modifier and Type | Method and Description |
---|---|
protected void |
addEnpoints(RestartableServer server)
Adds the server endpoints.
|
java.lang.String |
getAccesses()
Gets the access point in cache.
|
java.lang.String |
getJoined()
Gets the cached joined.
|
int |
getServerPort()
Gets the server port.
|
RestSoftAPConnector.STATE |
getState()
Gets the server state.
|
protected void |
onMount(SoftAPConfiguration softAPConfiguration)
Called when the softAP has been mounted.
|
protected void |
onSuccessfulJoin(AccessPointConfiguration accessPointConfiguration)
Called when a successful join is done.
|
protected void |
onUnmount()
Called when the softAP has been unmounted.
|
void |
setServerPort(int serverPort)
Sets the server port.
|
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 . |
void |
triggerJoin(AccessPointConfiguration accessPointConfiguration)
Triggers a join.
|
void |
triggerUpdateAccess()
Triggers an update of the access points.
|
protected void |
unmountSoftAP()
Unmounts the softAp.
|
addListener, getConfigurationManager, getManager, join, mountSoftAP, onJoin, onScan, removeListener, scan, setConfigurationManager, setIPConfiguration
public RestSoftAPConnector() throws java.io.IOException
RestSoftAPConnector
.java.io.IOException
- When initialisation fails.public RestSoftAPConnector(int port) throws java.io.IOException
RestSoftAPConnector
with a given port.port
- the server port.java.io.IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager) throws java.io.IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
managing access points configuration..java.io.IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager, int port) throws java.io.IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
.port
- the server port.java.io.IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager, int port, @NonNull WifiNetworkManager manager) throws java.io.IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
.port
- the server port.manager
- the WifiNetworkManager
to use.java.io.IOException
- When initialisation fails.public void start() throws java.io.IOException
SoftAPConnector
SoftAPConnector
:
ConfigurationManager
ConfigurationManager
does not provide one or if the join fails, mounts the SoftAP.start
in class SoftAPConnector
java.io.IOException
- if an IOException
occurs.SoftAPConnector.join(AccessPointConfiguration)
,
ConfigurationManager.loadAPConfiguration()
public void stop()
SoftAPConnector
SoftAPConnector
.stop
in class SoftAPConnector
public int getServerPort()
public void setServerPort(int serverPort)
serverPort
- the server portpublic RestSoftAPConnector.STATE getState()
public void triggerUpdateAccess()
public void triggerJoin(AccessPointConfiguration accessPointConfiguration)
accessPointConfiguration
- the configuration to join.WifiNetworkManager.getCapabilities()
public java.lang.String getAccesses()
public java.lang.String getJoined()
protected void onSuccessfulJoin(AccessPointConfiguration accessPointConfiguration)
SoftAPConnector
onSuccessfulJoin
in class SoftAPConnector
accessPointConfiguration
- the apConfiguration joined.protected void onMount(SoftAPConfiguration softAPConfiguration)
SoftAPConnector
onMount
in class SoftAPConnector
softAPConfiguration
- the configuration used, not null
.protected void unmountSoftAP() throws java.io.IOException
SoftAPConnector
unmountSoftAP
in class SoftAPConnector
java.io.IOException
- if an IOException
occurs during unmount.protected void onUnmount()
SoftAPConnector
onUnmount
in class SoftAPConnector
protected void addEnpoints(RestartableServer server) throws java.io.IOException
server
- the server.java.io.IOException
- if the endpoints could not be added.