org.fourthline.cling.model.meta.Device.findService()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中org.fourthline.cling.model.meta.Device.findService()方法的一些代码示例,展示了Device.findService()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.findService()方法的具体详情如下:
包路径:org.fourthline.cling.model.meta.Device
类名称:Device
方法名:findService

Device.findService介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

@Override
public Service getMatchingAVTransportService(Device device, List<ProtocolInfo> infos, Res resource) {
  final Service avTransportService =
      device.findService(SUPPORTED_AV_TRANSPORT_TYPE);
  return avTransportService != null && isProtocolInfoMatch(infos, resource)
      ? avTransportService : null;
}

代码示例来源:origin: 4thline/cling

protected Service discoverConnectionService(Device device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    return null;
  }
  Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
    return null;
  }
  Device connectionDevice = connectionDevices[0];
  log.fine("Using first discovered WAN connection device: " + connectionDevice);
  Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  if (ipConnectionService == null && pppConnectionService == null) {
    log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  }
  return ipConnectionService != null ? ipConnectionService : pppConnectionService;
}

代码示例来源:origin: 4thline/cling

foundMediaRenderer.findService(SUPPORTED_CONNECTION_MGR_TYPE);

代码示例来源:origin: 4thline/cling

synchronized public Service getService(ServiceReference serviceReference) {
  Device device;
  if ((device = getDevice(serviceReference.getUdn(), false)) != null) {
    return device.findService(serviceReference.getServiceId());
  }
  return null;
}

代码示例来源:origin: kingthy/TVRemoteIME

protected Service discoverConnectionService(Device device) {
  if (!device.getType().equals(IGD_DEVICE_TYPE)) {
    return null;
  }
  Device[] connectionDevices = device.findDevices(CONNECTION_DEVICE_TYPE);
  if (connectionDevices.length == 0) {
    log.fine("IGD doesn't support '" + CONNECTION_DEVICE_TYPE + "': " + device);
    return null;
  }
  Device connectionDevice = connectionDevices[0];
  log.fine("Using first discovered WAN connection device: " + connectionDevice);
  Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
  Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);
  if (ipConnectionService == null && pppConnectionService == null) {
    log.fine("IGD doesn't support IP or PPP WAN connection service: " + device);
  }
  return ipConnectionService != null ? ipConnectionService : pppConnectionService;
}

代码示例来源:origin: kingthy/TVRemoteIME

synchronized public Service getService(ServiceReference serviceReference) {
  Device device;
  if ((device = getDevice(serviceReference.getUdn(), false)) != null) {
    return device.findService(serviceReference.getServiceId());
  }
  return null;
}

代码示例来源:origin: kaklakariada/portmapper

@SuppressWarnings("rawtypes")
  private Service<?, ?> findConnectionService(final Device[] connectionDevices) {
    for (final Device connectionDevice : connectionDevices) {

      final Service ipConnectionService = connectionDevice.findService(IP_SERVICE_TYPE);
      final Service pppConnectionService = connectionDevice.findService(PPP_SERVICE_TYPE);

      if (ipConnectionService != null) {
        logger.debug("Device {} supports ip service type: {}", connectionDevice, ipConnectionService);
        return ipConnectionService;
      }
      if (pppConnectionService != null) {
        logger.debug("Device {} supports ppp service type: {}", connectionDevice, pppConnectionService);
        return pppConnectionService;
      }

      logger.debug("IGD {} doesn't support IP or PPP WAN connection service", connectionDevice);
    }
    logger.debug("None of the {} devices supports IP or PPP WAN connections", connectionDevices.length);
    return null;
  }
}

代码示例来源:origin: trishika/DroidUPnP

@Override
public boolean asService(String service)
{
  return (device.findService(new UDAServiceType(service)) != null);
}

代码示例来源:origin: fire3/sailorcast

