Android
android.net.wifi
public class

android.net.wifi.WifiStateTracker

java.lang.Object
android.os.Handler
android.net.NetworkStateTracker
android.net.wifi.WifiStateTracker

Track the state of Wifi connectivity. All event handling is done here, and all changes in connectivity state are initiated here.

Summary

Constants inherited from class android.net.NetworkStateTracker
Fields inherited from class android.net.NetworkStateTracker

Public Constructors

            WifiStateTracker(Context context, Handler target)

Public Methods

          DhcpInfo  getDhcpInfo()
          String[]  getNameServers()
Return the IP addresses of the DNS servers available for the WLAN network interface.
  synchronized        List<ScanResult getScanResultsList()
          void  handleMessage(Message msg)
Subclasses must implement this to receive messages.
          void  interpretScanResultsAvailable()
Interprets scan results.
          boolean  isAvailable()
Wi-Fi is considered available as long as we have a connection to the supplicant daemon and there is at least one enabled network.
          boolean  isConnectionCompleted()
Report whether the Wi-Fi connection is fully configured for data.
  synchronized        boolean  reconnect()
Reenable Wi-Fi connectivity, by iterating through the list of saved network statuses, and reenabling each network that had been enabled before teardown() was called.
          WifiInfo  requestConnectionInfo()
Get status information for the current connection, if any.
          boolean  setRadio(boolean turnOn)
Turn the wireless radio off for a network.
  synchronized        void  setScanResultsList(List<ScanResult> scanList)
          void  startEventLoop()
          void  startMonitoring()
          int  startUsingNetworkFeature(String feature)
Tells the underlying networking system that the caller wants to begin using the named feature. There are currently no Wi-Fi-specific features supported.
          int  stopUsingNetworkFeature(String feature)
Tells the underlying networking system that the caller is finished using the named feature. There are currently no Wi-Fi-specific features supported.
  synchronized        boolean  teardown()
Disable Wi-Fi connectivity.
          String  toString()
Returns a string containing a concise, human-readable description of the receiver.
Methods inherited from class android.net.NetworkStateTracker
Methods inherited from class android.os.Handler
Methods inherited from class java.lang.Object

Details

Public Constructors

public WifiStateTracker(Context context, Handler target)

Public Methods

public DhcpInfo getDhcpInfo()

public String[] getNameServers()

Return the IP addresses of the DNS servers available for the WLAN network interface.

Returns

  • a list of DNS addresses, with no holes.

public synchronized List<ScanResult> getScanResultsList()

public void handleMessage(Message msg)

Subclasses must implement this to receive messages.

public void interpretScanResultsAvailable()

Interprets scan results. This will be called at a safe time for processing, and from a safe thread.

public boolean isAvailable()

Wi-Fi is considered available as long as we have a connection to the supplicant daemon and there is at least one enabled network.

Returns

  • true if Wi-Fi connections are possible

public boolean isConnectionCompleted()

Report whether the Wi-Fi connection is fully configured for data.

Returns

public synchronized boolean reconnect()

Reenable Wi-Fi connectivity, by iterating through the list of saved network statuses, and reenabling each network that had been enabled before teardown() was called. The network that had been active at the time of the teardown() might not be the one chosen by the supplicant to connect to after being re-enabled.

public WifiInfo requestConnectionInfo()

Get status information for the current connection, if any.

Returns

  • a WifiInfo object containing information about the current connection

public boolean setRadio(boolean turnOn)

Turn the wireless radio off for a network.

Parameters

turnOn true to turn the radio on, false

public synchronized void setScanResultsList(List<ScanResult> scanList)

public void startEventLoop()

public void startMonitoring()

public int startUsingNetworkFeature(String feature)

Tells the underlying networking system that the caller wants to begin using the named feature. The interpretation of feature is completely up to each networking implementation. There are currently no Wi-Fi-specific features supported.

Parameters

feature the name of the feature

Returns

  • -1 indicating failure, always

public int stopUsingNetworkFeature(String feature)

Tells the underlying networking system that the caller is finished using the named feature. The interpretation of feature is completely up to each networking implementation. There are currently no Wi-Fi-specific features supported.

Parameters

feature the name of the feature

Returns

  • -1 indicating failure, always

public synchronized boolean teardown()

Disable Wi-Fi connectivity. We do this by going through all the configured Wi-Fi networks and disabling them, so that the supplicant will not attempt to connect to any network. We save the disabled/enabled state of the original list, so that reconnect() can restore it.

Returns

  • true if a teardown occurred, false if the teardown did not occur.

public String toString()

Returns a string containing a concise, human-readable description of the receiver.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48