Package network.datahop.wifidirect
Class WifiLink
- java.lang.Object
-
- network.datahop.wifidirect.WifiLink
-
- All Implemented Interfaces:
datahop.WifiConnection
public class WifiLink extends java.lang.Object implements datahop.WifiConnection
WifiLink can be used to automatically join a Wifi-Direct group in autonomous mode or a legacy WiFi connection (i.e., WiFi Hotspot). It disconnects from current WiFi connection, in case it is connected, when calling connect() method, and reconnects after calling disconnect() method.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ConectionStateConnected
static int
ConectionStateConnecting
static int
ConectionStateDisconnected
static int
ConectionStateNONE
static int
ConectionStatePreConnecting
static java.lang.String
TAG
static long
wifiConnectionWaitingTime
-
Constructor Summary
Constructors Constructor Description WifiLink(android.content.Context context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(java.lang.String SSID, java.lang.String password)
This method disconnects from any existing Wifi connection to join the SSID specified as an input parameter.void
connect(java.lang.String SSID, java.lang.String password, java.lang.String ip)
This method disconnects from any existing Wifi connection to join the SSID specified as an input parameter.void
disconnect()
This method disconnects from the specified network in the connect() method and rejoins any prexisting Wifi connection.static WifiLink
getInstance(android.content.Context appContext)
void
setNotifier(datahop.WifiConnectionNotifier notifier)
Set the notifier that receives the events advertised when creating or destroying the group or when receiving users connections
-
-
-
Field Detail
-
wifiConnectionWaitingTime
public static final long wifiConnectionWaitingTime
- See Also:
- Constant Field Values
-
ConectionStateNONE
public static final int ConectionStateNONE
- See Also:
- Constant Field Values
-
ConectionStatePreConnecting
public static final int ConectionStatePreConnecting
- See Also:
- Constant Field Values
-
ConectionStateConnecting
public static final int ConectionStateConnecting
- See Also:
- Constant Field Values
-
ConectionStateConnected
public static final int ConectionStateConnected
- See Also:
- Constant Field Values
-
ConectionStateDisconnected
public static final int ConectionStateDisconnected
- See Also:
- Constant Field Values
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static WifiLink getInstance(android.content.Context appContext)
-
setNotifier
public void setNotifier(datahop.WifiConnectionNotifier notifier)
Set the notifier that receives the events advertised when creating or destroying the group or when receiving users connections- Parameters:
notifier
- instance
-
connect
public void connect(java.lang.String SSID, java.lang.String password)
This method disconnects from any existing Wifi connection to join the SSID specified as an input parameter. DHCP is used for IP configuration.- Parameters:
SSID
- of the WiFi network to joinpassword
- of the WiFi network to join
-
connect
public void connect(java.lang.String SSID, java.lang.String password, java.lang.String ip)
This method disconnects from any existing Wifi connection to join the SSID specified as an input parameter. IP address is configure statically from the input parameter- Specified by:
connect
in interfacedatahop.WifiConnection
- Parameters:
SSID
- of the WiFi network to joinpassword
- of the WiFi network to joinip
- address to configure statically
-
disconnect
public void disconnect()
This method disconnects from the specified network in the connect() method and rejoins any prexisting Wifi connection.- Specified by:
disconnect
in interfacedatahop.WifiConnection
-
-