本文整理汇总了Java中org.openhab.binding.tcp.Direction.OUT属性的典型用法代码示例。如果您正苦于以下问题:Java Direction.OUT属性的具体用法?Java Direction.OUT怎么用?Java Direction.OUT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openhab.binding.tcp.Direction
的用法示例。
在下文中一共展示了Direction.OUT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseBindingConfig
/**
* Parses the configuration string and update the provided config
*
* @param config - the Configuration that needs to be updated with the parsing results
* @param item - the Item that this configuration is intented for
* @param bindingConfig - the configuration string that will be parsed
* @throws BindingConfigParseException
*/
private void parseBindingConfig(ProtocolBindingConfig config,Item item,
String bindingConfig) throws BindingConfigParseException {
String direction = null;
Direction directionType = null;
String commandAsString = null;
String host = null;
String port = null;
String protocolCommand = null;
if(bindingConfig != null){
Matcher actionMatcher = ACTION_CONFIG_PATTERN.matcher(bindingConfig);
Matcher statusMatcher = STATUS_CONFIG_PATTERN.matcher(bindingConfig);
if ((!actionMatcher.matches() && !statusMatcher.matches())) {
throw new BindingConfigParseException(getBindingType()+
" binding configuration must consist of four [config="+statusMatcher+"] or five parts [config="
+ actionMatcher + "]");
} else {
if(actionMatcher.matches()) {
direction = actionMatcher.group(1);
commandAsString = actionMatcher.group(2);
host = actionMatcher.group(3);
port = actionMatcher.group(4);
protocolCommand = actionMatcher.group(5);
} else if (statusMatcher.matches()) {
direction = statusMatcher.group(1);
commandAsString = null;
host = statusMatcher.group(2);
port = statusMatcher.group(3);
protocolCommand = statusMatcher.group(4);
}
if (direction.equals(">")){
directionType = Direction.OUT;
} else if (direction.equals("<")){
directionType = Direction.IN;
}
ProtocolBindingConfigElement newElement = new ProtocolBindingConfigElement(host,port,directionType,protocolCommand,item.getAcceptedDataTypes());
Command command = null;
if(commandAsString == null) {
// for those configuration strings that are not really linked to a openHAB command we
// create a dummy Command to be able to store the configuration information
// I have choosen to do that with NumberItems
NumberItem dummy = new NumberItem(Integer.toString(counter));
command = createCommandFromString(dummy,Integer.toString(counter));
counter++;
} else {
command = createCommandFromString(item, commandAsString);
}
config.put(command, newElement);
}
}
else
{
return;
}
}
示例2: getDirection
/**
* {@inheritDoc}
*/
@Override
public Direction getDirection(String itemName, Command command) {
// the IRtrans binding will only establish outbound connections to the remote IRtrans device
return Direction.OUT;
}
示例3: getDirection
/**
* {@inheritDoc}
*/
@Override
public Direction getDirection(String itemName, Command command) {
// the IRtrans binding will only establish outbound connections to the remote IRtrans device
return Direction.OUT;
}
示例4: parseBindingConfig
/**
* Parses the configuration string and update the provided config
*
* @param config - the Configuration that needs to be updated with the parsing results
* @param item - the Item that this configuration is intented for
* @param bindingConfig - the configuration string that will be parsed
* @throws BindingConfigParseException
*/
private void parseBindingConfig(ProtocolBindingConfig config, Item item, String bindingConfig)
throws BindingConfigParseException {
String direction = null;
Direction directionType = null;
String commandAsString = null;
String host = null;
String port = null;
String protocolCommand = null;
if (bindingConfig != null) {
Matcher actionMatcher = ACTION_CONFIG_PATTERN.matcher(bindingConfig);
Matcher statusMatcher = STATUS_CONFIG_PATTERN.matcher(bindingConfig);
if ((!actionMatcher.matches() && !statusMatcher.matches())) {
throw new BindingConfigParseException(
getBindingType() + " binding configuration must consist of four [config=" + statusMatcher
+ "] or five parts [config=" + actionMatcher + "]");
} else {
if (actionMatcher.matches()) {
direction = actionMatcher.group(1);
commandAsString = actionMatcher.group(2);
host = actionMatcher.group(3);
port = actionMatcher.group(4);
protocolCommand = actionMatcher.group(5) != null ? actionMatcher.group(5) : actionMatcher.group(6);
} else if (statusMatcher.matches()) {
direction = statusMatcher.group(1);
commandAsString = null;
host = statusMatcher.group(2);
port = statusMatcher.group(3);
protocolCommand = statusMatcher.group(4) != null ? statusMatcher.group(4) : statusMatcher.group(5);
}
if (direction.equals(">")) {
directionType = Direction.OUT;
} else if (direction.equals("<")) {
directionType = Direction.IN;
}
ProtocolBindingConfigElement newElement = new ProtocolBindingConfigElement(host, port, directionType,
protocolCommand, item.getAcceptedDataTypes());
Command command = null;
if (commandAsString == null) {
// for those configuration strings that are not really linked to a openHAB command we
// create a dummy Command to be able to store the configuration information
// I have choosen to do that with NumberItems
NumberItem dummy = new NumberItem(Integer.toString(counter));
command = createCommandFromString(dummy, Integer.toString(counter));
counter++;
} else {
command = createCommandFromString(item, commandAsString);
}
config.put(command, newElement);
}
} else {
return;
}
}