Android net wifi rssi changed

Содержание
  1. WifiManager
  2. Constants
  3. public static final String ACTION_PICK_WIFI_NETWORK
  4. public static final int ERROR_AUTHENTICATING
  5. public static final String EXTRA_BSSID
  6. public static final String EXTRA_NETWORK_INFO
  7. public static final String EXTRA_NEW_RSSI
  8. public static final String EXTRA_NEW_STATE
  9. public static final String EXTRA_PREVIOUS_WIFI_STATE
  10. public static final String EXTRA_SUPPLICANT_CONNECTED
  11. public static final String EXTRA_SUPPLICANT_ERROR
  12. public static final String EXTRA_WIFI_INFO
  13. public static final String EXTRA_WIFI_STATE
  14. public static final String NETWORK_IDS_CHANGED_ACTION
  15. public static final String NETWORK_STATE_CHANGED_ACTION
  16. public static final String RSSI_CHANGED_ACTION
  17. public static final String SCAN_RESULTS_AVAILABLE_ACTION
  18. public static final String SUPPLICANT_CONNECTION_CHANGE_ACTION
  19. public static final String SUPPLICANT_STATE_CHANGED_ACTION
  20. public static final int WIFI_MODE_FULL
  21. public static final int WIFI_MODE_FULL_HIGH_PERF
  22. public static final int WIFI_MODE_SCAN_ONLY
  23. public static final String WIFI_STATE_CHANGED_ACTION
  24. public static final int WIFI_STATE_DISABLED
  25. public static final int WIFI_STATE_DISABLING
  26. public static final int WIFI_STATE_ENABLED
  27. public static final int WIFI_STATE_ENABLING
  28. public static final int WIFI_STATE_UNKNOWN
  29. Public Methods
  30. public int addNetwork (WifiConfiguration config)
  31. public static int calculateSignalLevel (int rssi, int numLevels)
  32. public static int compareSignalLevel (int rssiA, int rssiB)
  33. public WifiManager.MulticastLock createMulticastLock (String tag)
  34. public WifiManager.WifiLock createWifiLock (int lockType, String tag)
  35. public WifiManager.WifiLock createWifiLock (String tag)
  36. public boolean disableNetwork (int netId)
  37. public boolean disconnect ()
  38. public boolean enableNetwork (int netId, boolean disableOthers)
  39. public List getConfiguredNetworks ()
  40. public WifiInfo getConnectionInfo ()
  41. public DhcpInfo getDhcpInfo ()
  42. public List getScanResults ()
  43. public int getWifiState ()
  44. public boolean isWifiEnabled ()
  45. public boolean pingSupplicant ()
  46. public boolean reassociate ()
  47. public boolean reconnect ()
  48. public boolean removeNetwork (int netId)
  49. public boolean saveConfiguration ()
  50. public boolean setWifiEnabled (boolean enabled)
  51. public boolean startScan ()
  52. public int updateNetwork (WifiConfiguration config)
  53. Protected Methods
  54. protected void finalize ()

WifiManager

Causes a thread which is waiting on this object’s monitor (by means of calling one of the wait() methods) to be woken up.

Causes all threads which are waiting on this object’s monitor (by means of calling one of the wait() methods) to be woken up.

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

Constants

public static final String ACTION_PICK_WIFI_NETWORK

public static final int ERROR_AUTHENTICATING

public static final String EXTRA_BSSID

The lookup key for a String giving the BSSID of the access point to which we are connected. Only present when the new state is CONNECTED. Retrieve with getStringExtra(String) .

public static final String EXTRA_NETWORK_INFO

The lookup key for a NetworkInfo object associated with the Wi-Fi network. Retrieve with getParcelableExtra(String) .

public static final String EXTRA_NEW_RSSI

public static final String EXTRA_NEW_STATE

The lookup key for a SupplicantState describing the new state Retrieve with getParcelableExtra(String) .

public static final String EXTRA_PREVIOUS_WIFI_STATE

See Also

public static final String EXTRA_SUPPLICANT_CONNECTED

The lookup key for a boolean that indicates whether a connection to the supplicant daemon has been gained or lost. true means a connection now exists. Retrieve it with getBooleanExtra(String, boolean) .

public static final String EXTRA_SUPPLICANT_ERROR

The lookup key for a SupplicantState describing the supplicant error code if any Retrieve with getIntExtra(String, int) .

