當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。