本文整理了Java中org.cybergarage.upnp.Device.getService()
方法的一些代码示例,展示了Device.getService()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getService()
方法的具体详情如下:
包路径:org.cybergarage.upnp.Device
类名称:Device
方法名:getService
暂无
代码示例来源:origin: i2p/i2p.i2p
public Service getService(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
if (service.isService(name) == true)
return service;
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Service service = dev.getService(name);
if (service != null)
return service;
}
return null;
}
代码示例来源:origin: i2p/i2p.i2p
continue;
_service = current2.getService(WAN_IP_CONNECTION_2);
if (_service == null) {
_service = current2.getService(WAN_IP_CONNECTION);
if (_service == null) {
_service = current2.getService(WAN_PPP_CONNECTION);
if (_service == null) {
if (_log.shouldWarn())
Service svc2 = current2.getService(WAN_IPV6_CONNECTION);
if (svc2 != null)
_log.warn(_router.getFriendlyName() + " supports WANIPv6Connection, but we don't");
代码示例来源:origin: cybergarage/cybergarage-upnp
public Service getDeviceService(String deviceType, String serviceType)
{
Device dev = ctrlPoint.getDevice(deviceType);
if (dev == null)
return null;
Service service = dev.getService(serviceType);
if (service == null)
return null;
return service;
}
代码示例来源:origin: geniusgithub/MediaPlayer
public Service getService(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
if (service.isService(name) == true)
return service;
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Service service = dev.getService(name);
if (service != null)
return service;
}
return null;
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public boolean stop(Device dev)
{
if (dev == null)
return false;
Service avTransService = dev.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.STOP);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
return action.postControlAction();
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public Service getService(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
if (service.isService(name) == true)
return service;
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Service service = dev.getService(name);
if (service != null)
return service;
}
return null;
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public boolean stop(Device device) {
Service avTransService = device.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.STOP);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
return action.postControlAction();
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public boolean pause(Device mediaRenderDevice) {
Service service = mediaRenderDevice.getService(AVTransport.SERVICE_TYPE);
if (service == null) {
return false;
}
final Action pauseAction = service.getAction(AVTransport.PAUSE);
if (pauseAction == null) {
return false;
}
pauseAction.setArgumentValue(AVTransport.INSTANCEID, 0);
return pauseAction.postControlAction();
}
代码示例来源:origin: geniusgithub/MediaPlayer
public boolean stop(Device dev)
{
if (dev == null)
return false;
Service avTransService = dev.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.STOP);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
return action.postControlAction();
}
代码示例来源:origin: apache/felix
public String getSCPDURL(String udn, String serviceId) {
if (myCtrl == null){
logger.WARNING("UPnP Importer is disabled. getSCPDURL() is not available");
return null;
}
if (udn == null || udn.equals("") ) throw new IllegalArgumentException("Invalid udn paramenter");
if (serviceId == null || serviceId.equals("") ) throw new IllegalArgumentException("Invalid serviceId paramenter");
Device device= myCtrl.getDevice(udn);
if (device == null) {
logger.WARNING("getSCPDURL():: No device data available for UDN: "+udn);
return null;
}
Service service = device.getService(serviceId);
if (service == null) {
logger.WARNING("getSCPDURL():: No service data available for serviceId:"+serviceId + " of UDN " + udn);
return null;
}
String scpd = service.getSCPDURL().trim();
return resolveRelativeLink(device,scpd);
}
代码示例来源:origin: org.apache.felix/org.apache.felix.upnp.basedriver
public String getSCPDURL(String udn, String serviceId) {
if (myCtrl == null){
logger.WARNING("UPnP Importer is disabled. getSCPDURL() is not available");
return null;
}
if (udn == null || udn.equals("") ) throw new IllegalArgumentException("Invalid udn paramenter");
if (serviceId == null || serviceId.equals("") ) throw new IllegalArgumentException("Invalid serviceId paramenter");
Device device= myCtrl.getDevice(udn);
if (device == null) {
logger.WARNING("getSCPDURL():: No device data available for UDN: "+udn);
return null;
}
Service service = device.getService(serviceId);
if (service == null) {
logger.WARNING("getSCPDURL():: No service data available for serviceId:"+serviceId + " of UDN " + udn);
return null;
}
String scpd = service.getSCPDURL().trim();
return resolveRelativeLink(device,scpd);
}
代码示例来源:origin: com.github.kmbulebu.nicknack/wemo-provider
@Override
public void deviceRemoved(Device dev) {
if (isWemoSwitch(dev)) {
urnToDeviceMap.remove(dev.getUDN());
final Service basicEventService = dev.getService("urn:Belkin:service:basicevent:1");
if (basicEventService != null && basicEventService.getSID() != null) {
sidToDeviceMap.remove(basicEventService.getSID());
}
if (LOG.isInfoEnabled()) {
LOG.info("Removed Wemo Device: " + dev.getFriendlyName() + " (" + dev.getUDN() + ')');
}
}
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public boolean play(Device device) {
Service avTransService = device.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.PLAY);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
action.setArgumentValue(AVTransport.SPEED, "1");
return action.postControlAction();
}
代码示例来源:origin: com.github.kmbulebu.nicknack/wemo-provider
@Override
public void deviceAdded(Device dev) {
if (isWemoSwitch(dev)) {
final WemoSwitchOutlet wemoSwitch = new WemoSwitchOutlet(dev);
urnToDeviceMap.put(dev.getUDN(), wemoSwitch);
if (LOG.isInfoEnabled()) {
LOG.info("Found new Wemo Device: " + dev.getFriendlyName() + " (" + dev.getUDN() + ')');
}
final Service basicEventService = dev.getService("urn:Belkin:service:basicevent:1");
controlPoint.subscribe(basicEventService);
final String sid = basicEventService.getSID();
sidToDeviceMap.put(sid, wemoSwitch);
}
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public boolean setAVTransportURI(Device dev, String path)
{
if (path == null || path.length() <= 0)
return false;
Service avTransService = dev.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.SETAVTRANSPORTURI);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
action.setArgumentValue(AVTransport.CURRENTURI, path);
action.setArgumentValue(AVTransport.CURRENTURIMETADATA, "");
return action.postControlAction();
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public boolean play(Device dev)
{
if (dev == null)
return false;
Service avTransService = dev.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.PLAY);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
action.setArgumentValue(AVTransport.SPEED, "1");
return action.postControlAction();
}
代码示例来源:origin: geniusgithub/MediaPlayer
public boolean play(Device dev)
{
if (dev == null)
return false;
Service avTransService = dev.getService(AVTransport.SERVICE_TYPE);
if (avTransService == null)
return false;
Action action = avTransService.getAction(AVTransport.PLAY);
if (action == null)
return false;
action.setArgumentValue(AVTransport.INSTANCEID, "0");
action.setArgumentValue(AVTransport.SPEED, "1");
return action.postControlAction();
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public String getPositionInfo(Device device) {
Service localService = device.getService(AVTransport.SERVICE_TYPE);
if (localService == null)
return null;
final Action localAction = localService.getAction(AVTransport.GETPOSITIONINFO);
if (localAction == null) {
return null;
}
localAction.setArgumentValue(AVTransport.INSTANCEID, "0");
boolean isSuccess = localAction.postControlAction();
if (isSuccess) {
return localAction.getArgumentValue(AVTransport.ABSTIME);
} else {
return null;
}
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public String getMediaDuration(Device device) {
Service localService = device.getService(AVTransport.SERVICE_TYPE);
if (localService == null) {
return null;
}
final Action localAction = localService.getAction(AVTransport.GETMEDIAINFO);
if (localAction == null) {
return null;
}
localAction.setArgumentValue(AVTransport.INSTANCEID, "0");
if (localAction.postControlAction()) {
return localAction.getArgumentValue(AVTransport.MEDIADURATION);
} else {
return null;
}
}
代码示例来源:origin: geniusgithub/MediaPlayer
@Override
public String getTransportState(Device device) {
Service localService = device.getService(AVTransport.SERVICE_TYPE);
if (localService == null) {
return null;
}
final Action localAction = localService.getAction(AVTransport.GETTRANSPORTINFO);
if (localAction == null) {
return null;
}
localAction.setArgumentValue(AVTransport.INSTANCEID, "0");
if (localAction.postControlAction()) {
return localAction.getArgumentValue(AVTransport.CURRENTTRANSPORTSTATE);
} else {
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!