本文整理汇总了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;
}