Methods Summary |
---|
public void | clearFlag(java.lang.String flag)
validateFlag(flag);
mFlags.remove(flag);
|
public int | describeContents(){@inheritDoc}
return 0;
|
public java.lang.Iterable | getFlags()
return mFlags;
|
public java.lang.String | getHardwareAddress()
return mHwAddr;
|
public LinkAddress | getLinkAddress()
return mAddr;
|
public boolean | hasFlag(java.lang.String flag)
validateFlag(flag);
return mFlags.contains(flag);
|
public boolean | isActive()This function determines if the interface is up and has a valid IP
configuration (IP address has a non zero octet).
Note: It is supposed to be quick and hence should not initiate
any network activity
try {
if (hasFlag(FLAG_UP)) {
for (byte b : mAddr.getAddress().getAddress()) {
if (b != 0) return true;
}
}
} catch (NullPointerException e) {
return false;
}
return false;
|
public void | setFlag(java.lang.String flag)
validateFlag(flag);
mFlags.add(flag);
|
public void | setHardwareAddress(java.lang.String hwAddr)
mHwAddr = hwAddr;
|
public void | setInterfaceDown()Set flags to mark interface as down.
mFlags.remove(FLAG_UP);
mFlags.add(FLAG_DOWN);
|
public void | setInterfaceUp()Set flags to mark interface as up.
mFlags.remove(FLAG_DOWN);
mFlags.add(FLAG_UP);
|
public void | setLinkAddress(LinkAddress addr)
mAddr = addr;
|
public java.lang.String | toString()
final StringBuilder builder = new StringBuilder();
builder.append("mHwAddr=").append(mHwAddr);
builder.append(" mAddr=").append(String.valueOf(mAddr));
builder.append(" mFlags=").append(getFlags());
return builder.toString();
|
private static void | validateFlag(java.lang.String flag)
if (flag.indexOf(' ") >= 0) {
throw new IllegalArgumentException("flag contains space: " + flag);
}
|
public void | writeToParcel(android.os.Parcel dest, int flags){@inheritDoc}
dest.writeString(mHwAddr);
if (mAddr != null) {
dest.writeByte((byte)1);
dest.writeParcelable(mAddr, flags);
} else {
dest.writeByte((byte)0);
}
dest.writeInt(mFlags.size());
for (String flag : mFlags) {
dest.writeString(flag);
}
|