FileDocCategorySizeDatePackage
EthernetManager.javaAPI DocAndroid 5.1 API4964Thu Mar 12 22:22:10 GMT 2015android.net

EthernetManager

public class EthernetManager extends Object
A class representing the IP configuration of the Ethernet network.
hide

Fields Summary
private static final String
TAG
private static final int
MSG_AVAILABILITY_CHANGED
private final android.content.Context
mContext
private final android.net.IEthernetManager
mService
private final android.os.Handler
mHandler
private final ArrayList
mListeners
private final IEthernetServiceListener.Stub
mServiceListener
Constructors Summary
public EthernetManager(android.content.Context context, android.net.IEthernetManager service)
Create a new EthernetManager instance. Applications will almost always want to use {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve the standard {@link android.content.Context#ETHERNET_SERVICE Context.ETHERNET_SERVICE}.


                   
       
                                   
           
    

                               
         
        mContext = context;
        mService = service;
    
Methods Summary
public voidaddListener(android.net.EthernetManager$Listener listener)
Adds a listener.

param
listener A {@link Listener} to add.
throws
IllegalArgumentException If the listener is null.

        if (listener == null) {
            throw new IllegalArgumentException("listener must not be null");
        }
        mListeners.add(listener);
        if (mListeners.size() == 1) {
            try {
                mService.addListener(mServiceListener);
            } catch (NullPointerException | RemoteException e) {
            }
        }
    
public android.net.IpConfigurationgetConfiguration()
Get Ethernet configuration.

return
the Ethernet Configuration, contained in {@link IpConfiguration}.

        try {
            return mService.getConfiguration();
        } catch (NullPointerException | RemoteException e) {
            return new IpConfiguration();
        }
    
public booleanisAvailable()
Indicates whether the system currently has one or more Ethernet interfaces.

        try {
            return mService.isAvailable();
        } catch (NullPointerException | RemoteException e) {
            return false;
        }
    
public voidremoveListener(android.net.EthernetManager$Listener listener)
Removes a listener.

param
listener A {@link Listener} to remove.
throws
IllegalArgumentException If the listener is null.

        if (listener == null) {
            throw new IllegalArgumentException("listener must not be null");
        }
        mListeners.remove(listener);
        if (mListeners.isEmpty()) {
            try {
                mService.removeListener(mServiceListener);
            } catch (NullPointerException | RemoteException e) {
            }
        }
    
public voidsetConfiguration(android.net.IpConfiguration config)
Set Ethernet configuration.

        try {
            mService.setConfiguration(config);
        } catch (NullPointerException | RemoteException e) {
        }