FileDocCategorySizeDatePackage
WifiP2pUpnpServiceInfo.javaAPI DocAndroid 5.1 API3784Thu Mar 12 22:22:44 GMT 2015android.net.wifi.p2p.nsd

WifiP2pUpnpServiceInfo

public class WifiP2pUpnpServiceInfo extends WifiP2pServiceInfo
A class for storing Upnp service information that is advertised over a Wi-Fi peer-to-peer setup. {@see android.net.wifi.p2p.WifiP2pManager#addLocalService} {@see android.net.wifi.p2p.WifiP2pManager#removeLocalService} {@see WifiP2pServiceInfo} {@see WifiP2pDnsSdServiceInfo}

Fields Summary
public static final int
VERSION_1_0
UPnP version 1.0.
Query Version should always be set to 0x10 if the query values are
compatible with UPnP Device Architecture 1.0.
Constructors Summary
private WifiP2pUpnpServiceInfo(List queryList)
This constructor is only used in newInstance().

param
queryList


                  
       
        super(queryList);
    
Methods Summary
private static java.lang.StringcreateSupplicantQuery(java.lang.String uuid, java.lang.String data)
Create wpa_supplicant service query for upnp.

param
uuid
param
data
return
wpa_supplicant service query for upnp

        StringBuffer sb = new StringBuffer();
        sb.append("upnp ");
        sb.append(String.format(Locale.US, "%02x ", VERSION_1_0));
        sb.append("uuid:");
        sb.append(uuid);
        if (data != null) {
            sb.append("::");
            sb.append(data);
        }
        return sb.toString();
    
public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfonewInstance(java.lang.String uuid, java.lang.String device, java.util.List services)
Create UPnP service information object.

param
uuid a string representation of this UUID in the following format, as per RFC 4122.
e.g) 6859dede-8574-59ab-9332-123456789012
param
device a string representation of this device in the following format, as per UPnP Device Architecture1.1
e.g) urn:schemas-upnp-org:device:MediaServer:1
param
services a string representation of this service in the following format, as per UPnP Device Architecture1.1
e.g) urn:schemas-upnp-org:service:ContentDirectory:1
return
UPnP service information object.

        if (uuid == null || device == null) {
            throw new IllegalArgumentException("uuid or device cannnot be null");
        }
        UUID.fromString(uuid);

        ArrayList<String> info = new ArrayList<String>();

        info.add(createSupplicantQuery(uuid, null));
        info.add(createSupplicantQuery(uuid, "upnp:rootdevice"));
        info.add(createSupplicantQuery(uuid, device));
        if (services != null) {
            for (String service:services) {
                info.add(createSupplicantQuery(uuid, service));
            }
        }

        return new WifiP2pUpnpServiceInfo(info);