Читайте также:  Кнопочный телефон вай фай раздача
See Also

public static final String EXTRA_WIFI_INFO

The lookup key for a WifiInfo object giving the information about the access point to which we are connected. Only present when the new state is CONNECTED. Retrieve with getParcelableExtra(String) .

public static final String EXTRA_WIFI_STATE

The lookup key for an int that indicates whether Wi-Fi is enabled, disabled, enabling, disabling, or unknown. Retrieve it with getIntExtra(String, int) .

See Also

public static final String NETWORK_IDS_CHANGED_ACTION

The network IDs of the configured networks could have changed.

public static final String NETWORK_STATE_CHANGED_ACTION

Broadcast intent action indicating that the state of Wi-Fi connectivity has changed. One extra provides the new state in the form of a NetworkInfo object. If the new state is CONNECTED, additional extras may provide the BSSID and WifiInfo of the access point. as a String .

See Also

public static final String RSSI_CHANGED_ACTION

The RSSI (signal strength) has changed.

See Also

public static final String SCAN_RESULTS_AVAILABLE_ACTION

An access point scan has completed, and results are available from the supplicant. Call getScanResults() to obtain the results.

public static final String SUPPLICANT_CONNECTION_CHANGE_ACTION

Broadcast intent action indicating that a connection to the supplicant has been established (and it is now possible to perform Wi-Fi operations) or the connection to the supplicant has been lost. One extra provides the connection state as a boolean, where true means CONNECTED.

See Also

public static final String SUPPLICANT_STATE_CHANGED_ACTION

Broadcast intent action indicating that the state of establishing a connection to an access point has changed.One extra provides the new SupplicantState . Note that the supplicant state is Wi-Fi specific, and is not generally the most useful thing to look at if you are just interested in the overall state of connectivity.

See Also

public static final int WIFI_MODE_FULL

In this Wi-Fi lock mode, Wi-Fi will be kept active, and will behave normally, i.e., it will attempt to automatically establish a connection to a remembered access point that is within range, and will do periodic scans if there are remembered access points but none are in range.

public static final int WIFI_MODE_FULL_HIGH_PERF

In this Wi-Fi lock mode, Wi-Fi will be kept active as in mode WIFI_MODE_FULL but it operates at high performance with minimum packet loss and low packet latency even when the device screen is off. This mode will consume more power and hence should be used only when there is a need for such an active connection.

An example use case is when a voice connection needs to be kept active even after the device screen goes off. Holding the regular WIFI_MODE_FULL lock will keep the wifi connection active, but the connection can be lossy. Holding a WIFI_MODE_FULL_HIGH_PERF lock for the duration of the voice call will improve the call quality.

When there is no support from the hardware, this lock mode will have the same behavior as WIFI_MODE_FULL

public static final int WIFI_MODE_SCAN_ONLY

In this Wi-Fi lock mode, Wi-Fi will be kept active, but the only operation that will be supported is initiation of scans, and the subsequent reporting of scan results. No attempts will be made to automatically connect to remembered access points, nor will periodic scans be automatically performed looking for remembered access points. Scans must be explicitly requested by an application in this mode.

Читайте также:  Видеосвязь через wi fi

public static final String WIFI_STATE_CHANGED_ACTION

Broadcast intent action indicating that Wi-Fi has been enabled, disabled, enabling, disabling, or unknown. One extra provides this state as an int. Another extra provides the previous state, if available.

See Also

public static final int WIFI_STATE_DISABLED

See Also

public static final int WIFI_STATE_DISABLING

Wi-Fi is currently being disabled. The state will change to WIFI_STATE_DISABLED if it finishes successfully.

See Also

public static final int WIFI_STATE_ENABLED

See Also

public static final int WIFI_STATE_ENABLING

Wi-Fi is currently being enabled. The state will change to WIFI_STATE_ENABLED if it finishes successfully.

See Also

public static final int WIFI_STATE_UNKNOWN

Wi-Fi is in an unknown state. This state will occur when an error happens while enabling or disabling.

See Also

Public Methods

public int addNetwork (WifiConfiguration config)

Add a new network description to the set of configured networks. The networkId field of the supplied configuration object is ignored.

The new network will be marked DISABLED by default. To enable it, called enableNetwork(int, boolean) .

Parameters
Returns
  • the ID of the newly created network description. This is used in other operations to specified the network to be acted upon. Returns -1 on failure.

