当前位置: 首页>>代码示例>>Java>>正文


Java HmResult类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:23,代码来源:CcuClient.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:23,代码来源:CcuClient.java

示例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);
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:CcuClient.java

示例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());
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:17,代码来源:CcuClient.java

示例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);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:CcuGateway.java

示例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());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:13,代码来源:CcuGateway.java

示例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());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:9,代码来源:CcuGateway.java

示例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);
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:13,代码来源:CcuClient.java

示例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());
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:17,代码来源:CcuClient.java


注:本文中的org.openhab.binding.homematic.internal.model.HmResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。