本文整理了Java中org.cybergarage.upnp.Device.getAction()
方法的一些代码示例,展示了Device.getAction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getAction()
方法的具体详情如下:
包路径:org.cybergarage.upnp.Device
类名称:Device
方法名:getAction
暂无
代码示例来源:origin: i2p/i2p.i2p
public Action getAction(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
ActionList actionList = service.getActionList();
int actionCnt = actionList.size();
for (int i = 0; i < actionCnt; i++) {
Action action = (Action) actionList.getAction(i);
String actionName = action.getName();
if (actionName == null)
continue;
if (actionName.equals(name) == true)
return action;
}
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Action action = dev.getAction(name);
if (action != null)
return action;
}
return null;
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public void setWasherState(String value)
{
Device dev = getDevice(WASHER_DEVICE_TYPE);
if (dev == null)
return;
Action setTempAct = dev.getAction("SetState");
setTempAct.setArgumentValue("State", value);
setTempAct.postControlAction();
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public void airconChangeTemp(String tempOff)
{
Device dev = getDevice(AIRCON_DEVICE_TYPE);
if (dev == null)
return;
Action setTempAct = dev.getAction("SetTemp");
setTempAct.setArgumentValue("Temp", tempOff);
setTempAct.postControlAction();
}
代码示例来源:origin: com.github.kmbulebu.nicknack/wemo-provider
@Override
public void switchOnOrOff(boolean isOn) throws WemoException {
final Action upnpAction = device.getAction("SetBinaryState");
upnpAction.setArgumentValue("BinaryState", isOn ? 1 : 0);
if (upnpAction.postControlAction()) {
throw new WemoException("Failed to set BinaryState.");
}
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public void powerOn(String deviceType)
{
Device dev = getDevice(deviceType);
if (dev == null)
return;
Action getPowerAct = dev.getAction("GetPower");
if (getPowerAct.postControlAction() == false)
return;
ArgumentList outArgList = getPowerAct.getOutputArgumentList();
String powerState = outArgList.getArgument(0).getValue();
String newPowerState = (powerState.compareTo("1") == 0) ? "0" : "1";
Action setPowerAct = dev.getAction("SetPower");
setPowerAct.setArgumentValue("Power", newPowerState);
setPowerAct.postControlAction();
}
代码示例来源:origin: cybergarage/cybergarage-upnp
private String getExternalIPAddress()
{
Device dev = getSelectedDevice();
Action addPortAct = dev.getAction("GetExternalIPAddress");
if (addPortAct == null) {
showWarnning("GetExternalIPAddress is not found");
return "";
}
if (addPortAct.postControlAction() == true)
return addPortAct.getArgumentValue("NewExternalIPAddress");
return "";
}
代码示例来源:origin: com.github.kmbulebu.nicknack/wemo-provider
@Override
public boolean isOn() throws WemoException {
final Action action = device.getAction("GetBinaryState");
if (!action.postControlAction() || action.getArgument("BinaryState") == null) {
throw new WemoException("Failed to get BinaryState.");
}
final int binaryState = action.getArgument("BinaryState").getIntegerValue();
if (binaryState == 0) {
return false;
} else if (binaryState == 1) {
return true;
} else {
throw new WemoException("Unrecognized BinaryState value of " + binaryState);
}
}
代码示例来源:origin: geniusgithub/MediaPlayer
public Action getAction(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
ActionList actionList = service.getActionList();
int actionCnt = actionList.size();
for (int i = 0; i < actionCnt; i++) {
Action action = (Action) actionList.getAction(i);
String actionName = action.getName();
if (actionName == null)
continue;
if (actionName.equals(name) == true)
return action;
}
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Action action = dev.getAction(name);
if (action != null)
return action;
}
return null;
}
代码示例来源:origin: cybergarage/cybergarage-upnp
public Action getAction(String name) {
ServiceList serviceList = getServiceList();
int serviceCnt = serviceList.size();
for (int n = 0; n < serviceCnt; n++) {
Service service = serviceList.getService(n);
ActionList actionList = service.getActionList();
int actionCnt = actionList.size();
for (int i = 0; i < actionCnt; i++) {
Action action = (Action) actionList.getAction(i);
String actionName = action.getName();
if (actionName == null)
continue;
if (actionName.equals(name) == true)
return action;
}
}
DeviceList devList = getDeviceList();
int devCnt = devList.size();
for (int n = 0; n < devCnt; n++) {
Device dev = devList.getDevice(n);
Action action = dev.getAction(name);
if (action != null)
return action;
}
return null;
}
代码示例来源:origin: cybergarage/cybergarage-upnp
Action getPowerAction = tvDev.getAction("GetPower");
getPowerAction.setActionListener(this);
Action setPowerAction = tvDev.getAction("SetPower");
setPowerAction.setActionListener(this);
代码示例来源:origin: cybergarage/cybergarage-upnp
private void addPortMapping(UpnpIGDToolAddPortDlg addPortDlg)
Action addPortAct = dev.getAction("AddPortMapping");
if (addPortAct == null) {
showWarnning("AddPortMapping is not found");
内容来源于网络,如有侵权,请联系作者删除!