@Override
public boolean asService(String service)
{
  return (device.findService(new UDAServiceType(service)) != null);
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

/**
 * Sets a device as our player for play/stop and other services<br>
 * Use getAvailablePlayers() for a list of them.
 * 
 * @param device
 *          device for playing
 */
public void setPlayer(Device device) {
 this.playerService = device.findService(new UDAServiceId("AVTransport"));
 if (this.playerService == null) {
  LOGGER.warn("Could not find AVTransportService on device " + device.getDisplayString());
 }
}

代码示例来源:origin: hubing8658/UPnP-DLNA-Demo

public MediaControlBiz(Device device, Handler handler, long mId) {
  serviceAVT = device.findService(new UDAServiceType("AVTransport", 1));
  serviceRC = device
      .findService(new UDAServiceType("RenderingControl", 1));
  upnpBiz = UpnpServiceBiz.newInstance();
  this.handler = handler;
  instanceId = new UnsignedIntegerFourBytes(mId);
}

代码示例来源:origin: org.fourthline.cling/cling-core

synchronized public Service getService(ServiceReference serviceReference) {
  Device device;
  if ((device = getDevice(serviceReference.getUdn(), false)) != null) {
    return device.findService(serviceReference.getServiceId());
  }
  return null;
}

代码示例来源:origin: hezhubo/HPlayer

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  Device device = deviceList.get(position);
  currentService = device.findService(
      new UDAServiceType(UpnpServiceType.CONTENT_DIRECTORY));
  if (currentService != null) {
    mDlnaSearch.getUpnpService().getControlPoint().execute(
        new ContentBrowseActionCallback(currentService,
            createRootContainer(currentService),
            DevicesActivity.this));
  }
}

代码示例来源:origin: trishika/DroidUPnP

public static Service getRenderingControlService()
{
  if (Main.upnpServiceController.getSelectedRenderer() == null)
    return null;
  return ((CDevice) Main.upnpServiceController.getSelectedRenderer()).getDevice().findService(
      new UDAServiceType("RenderingControl"));
}

代码示例来源:origin: trishika/DroidUPnP

@SuppressWarnings("unused")
private Service getMediaReceiverRegistarService()
{
  if (Main.upnpServiceController.getSelectedContentDirectory() == null)
    return null;
  return ((CDevice) Main.upnpServiceController.getSelectedContentDirectory()).getDevice().findService(
      new UDAServiceType("X_MS_MediaReceiverRegistar"));
}

代码示例来源:origin: trishika/DroidUPnP

public static Service getAVTransportService()
{
  if (Main.upnpServiceController.getSelectedRenderer() == null)
    return null;
  return ((CDevice) Main.upnpServiceController.getSelectedRenderer()).getDevice().findService(
      new UDAServiceType("AVTransport"));
}

代码示例来源:origin: fire3/sailorcast

public static Service getAVTransportService()
{
  if (SailorCast.upnpServiceController.getSelectedRenderer() == null)
    return null;
  return ((CDevice) SailorCast.upnpServiceController.getSelectedRenderer()).getDevice().findService(
      new UDAServiceType("AVTransport"));
}

代码示例来源:origin: fire3/sailorcast

public static Service getRenderingControlService()
{
  if (SailorCast.upnpServiceController.getSelectedRenderer() == null)
    return null;
  return ((CDevice) SailorCast.upnpServiceController.getSelectedRenderer()).getDevice().findService(
      new UDAServiceType("RenderingControl"));
}

代码示例来源:origin: trishika/DroidUPnP

private Service getContentDirectoryService()
{
  if (Main.upnpServiceController.getSelectedContentDirectory() == null)
    return null;
  return ((CDevice) Main.upnpServiceController.getSelectedContentDirectory()).getDevice().findService(
      new UDAServiceType("ContentDirectory"));
}

代码示例来源:origin: hubing8658/UPnP-DLNA-Demo

/**
 * 获取根目录下内容
 * @param device
 */
public void getRootContent(Device device) {
  Service service = device.findService(new UDAServiceType("ContentDirectory", 1));
  Container rootContainer = new Container();
  rootContainer.setId("0");
  if (service != null) {
    rootContainer.setTitle("Content Directory on "
        + service.getDevice());
    execute(service, rootContainer);
  }
}

相关文章