public static int calculateSignalLevel (int rssi, int numLevels)

Calculates the level of the signal. This should be used any time a signal is being shown.

Parameters
Returns

public static int compareSignalLevel (int rssiA, int rssiB)

Compares two signal strengths.

Parameters
Returns

public WifiManager.MulticastLock createMulticastLock (String tag)

Create a new MulticastLock

Parameters
Returns
See Also

public WifiManager.WifiLock createWifiLock (int lockType, String tag)

Parameters
Returns
See Also

public WifiManager.WifiLock createWifiLock (String tag)

Parameters
Returns
See Also

public boolean disableNetwork (int netId)

Disable a configured network. The specified network will not be a candidate for associating. This may result in the asynchronous delivery of state change events.

Parameters
Returns

public boolean disconnect ()

Disassociate from the currently active access point. This may result in the asynchronous delivery of state change events.

Returns

public boolean enableNetwork (int netId, boolean disableOthers)

Allow a previously configured network to be associated with. If disableOthers is true, then all other configured networks are disabled, and an attempt to connect to the selected network is initiated. This may result in the asynchronous delivery of state change events.

Parameters
Returns

public List getConfiguredNetworks ()

  • networkId
  • SSID
  • BSSID
  • priority
  • allowedProtocols
  • allowedKeyManagement
  • allowedAuthAlgorithms
  • allowedPairwiseCiphers
  • allowedGroupCiphers
Returns
  • a list of network configurations in the form of a list of WifiConfiguration objects. Upon failure to fetch or when when Wi-Fi is turned off, it can be null.

public WifiInfo getConnectionInfo ()

Return dynamic information about the current Wi-Fi connection, if any is active.

Returns

public DhcpInfo getDhcpInfo ()

Return the DHCP-assigned addresses from the last successful DHCP request, if any.

Returns

public List getScanResults ()

Return the results of the latest access point scan.

Returns

public int getWifiState ()

Gets the Wi-Fi enabled state.

Returns
See Also

public boolean isWifiEnabled ()

Return whether Wi-Fi is enabled or disabled.

Читайте также:  Have wifi at home
Returns
See Also

public boolean pingSupplicant ()

Check that the supplicant daemon is responding to requests.

Returns
  • true if we were able to communicate with the supplicant and it returned the expected response to the PING message.

public boolean reassociate ()

Reconnect to the currently active access point, even if we are already connected. This may result in the asynchronous delivery of state change events.

Returns

public boolean reconnect ()

Reconnect to the currently active access point, if we are currently disconnected. This may result in the asynchronous delivery of state change events.

Returns

public boolean removeNetwork (int netId)

Remove the specified network from the list of configured networks. This may result in the asynchronous delivery of state change events.

Parameters
Returns

public boolean saveConfiguration ()

Tell the supplicant to persist the current list of configured networks.

Note: It is possible for this method to change the network IDs of existing networks. You should assume the network IDs can be different after calling this method.

Returns

public boolean setWifiEnabled (boolean enabled)

Parameters
Returns

public boolean startScan ()

Request a scan for access points. Returns immediately. The availability of the results is made known later by means of an asynchronous event sent on completion of the scan.

Returns

public int updateNetwork (WifiConfiguration config)

Update the network description of an existing configured network.

Parameters
Returns
  • Returns the networkId of the supplied WifiConfiguration on success.
    Returns -1 on failure, including when the networkId field of the WifiConfiguration does not refer to an existing network.

Protected Methods

protected void finalize ()

Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.

Note that objects that override finalize are significantly more expensive than objects that don’t. Finalizers may be run a long time after the object is no longer reachable, depending on memory pressure, so it’s a bad idea to rely on them for cleanup. Note also that finalizers are run on a single VM-wide finalizer thread, so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary for a class that has a native peer and needs to call a native method to destroy that peer. Even then, it’s better to provide an explicit close method (and implement Closeable ), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like a BigInteger where typical calling code would have to deal with lots of temporaries. Unfortunately, code that creates lots of temporaries is the worst kind of code from the point of view of the single finalizer thread.

If you must use finalizers, consider at least providing your own ReferenceQueue and having your own thread process that queue.

Unlike constructors, finalizers are not automatically chained. You are responsible for calling super.finalize() yourself.

Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, «Avoid finalizers» for more.

Источник

Оцените статью
Adblock
detector