Methods Summary |
---|
public int | describeContents()Implement the Parcelable interface {@hide}
return 0;
|
public boolean | equals(java.lang.Object o)
if (o == this) {
return true;
}
if (!(o instanceof WifiP2pServiceRequest)) {
return false;
}
WifiP2pServiceRequest req = (WifiP2pServiceRequest)o;
/*
* Not compare transaction id.
* Transaction id may be changed on each service discovery operation.
*/
if ((req.mProtocolType != mProtocolType) ||
(req.mLength != mLength)) {
return false;
}
if (req.mQuery == null && mQuery == null) {
return true;
} else if (req.mQuery != null) {
return req.mQuery.equals(mQuery);
}
return false;
|
public java.lang.String | getSupplicantQuery()Return wpa_supplicant request string.
The format is the hex dump of the following frame.
_______________________________________________________________
| Length (2) | Type (1) | Transaction ID (1) |
| Query Data (variable) |
StringBuffer sb = new StringBuffer();
// length is retained as little endian format.
sb.append(String.format(Locale.US, "%02x", (mLength) & 0xff));
sb.append(String.format(Locale.US, "%02x", (mLength >> 8) & 0xff));
sb.append(String.format(Locale.US, "%02x", mProtocolType));
sb.append(String.format(Locale.US, "%02x", mTransId));
if (mQuery != null) {
sb.append(mQuery);
}
return sb.toString();
|
public int | getTransactionId()Return transaction id.
return mTransId;
|
public int | hashCode()
int result = 17;
result = 31 * result + mProtocolType;
result = 31 * result + mLength;
result = 31 * result + (mQuery == null ? 0 : mQuery.hashCode());
return result;
|
public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest | newInstance(int protocolType, java.lang.String queryData)Create a service discovery request.
return new WifiP2pServiceRequest(protocolType, queryData);
|
public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest | newInstance(int protocolType)Create a service discovery request.
return new WifiP2pServiceRequest(protocolType, null);
|
public void | setTransactionId(int id)Set transaction id.
mTransId = id;
|
private void | validateQuery(java.lang.String query)Validate query.
If invalid, throw IllegalArgumentException.
if (query == null) {
return;
}
int UNSIGNED_SHORT_MAX = 0xffff;
if (query.length()%2 == 1) {
throw new IllegalArgumentException(
"query size is invalid. query=" + query);
}
if (query.length()/2 > UNSIGNED_SHORT_MAX) {
throw new IllegalArgumentException(
"query size is too large. len=" + query.length());
}
// check whether query is hex string.
query = query.toLowerCase(Locale.ROOT);
char[] chars = query.toCharArray();
for (char c: chars) {
if (!((c >= '0" && c <= '9") ||
(c >= 'a" && c <= 'f"))){
throw new IllegalArgumentException(
"query should be hex string. query=" + query);
}
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface {@hide}
dest.writeInt(mProtocolType);
dest.writeInt(mLength);
dest.writeInt(mTransId);
dest.writeString(mQuery);
|