Package org.openhab.core.types

Examples of org.openhab.core.types.Command


    }
   
    ExecBindingConfigElement configElement = new ExecBindingConfigElement();
    configElement.commandLine = commandLine.replaceAll("(?<!\\\\)\\\\", "");
   
    Command cmd = createCommandFromString(item, command);
    config.put(cmd, configElement);
  }
View Full Code Here


      return CHANGED_COMMAND_KEY;
    }
    else if (WILDCARD_COMMAND_KEY.equals(commandAsString)) {
      return WILDCARD_COMMAND_KEY;
    } else {
      Command command = TypeParser.parseCommand(
        item.getAcceptedCommandTypes(), commandAsString);
     
      if (command == null) {
        throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
      }
View Full Code Here

        return; // we have received an event with an invalid topic
      }
      String operation = topicParts[1];
     
      if(operation.equals(EventType.COMMAND.toString())) {
        Command command = (Command) event.getProperty("command");
        if(command!=null) receiveCommand(itemName, command);
      }
    }
View Full Code Here

        }
      }
      break;
    case COMMAND: 
      if(newType instanceof Command) {
        Command command = (Command) newType;
        for(Rule rule : rules) {
          for(EventTrigger t : rule.getEventtrigger()) {
            if (t instanceof CommandEventTrigger) {
              CommandEventTrigger ct = (CommandEventTrigger) t;
              Command triggerCommand = TypeParser.parseCommand(item.getAcceptedCommandTypes(), ct.getCommand());
              if(ct.getItem().equals(item.getName()) &&
                  (triggerCommand==null || command.equals(triggerCommand))) {
                result.add(rule);
              }
            }
View Full Code Here

          sonosCommand = statusMatcher.group(2);
        }

        SonosBindingConfigElement newElement = new SonosBindingConfigElement(sonosCommand,sonosID,item.getAcceptedDataTypes());

        Command command = null;
        if(commandAsString == null) {
          command = createCommandFromString(null,Integer.toString(counter));
          counter++;
          config.put(command, newElement);               
        } else {
View Full Code Here

    }
    else {
      acceptedTypes.add(StringType.class);
    }
   
    Command command = TypeParser.parseCommand(acceptedTypes, commandAsString);

    if (command == null) {
      throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
    }
View Full Code Here

          ledType = Leds.valueOf(led);
        }

        IRtransBindingConfigElement newElement = new IRtransBindingConfigElement(host,port,ledType,remote,irCommand,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));
View Full Code Here

   * create a command appropriately
   * @see {@link TypeParser}
   */
  private Command createCommandFromString(Item item, String commandAsString) throws BindingConfigParseException {

    Command command = TypeParser.parseCommand(
        item.getAcceptedCommandTypes(), commandAsString);

    if (command == null) {
      throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
    }
View Full Code Here

    HttpBindingConfigElement configElement;
   
    while (matcher.find()) {
      configElement = new HttpBindingConfigElement();
     
      Command command = createCommandFromString(item, matcher.group(1));
      configElement.httpMethod = matcher.group(2);
      String lastPart = matcher.group(3).replaceAll("\\\\\"", "");
      if(lastPart.trim().endsWith("}") && lastPart.contains("{")){
        int beginIdx = lastPart.lastIndexOf("{");
        int endIdx = lastPart.lastIndexOf("}");
View Full Code Here

      return CHANGED_COMMAND_KEY;
    }
    else if (WILDCARD_COMMAND_KEY.equals(commandAsString)) {
      return WILDCARD_COMMAND_KEY;
    } else {
      Command command = TypeParser.parseCommand(
        item.getAcceptedCommandTypes(), commandAsString);
     
      if (command == null) {
        throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
      }
View Full Code Here

TOP

Related Classes of org.openhab.core.types.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.