1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.cts.verifier.p2p.testcase; 17 18 import java.util.ArrayList; 19 import java.util.HashMap; 20 import java.util.List; 21 import java.util.Map; 22 23 import android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceInfo; 24 import android.net.wifi.p2p.nsd.WifiP2pServiceInfo; 25 import android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfo; 26 27 public class LocalServices { 28 29 30 /** 31 * Create UPnP MediaRenderer local service. 32 * @return 33 */ 34 static WifiP2pServiceInfo createRendererService() { 35 List<String> services = new ArrayList<String>(); 36 services.add("urn:schemas-upnp-org:service:AVTransport:1"); 37 services.add("urn:schemas-upnp-org:service:ConnectionManager:1"); 38 return WifiP2pUpnpServiceInfo.newInstance( 39 "6859dede-8574-59ab-9332-123456789011", 40 "urn:schemas-upnp-org:device:MediaRenderer:1", 41 services); 42 } 43 44 /** 45 * Create Bonjour IPP local service. 46 * @return 47 */ 48 static WifiP2pServiceInfo createIppService() { 49 Map<String, String> txtRecord = new HashMap<String, String>(); 50 txtRecord.put("txtvers", "1"); 51 txtRecord.put("pdl", "application/postscript"); 52 return WifiP2pDnsSdServiceInfo.newInstance("MyPrinter", 53 "_ipp._tcp", txtRecord); 54 } 55 56 /** 57 * Create Bonjour AFP local service. 58 * @return 59 */ 60 static WifiP2pServiceInfo createAfpService() { 61 return WifiP2pDnsSdServiceInfo.newInstance("Example", 62 "_afpovertcp._tcp", null); 63 } 64 } 65