當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。