Examples of SqueezeboxBindingConfig


Examples of org.openhab.binding.squeezebox.SqueezeboxBindingConfig

   * {@inheritDoc}
   */
  @Override
  public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
    super.processBindingConfiguration(context, item, bindingConfig);
    SqueezeboxBindingConfig config = parseBindingConfig(bindingConfig);
    addBindingConfig(item, config);   
  }
View Full Code Here

Examples of org.openhab.binding.squeezebox.SqueezeboxBindingConfig

      extra = configParts[2];
      for(int i=3;i<configParts.length;i++) {
        extra += ":"+configParts[i];
      }

    return new SqueezeboxBindingConfig(playerId, commandType, extra);
  }
View Full Code Here

Examples of org.openhab.binding.squeezebox.SqueezeboxBindingConfig

      return;
    }

    logger.trace("internalReceiveCommand(itemname = {}, command = {})", itemName, command.toString());
    for (SqueezeboxBindingProvider provider : providers) {
      SqueezeboxBindingConfig bindingConfig = provider.getSqueezeboxBindingConfig(itemName);

      String playerId = bindingConfig.getPlayerId();
      SqueezePlayer player = squeezeServer.getPlayer(playerId);
      if (player == null) {
        logger.warn("No Squeezebox player configured with id '{}'. Ignoring.", playerId);
        continue;
      }
   
      try {
        switch (bindingConfig.getCommandType()) {
          case POWER:
            if (command.equals(OnOffType.ON))
              squeezeServer.powerOn(playerId);
            else if (command.equals(OnOffType.OFF))
              squeezeServer.powerOff(playerId);           
            break;
         
          case MUTE:
            if (command.equals(OnOffType.ON))
              squeezeServer.mute(playerId);
            else if (command.equals(OnOffType.OFF))
              squeezeServer.unMute(playerId);           
            break;
         
          case VOLUME:
            if (command.equals(IncreaseDecreaseType.INCREASE))           
              squeezeServer.volumeUp(playerId);
            else if (command.equals(IncreaseDecreaseType.DECREASE))
              squeezeServer.volumeDown(playerId);
            else if (command.equals(UpDownType.UP))           
              squeezeServer.volumeUp(playerId);
            else if (command.equals(UpDownType.DOWN))
              squeezeServer.volumeDown(playerId);
            else if (command instanceof DecimalType)
              squeezeServer.setVolume(playerId, ((DecimalType)command).intValue());
            break;

          case PLAY:
            if (command.equals(OnOffType.ON))
              squeezeServer.play(playerId);
            else if (command.equals(OnOffType.OFF))
              squeezeServer.stop(playerId);
            break;
          case PAUSE:
            if (command.equals(OnOffType.ON))
              squeezeServer.pause(playerId);
            else if (command.equals(OnOffType.OFF))
              squeezeServer.unPause(playerId);
            break;
          case STOP:
            if (command.equals(OnOffType.ON))
              squeezeServer.stop(playerId);
            else if (command.equals(OnOffType.OFF))
              squeezeServer.play(playerId);
            break;
          case NEXT:
            if (command.equals(OnOffType.ON))
              squeezeServer.next(playerId);
            break;           
          case PREV:
            if (command.equals(OnOffType.ON))
              squeezeServer.prev(playerId);
            break;
           
          case HTTP:
            if (command.equals(OnOffType.ON))
              squeezeServer.playUrl(playerId, "http://" + bindingConfig.getExtra());
            else if (command.equals(OnOffType.OFF))
              squeezeServer.stop(playerId);
            break;
          case FILE:
            if (command.equals(OnOffType.ON))
              squeezeServer.playUrl(playerId, "file://" + bindingConfig.getExtra());
            else if (command.equals(OnOffType.OFF))
              squeezeServer.stop(playerId);
            break;
         
          case SYNC:
            if (command.equals(OnOffType.ON))
              squeezeServer.syncPlayer(playerId, bindingConfig.getExtra());
            else if (command.equals(OnOffType.OFF))
              squeezeServer.unSyncPlayer(bindingConfig.getExtra());
            break;

          default:
            logger.warn("Unsupported command type '{}'", bindingConfig.getCommandType());
        }
      }
      catch (Exception e) {
        logger.warn("Error executing command type '" + bindingConfig.getCommandType() + "'", e);
     
    }
  }
View Full Code Here

Examples of org.openhab.binding.squeezebox.SqueezeboxBindingConfig

  private List<String> getItemNames(String playerId, CommandType commandType) {
    List<String> itemNames = new ArrayList<String>();
    for (SqueezeboxBindingProvider provider : this.providers) {
      for (String itemName : provider.getItemNames()) {
        SqueezeboxBindingConfig bindingConfig = provider.getSqueezeboxBindingConfig(itemName);
        if (!bindingConfig.getPlayerId().equals(playerId))
          continue;
        if (!bindingConfig.getCommandType().equals(commandType))
          continue;
        itemNames.add(itemName);
      }
    }
    return itemNames;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.