当前位置: 首页>>代码示例>>Java>>正文


Java Service类代码示例

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

        }
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:23,代码来源:DLNAService.java

示例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);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:38,代码来源:DLNAService.java

示例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();
                    }
                }
            }
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:37,代码来源:DLNAService.java

示例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);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:13,代码来源:DLNAServiceTest.java

示例5: setServiceList

import com.connectsdk.discovery.provider.ssdp.Service; //导入依赖的package包/类
public void setServiceList(List<Service> serviceList) {
    this.serviceList = serviceList;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:4,代码来源:ServiceDescription.java

示例6: getServiceList

import com.connectsdk.discovery.provider.ssdp.Service; //导入依赖的package包/类
public List<Service> getServiceList() {
    return serviceList;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:4,代码来源:ServiceDescription.java


注:本文中的com.connectsdk.discovery.provider.ssdp.Service类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。