Package org.teleal.cling.model.message.header

Examples of org.teleal.cling.model.message.header.UDNHeader


          Iterator<SonosZonePlayer> it = sonosZonePlayerCache.iterator();
          while(it.hasNext()){
            SonosZonePlayer aPlayer = it.next();
            if(aPlayer.getDevice() == null) {
              logger.info("Querying the network for a predefined Sonos device with UDN {}", aPlayer.getUdn());
              upnpService.getControlPoint().search(new UDNHeader(aPlayer.getUdn()));
            }
          }

          logger.info("Querying the network for any other Sonos device");

          final UDAServiceType udaType = new UDAServiceType("AVTransport");
          upnpService.getControlPoint().search( new UDAServiceTypeHeader(udaType));

        } catch (Exception e) {
          logger.warn("An exception occurred while searching the network for Sonos devices: ", e.getMessage());
        }

        bindingStarted = true;
      }

      Scheduler sched = null;
      try {
        sched =  StdSchedulerFactory.getDefaultScheduler();
      } catch (SchedulerException e) {
        logger.error("An exception occurred while getting a reference to the Quartz Scheduler");
      }

      // Cycle through the Items and setup sonos zone players if required
      for (SonosBindingProvider provider : providers) {
        for (String itemName : provider.getItemNames()) {
          for(String sonosID : ((SonosBindingProvider) provider).getSonosID(itemName)) {
            if(!sonosZonePlayerCache.contains(sonosID)) {
              // the device is not yet discovered on the network or not defined in the .cfg

              //Verify that the sonosID has the format of a valid UDN
              Pattern SONOS_UDN_PATTERN = Pattern.compile("RINCON_(\\w{17})");
              Matcher matcher = SONOS_UDN_PATTERN.matcher(sonosID);
              if(matcher.matches()){
                // Add device to the cached Configs
                SonosZonePlayer thePlayer = new SonosZonePlayer(sonosID,self);
                thePlayer.setUdn(new UDN(sonosID));

                sonosZonePlayerCache.add(thePlayer);

                //Query the network for this device
                logger.info("Querying the network for a predefined Sonos device with UDN '{}'", thePlayer.getUdn());
                upnpService.getControlPoint().search(new UDNHeader(thePlayer.getUdn()));
              }

            }
          }
        }
View Full Code Here

TOP

Related Classes of org.teleal.cling.model.message.header.UDNHeader

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.