1 Reply Latest reply: Jul 12, 2009 11:28 PM by 843851 RSS

    Cable STB with Two tuners: Can I specify a particular tuner to tune with?

    843851
      Briefly, I am developing some OCAP stb test Xlets. One of the tests is to tune to a service in the service list and specify a particular tuner to use.

      How do I specify a particular tuner to be used for a tune?

      I'm pretty new at this but having some success, so I'm finding my way around the system pretty well, but this one has me stumped.

      Short Story:
      I'm able to tune by first getting the service list and passing the Service into the ServiceContext.select() method.

      basically I get the service list:
       // get all available Services from SIManager
              ServiceTypeFilter filter = new ServiceTypeFilter(ServiceType.DIGITAL_TV);
              SIManager siDatabase = SIManager.createInstance();        
              final ServiceList serviceList = siDatabase.filterServices(filter);
      When I want to tune, I get the Service with it's sourceId and use the select(Service) method.

      I can also get the tuners with
      // multiple tuners?
      NetworkInterfaceManager = NetworkInterfaceManager.getInstance();
      NetworkInterface[] tuners = manager.getNetworkInterfaces();
      So how do I get the specify one of the tuners be used for the tune command?

      Thanks in advance.

      Ed



      The Tune method:
      /**
           * Tune by source ID.
           * @param sourceID
           */
          public void tune(final int sourceID)
          {
              // create OcapLocator with sourceID
              OcapLocator ocapLoc = null;
      
              try
              {
                  // log.logDebug("tuning to sourceID: " + sourceID);
                  ocapLoc = new OcapLocator(sourceID);
              }
              catch (InvalidLocatorException e1)
              {
                  log.logError("InvalidLocatorException" + e1.getLocalizedMessage());
                  e1.printStackTrace();
              }
      
              if (ocapLoc != null)
              {
                  final SIManager siManager = (SIManager) SIManager.createInstance();
      
                  if (siManager != null)
                  {
                      // Retrieve the service corresponding to the locator
                      Service service;
                      try
                      {
                          service = siManager.getService(ocapLoc);
                          log.logTrace("****** TUNING to: " + sourceID);
                          serviceContext.select(service);
                      }
                      catch (SecurityException e)
                      {
                          log.logError("SecurityException: ");
                          e.printStackTrace();
                      }
                      // TODO: we may want to throw this exception,
                      // so the app can tune away or whatever.
                      catch (javax.tv.locator.InvalidLocatorException e)
                      {
                          log.logError("InvalidLocatorException: ");
                          e.printStackTrace();
                          // tuneUp();
                      }
                  }
              }
          }