本文整理汇总了Java中org.openhab.binding.homematic.internal.model.HmResult类的典型用法代码示例。如果您正苦于以下问题:Java HmResult类的具体用法?Java HmResult怎么用?Java HmResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HmResult类属于org.openhab.binding.homematic.internal.model包,在下文中一共展示了HmResult类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDatapointValue
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
@Override
public void setDatapointValue(HmDatapoint dp, String datapointName, Object value) throws HomematicClientException {
HmInterface hmInterface = dp.getChannel().getDevice().getHmInterface();
if (hmInterface == HmInterface.VIRTUALDEVICES) {
String groupName = HmInterface.VIRTUALDEVICES + "." + dp.getChannel().getAddress() + "." + datapointName;
if (dp.isIntegerValue() && value instanceof Double) {
value = ((Number) value).intValue();
}
String strValue = ObjectUtils.toString(value);
if (dp.isStringValue()) {
strValue = "\"" + strValue + "\"";
}
HmResult result = sendScriptByName("setVirtualGroup", HmResult.class, new String[] { "group_name",
"group_state" }, new String[] { groupName, strValue });
if (!result.isValid()) {
throw new HomematicClientException("Unable to set CCU group " + groupName);
}
} else {
super.setDatapointValue(dp, datapointName, value);
}
}
示例2: setDatapointValue
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
@Override
public void setDatapointValue(HmDatapoint dp, String datapointName, Object value) throws HomematicClientException {
HmInterface hmInterface = dp.getChannel().getDevice().getHmInterface();
if (hmInterface == HmInterface.VIRTUALDEVICES) {
String groupName = HmInterface.VIRTUALDEVICES + "." + dp.getChannel().getAddress() + "." + datapointName;
if (dp.isIntegerValue() && value instanceof Double) {
value = ((Number) value).intValue();
}
String strValue = ObjectUtils.toString(value);
if (dp.isStringValue()) {
strValue = "\"" + strValue + "\"";
}
HmResult result = sendScriptByName("setVirtualGroup", HmResult.class,
new String[] { "group_name", "group_state" }, new String[] { groupName, strValue });
if (!result.isValid()) {
throw new HomematicClientException("Unable to set CCU group " + groupName);
}
} else {
super.setDatapointValue(dp, datapointName, value);
}
}
示例3: executeProgram
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void executeProgram(String programName) throws HomematicClientException {
logger.debug("Executing program on CCU: {}", programName);
HmResult result = sendScriptByName("executeProgram", HmResult.class, new String[] { "program_name" },
new String[] { programName });
if (!result.isValid()) {
throw new HomematicClientException("Unable to start CCU program " + programName);
}
}
示例4: setVariable
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setVariable(HmValueItem hmValueItem, Object value) throws HomematicClientException {
String strValue = ObjectUtils.toString(value);
if (hmValueItem.isStringValue()) {
strValue = "\"" + strValue + "\"";
}
logger.debug("Sending {} with value '{}' to CCU", hmValueItem.getName(), strValue);
HmResult result = sendScriptByName("setVariable", HmResult.class, new String[] { "variable_name",
"variable_state" }, new String[] { hmValueItem.getName(), strValue });
if (!result.isValid()) {
throw new HomematicClientException("Unable to set CCU variable " + hmValueItem.getName());
}
}
示例5: CcuGateway
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
protected CcuGateway(String id, HomematicConfig config, HomematicGatewayAdapter gatewayAdapter) {
super(id, config, gatewayAdapter);
xStream.setClassLoader(CcuGateway.class.getClassLoader());
xStream.autodetectAnnotations(true);
xStream.alias("scripts", TclScriptList.class);
xStream.alias("list", TclScriptDataList.class);
xStream.alias("result", HmResult.class);
}
示例6: setVariable
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
@Override
protected void setVariable(HmDatapoint dp, Object value) throws IOException {
String strValue = StringUtils.replace(ObjectUtils.toString(value), "\"", "\\\"");
if (dp.isStringType()) {
strValue = "\"" + strValue + "\"";
}
HmResult result = sendScriptByName("setVariable", HmResult.class,
new String[] { "variable_name", "variable_state" }, new String[] { dp.getInfo(), strValue });
if (!result.isValid()) {
throw new IOException("Unable to set CCU variable " + dp.getInfo());
}
}
示例7: executeScript
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
@Override
protected void executeScript(HmDatapoint dp) throws IOException {
HmResult result = sendScriptByName("executeProgram", HmResult.class, new String[] { "program_name" },
new String[] { dp.getInfo() });
if (!result.isValid()) {
throw new IOException("Unable to start CCU program: " + dp.getInfo());
}
}
示例8: executeProgram
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void executeProgram(String programName) throws HomematicClientException {
logger.debug("Executing program on CCU: {}", programName);
HmResult result = sendScriptByName("executeProgram", HmResult.class, new String[] { "program_name" },
new String[] { programName });
if (!result.isValid()) {
throw new HomematicClientException("Unable to start CCU program " + programName);
}
}
示例9: setVariable
import org.openhab.binding.homematic.internal.model.HmResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setVariable(HmValueItem hmValueItem, Object value) throws HomematicClientException {
String strValue = ObjectUtils.toString(value);
if (hmValueItem.isStringValue()) {
strValue = "\"" + strValue + "\"";
}
logger.debug("Sending {} with value '{}' to CCU", hmValueItem.getName(), strValue);
HmResult result = sendScriptByName("setVariable", HmResult.class,
new String[] { "variable_name", "variable_state" }, new String[] { hmValueItem.getName(), strValue });
if (!result.isValid()) {
throw new HomematicClientException("Unable to set CCU variable " + hmValueItem.getName());
}
}