本文整理匯總了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());
}
}