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

WifiP2pDnsSdServiceRequest

public class WifiP2pDnsSdServiceRequest extends WifiP2pServiceRequest
A class for creating a Bonjour service discovery request for use with {@link WifiP2pManager#addServiceRequest} and {@link WifiP2pManager#removeServiceRequest} {@see WifiP2pManager} {@see WifiP2pServiceRequest} {@see WifiP2pUpnpServiceRequest}

Fields Summary
Constructors Summary
private WifiP2pDnsSdServiceRequest(String query)
This constructor is only used in newInstance().

param
query The part of service specific query.
hide

        super(WifiP2pServiceInfo.SERVICE_TYPE_BONJOUR, query);
    
private WifiP2pDnsSdServiceRequest()
This constructor is only used in newInstance().

hide

        super(WifiP2pServiceInfo.SERVICE_TYPE_BONJOUR, null);
    
private WifiP2pDnsSdServiceRequest(String dnsQuery, int dnsType, int version)

        super(WifiP2pServiceInfo.SERVICE_TYPE_BONJOUR, WifiP2pDnsSdServiceInfo.createRequest(
                dnsQuery,
                dnsType,
                version));
    
Methods Summary
public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequestnewInstance()
Create a service discovery request to search all Bonjour services.

return
service request for Bonjour.

        return new WifiP2pDnsSdServiceRequest();
    
public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequestnewInstance(java.lang.String serviceType)
Create a service discovery to search for Bonjour services with the specified service type.

param
serviceType service type. Cannot be null
"_afpovertcp._tcp."(Apple File Sharing over TCP)
"_ipp._tcp" (IP Printing over TCP)
"_http._tcp" (http service)
return
service request for DnsSd.

        if (serviceType == null) {
            throw new IllegalArgumentException("service type cannot be null");
        }
        return new WifiP2pDnsSdServiceRequest(serviceType + ".local.",
                WifiP2pDnsSdServiceInfo.DNS_TYPE_PTR,
                WifiP2pDnsSdServiceInfo.VERSION_1);
    
public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequestnewInstance(java.lang.String instanceName, java.lang.String serviceType)
Create a service discovery request to get the TXT data from the specified Bonjour service.

param
instanceName instance name. Cannot be null.
"MyPrinter"
param
serviceType service type. Cannot be null.
e.g)
"_afpovertcp._tcp"(Apple File Sharing over TCP)
"_ipp._tcp" (IP Printing over TCP)
return
service request for Bonjour.

        if (instanceName == null || serviceType == null) {
            throw new IllegalArgumentException(
                    "instance name or service type cannot be null");
        }
        String fullDomainName = instanceName + "." + serviceType + ".local.";
        return new WifiP2pDnsSdServiceRequest(fullDomainName,
                WifiP2pDnsSdServiceInfo.DNS_TYPE_TXT,
                WifiP2pDnsSdServiceInfo.VERSION_1);