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.
|
String |
getAccesses()
Gets the access point in cache.
|
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 IOException
RestSoftAPConnector
.IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager) throws IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
managing access points configuration..IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager, int port) throws IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
.port
- the server port.IOException
- When initialisation fails.public RestSoftAPConnector(ConfigurationManager configurationManager, int port, @NonNull WifiNetworkManager manager) throws IOException
ConfigurationManager
.configurationManager
- the ConfigurationManager
.port
- the server port.manager
- the WifiNetworkManager
to use.IOException
- When initialisation fails.public RestSoftAPConnector(int port) throws IOException
RestSoftAPConnector
with a given port.port
- the server port.IOException
- When initialisation fails.protected void addEnpoints(RestartableServer server) throws IOException
server
- the server.IOException
- if the endpoints could not be added.public String getAccesses()
public String getJoined()
public int getServerPort()
public RestSoftAPConnector.STATE getState()
protected void onMount(SoftAPConfiguration softAPConfiguration)
SoftAPConnector
onMount
in class SoftAPConnector
softAPConfiguration
- the configuration used, not null
.protected void onSuccessfulJoin(AccessPointConfiguration accessPointConfiguration)
SoftAPConnector
onSuccessfulJoin
in class SoftAPConnector
accessPointConfiguration
- the apConfiguration joined.protected void onUnmount()
SoftAPConnector
onUnmount
in class SoftAPConnector
public void setServerPort(int serverPort)
serverPort
- the server portpublic void start() throws IOException
SoftAPConnector
SoftAPConnector
:
ConfigurationManager
ConfigurationManager
does not provide one or if the join fails, mounts the SoftAP.start
in class SoftAPConnector
IOException
- if an IOException
occurs.SoftAPConnector.join(AccessPointConfiguration)
,
ConfigurationManager.loadAPConfiguration()
public void stop()
SoftAPConnector
SoftAPConnector
.stop
in class SoftAPConnector
public void triggerJoin(AccessPointConfiguration accessPointConfiguration)
accessPointConfiguration
- the configuration to join.WifiNetworkManager.getCapabilities()
public void triggerUpdateAccess()
protected void unmountSoftAP() throws IOException
SoftAPConnector
unmountSoftAP
in class SoftAPConnector
IOException
- if an IOException
occurs during unmount.