public class ConnectionClassManager
extends java.lang.Object
Class used to calculate the approximate bandwidth of a user's connection.
This class notifies all subscribed ConnectionClassManager.ConnectionClassStateChangeListener with the new
ConnectionClass when the network's ConnectionClass changes.
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
ConnectionClassManager.ConnectionClassStateChangeListener
Interface for listening to when
ConnectionClassManager
changes state. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addBandwidth(long bytes,
long timeInMs)
Adds bandwidth to the current filtered latency counter.
|
ConnectionQuality |
getCurrentBandwidthQuality()
Get the ConnectionQuality that the moving bandwidth average currently represents.
|
double |
getDownloadKBitsPerSecond()
Accessor method for the current bandwidth average.
|
static ConnectionClassManager |
getInstance()
Retrieval method for the DownloadBandwidthManager singleton.
|
ConnectionQuality |
register(ConnectionClassManager.ConnectionClassStateChangeListener listener)
Method for adding new listeners to this class.
|
void |
remove(ConnectionClassManager.ConnectionClassStateChangeListener listener)
Method for removing listeners from this class.
|
void |
reset()
Resets the bandwidth average for this instance of the bandwidth manager.
|
public static ConnectionClassManager getInstance()
public void addBandwidth(long bytes,
long timeInMs)
ConnectionClassManager.ConnectionClassStateChangeListener if the counter moves from one bucket
to another (i.e. poor bandwidth -> moderate bandwidth).public void reset()
public ConnectionQuality getCurrentBandwidthQuality()
public double getDownloadKBitsPerSecond()
public ConnectionQuality register(ConnectionClassManager.ConnectionClassStateChangeListener listener)
listener - ConnectionClassManager.ConnectionClassStateChangeListener to add as a listener.public void remove(ConnectionClassManager.ConnectionClassStateChangeListener listener)
listener - Reference to the ConnectionClassManager.ConnectionClassStateChangeListener to be removed.