本文整理汇总了Java中org.cybergarage.upnp.Device.getService方法的典型用法代码示例。如果您正苦于以下问题:Java Device.getService方法的具体用法?Java Device.getService怎么用?Java Device.getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cybergarage.upnp.Device
的用法示例。
在下文中一共展示了Device.getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAVTransportURI
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public boolean setAVTransportURI(Device dev, ItemNode itemNode) {
if (dev == null) {
return false;
}
ResourceNode resNode = itemNode.getFirstResource();
if (resNode == null) {
return false;
}
String resURL = resNode.getURL();
if (resURL == null || resURL.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("InstanceID", "0");
action.setArgumentValue(AVTransport.CURRENTURI, resURL);
action.setArgumentValue(AVTransport.CURRENTURIMETADATA, "");
return action.postControlAction();
}
示例2: play
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
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("InstanceID", "0");
action.setArgumentValue(AVTransport.SPEED, "1");
return action.postControlAction();
}
示例3: stop
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
@Override
public boolean stop(Device device) {
Service service = device.getService(AVTransport1);
if (service == null) {
return false;
}
final Action stopAction = service.getAction("Stop");
if (stopAction == null) {
return false;
}
stopAction.setArgumentValue("InstanceID", 0);
return stopAction.postControlAction();
}
示例4: goon
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public boolean goon(Device device, String pausePosition) {
if (device == null) {
return false;
}
Service localService = device.getService("urn:schemas-upnp-org:service:AVTransport:1");
if (localService == null) {
return false;
}
Action localAction = localService.getAction(AVTransport.SEEK);
if (localAction == null) {
return false;
}
localAction.setArgumentValue("InstanceID", "0");
localAction.setArgumentValue(AVTransport.UNIT, "ABS_TIME");
localAction.setArgumentValue(AVTransport.TARGET, pausePosition);
localAction.postControlAction();
Action playAction = localService.getAction("Play");
if (playAction == null) {
return false;
}
playAction.setArgumentValue("InstanceID", 0);
playAction.setArgumentValue(AVTransport.SPEED, "1");
return playAction.postControlAction();
}
示例5: getTransportState
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public String getTransportState(Device device) {
if (device == null) {
return "STOPPED";
}
Service localService = device.getService("urn:schemas-upnp-org:service:AVTransport:1");
if (localService == null) {
return null;
}
Action localAction = localService.getAction(AVTransport.GETTRANSPORTINFO);
if (localAction == null) {
return null;
}
localAction.setArgumentValue("InstanceID", "0");
if (localAction.postControlAction()) {
return localAction.getArgumentValue(AVTransport.CURRENTTRANSPORTSTATE);
}
return null;
}
示例6: getVolumeDbRange
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public String getVolumeDbRange(Device device, String argument) {
if (device == null) {
return "";
}
Service localService = device.getService("urn:schemas-upnp-org:service:RenderingControl:1");
if (localService == null) {
return null;
}
Action localAction = localService.getAction(RenderingControl.GETVOLUMEDBRANGE);
if (localAction == null) {
return null;
}
localAction.setArgumentValue("InstanceID", "0");
localAction.setArgumentValue(RenderingControl.CHANNEL, RenderingControl.MASTER);
if (localAction.postControlAction()) {
return localAction.getArgumentValue(argument);
}
return null;
}
示例7: getPositionInfo
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
@Override
public String getPositionInfo(Device device) {
Service localService = device.getService(AVTransport1);
if (localService == null)
return null;
final Action localAction = localService.getAction("GetPositionInfo");
if (localAction == null) {
return null;
}
localAction.setArgumentValue("InstanceID", "0");
boolean isSuccess = localAction.postControlAction();
if (isSuccess) {
return localAction.getArgumentValue("AbsTime");
} else {
return null;
}
}
示例8: getMediaDuration
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public String getMediaDuration(Device device) {
if (device == null) {
return "00:00:00";
}
Service localService = device.getService("urn:schemas-upnp-org:service:AVTransport:1");
if (localService == null) {
return null;
}
Action localAction = localService.getAction(AVTransport.GETMEDIAINFO);
if (localAction == null) {
return null;
}
localAction.setArgumentValue("InstanceID", "0");
if (localAction.postControlAction()) {
return localAction.getArgumentValue(AVTransport.MEDIADURATION);
}
return null;
}
示例9: setMute
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public boolean setMute(Device mediaRenderDevice, String targetValue) {
if (mediaRenderDevice == null) {
return false;
}
Service service = mediaRenderDevice.getService("urn:schemas-upnp-org:service:RenderingControl:1");
if (service == null) {
return false;
}
Action action = service.getAction(RenderingControl.SETMUTE);
if (action == null) {
return false;
}
action.setArgumentValue("InstanceID", "0");
action.setArgumentValue(RenderingControl.CHANNEL, RenderingControl.MASTER);
action.setArgumentValue(RenderingControl.DESIREDMUTE, targetValue);
return action.postControlAction();
}
示例10: getMute
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
@Override
public String getMute(Device device) {
Service service = device.getService(RenderingControl);
if (service == null) {
return null;
}
final Action getAction = service.getAction("GetMute");
if (getAction == null) {
return null;
}
getAction.setArgumentValue("InstanceID", "0");
getAction.setArgumentValue("Channel", "Master");
getAction.postControlAction();
return getAction.getArgumentValue("CurrentMute");
}
示例11: setVoice
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public boolean setVoice(Device device, int value) {
if (device == null) {
return false;
}
Service service = device.getService("urn:schemas-upnp-org:service:RenderingControl:1");
if (service == null) {
return false;
}
Action action = service.getAction(RenderingControl.SETVOLUME);
if (action == null) {
return false;
}
action.setArgumentValue("InstanceID", "0");
action.setArgumentValue(RenderingControl.CHANNEL, RenderingControl.MASTER);
action.setArgumentValue(RenderingControl.DESIREDVOLUME, value);
return action.postControlAction();
}
示例12: getVoice
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public int getVoice(Device device) {
if (device == null) {
return 0;
}
Service service = device.getService("urn:schemas-upnp-org:service:RenderingControl:1");
if (service == null) {
return -1;
}
Action getAction = service.getAction(RenderingControl.GETVOLUME);
if (getAction == null) {
return -1;
}
getAction.setArgumentValue("InstanceID", "0");
getAction.setArgumentValue(RenderingControl.CHANNEL, RenderingControl.MASTER);
if (getAction.postControlAction()) {
return getAction.getArgumentIntegerValue(RenderingControl.CURRENTVOLUME);
}
return -1;
}
示例13: getVolumeDbRange
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
public String getVolumeDbRange(Device device, String argument) {
Service localService = device.getService(RenderingControl);
if (localService == null) {
return null;
}
Action localAction = localService.getAction("GetVolumeDBRange");
if (localAction == null) {
return null;
}
localAction.setArgumentValue("InstanceID", "0");
localAction.setArgumentValue("Channel", "Master");
if (!localAction.postControlAction()) {
return null;
} else {
return localAction.getArgumentValue(argument);
}
}
示例14: setMute
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
@Override
public boolean setMute(Device mediaRenderDevice, String targetValue) {
Service service = mediaRenderDevice.getService(RenderingControl);
if (service == null) {
return false;
}
final Action action = service.getAction("SetMute");
if (action == null) {
return false;
}
action.setArgumentValue("InstanceID", "0");
action.setArgumentValue("Channel", "Master");
action.setArgumentValue("DesiredMute", targetValue);
return action.postControlAction();
}
示例15: pause
import org.cybergarage.upnp.Device; //导入方法依赖的package包/类
@Override
public boolean pause(Device mediaRenderDevice) {
Service service = mediaRenderDevice.getService(AVTransport1);
if (service == null) {
return false;
}
final Action pauseAction = service.getAction("Pause");
if (pauseAction == null) {
return false;
}
pauseAction.setArgumentValue("InstanceID", 0);
return pauseAction.postControlAction();
}