本文整理匯總了Java中com.connectsdk.discovery.provider.ssdp.Service類的典型用法代碼示例。如果您正苦於以下問題:Java Service類的具體用法?Java Service怎麽用?Java Service使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Service類屬於com.connectsdk.discovery.provider.ssdp包,在下文中一共展示了Service類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateControlURL
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
private void updateControlURL() {
List<Service> serviceList = serviceDescription.getServiceList();
if (serviceList != null) {
for (int i = 0; i < serviceList.size(); i++) {
if(!serviceList.get(i).baseURL.endsWith("/")) {
serviceList.get(i).baseURL += "/";
}
if (serviceList.get(i).serviceType.contains(AV_TRANSPORT)) {
avTransportURL = makeControlURL(serviceList.get(i).baseURL, serviceList.get(i).controlURL);
}
else if ((serviceList.get(i).serviceType.contains(RENDERING_CONTROL)) && !(serviceList.get(i).serviceType.contains(GROUP_RENDERING_CONTROL))) {
renderingControlURL = makeControlURL(serviceList.get(i).baseURL, serviceList.get(i).controlURL);
}
else if ((serviceList.get(i).serviceType.contains(CONNECTION_MANAGER)) ) {
connectionControlURL = makeControlURL(serviceList.get(i).baseURL, serviceList.get(i).controlURL);
}
}
}
}
示例2: resubscribeServices
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
public void resubscribeServices() {
resubscriptionTimer = new Timer();
resubscriptionTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Util.runInBackground(new Runnable() {
@Override
public void run() {
List<Service> serviceList = serviceDescription.getServiceList();
if (serviceList != null) {
for (int i = 0; i < serviceList.size(); i++) {
String eventSubURL = makeControlURL("/", serviceList.get(i).eventSubURL);
if (eventSubURL == null) {
continue;
}
String SID = SIDList.get(serviceList.get(i).serviceType);
try {
HttpConnection connection = HttpConnection.newSubscriptionInstance(
new URI("http", "", serviceDescription.getIpAddress(), serviceDescription.getPort(), eventSubURL, "", ""));
connection.setMethod(HttpConnection.Method.SUBSCRIBE);
connection.setHeader("TIMEOUT", "Second-" + TIMEOUT);
connection.setHeader("SID", SID);
connection.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
});
}
}, TIMEOUT/2*1000, TIMEOUT/2*1000);
}
示例3: unsubscribeServices
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
public void unsubscribeServices() {
if (resubscriptionTimer != null) {
resubscriptionTimer.cancel();
}
Util.runInBackground(new Runnable() {
@Override
public void run() {
final List<Service> serviceList = serviceDescription.getServiceList();
if (serviceList != null) {
for (int i = 0; i < serviceList.size(); i++) {
String eventSubURL = makeControlURL("/", serviceList.get(i).eventSubURL);
if (eventSubURL == null) {
continue;
}
String sid = SIDList.get(serviceList.get(i).serviceType);
try {
HttpConnection connection = HttpConnection.newSubscriptionInstance(
new URI("http", "", serviceDescription.getIpAddress(), serviceDescription.getPort(), eventSubURL, "", ""));
connection.setMethod(HttpConnection.Method.UNSUBSCRIBE);
connection.setHeader("SID", sid);
connection.execute();
if (connection.getResponseCode() == 200) {
SIDList.remove(serviceList.get(i).serviceType);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
});
}
示例4: makeServiceWithControlURL
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
private DLNAService makeServiceWithControlURL(String base, String controlURL) {
List<Service> services = new ArrayList<Service>();
Service service = new Service();
service.baseURL = base;
service.controlURL = controlURL;
service.serviceType = DLNAService.AV_TRANSPORT;
services.add(service);
ServiceDescription description = Mockito.mock(ServiceDescription.class);
Mockito.when(description.getServiceList()).thenReturn(services);
return new DLNAService(description, Mockito.mock(ServiceConfig.class), Robolectric.application, null);
}
示例5: setServiceList
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
public void setServiceList(List<Service> serviceList) {
this.serviceList = serviceList;
}
示例6: getServiceList
import com.connectsdk.discovery.provider.ssdp.Service; //導入依賴的package包/類
public List<Service> getServiceList() {
return serviceList;
}