public void SubscribeStateVariables(StateVariableChangedDlgt svChangeDlg)
 {
     UnsubscribeStateVariables();
     if (svChangeDlg != null && _service != null)
     {
         _stateVariableDelegate            = svChangeDlg;
         _service.EventSubscriptionFailed += SubscribeFailed;
         _service.StateVariableChanged    += _stateVariableDelegate;
         _service.SubscribeStateVariables();
     }
 }
Ejemplo n.º 2
0
 public void SubscribeStateVariables(StateVariableChangedDlgt svChangeDlg)
 {
   UnsubscribeStateVariables();
   if (svChangeDlg != null && _service != null)
   {
     _stateVariableDelegate = svChangeDlg;
     _service.EventSubscriptionFailed += SubscribeFailed;
     _service.StateVariableChanged += _stateVariableDelegate;
     _service.SubscribeStateVariables();
   }
 }
 public void UnsubscribeStateVariables()
 {
     if (_stateVariableDelegate != null && _service != null)
     {
         if (_service.IsStateVariablesSubscribed)
         {
             _service.UnsubscribeStateVariables();
         }
         _service.StateVariableChanged    -= _stateVariableDelegate;
         _service.EventSubscriptionFailed -= SubscribeFailed;
         _stateVariableDelegate            = null;
     }
 }
Ejemplo n.º 4
0
 public void UnsubscribeStateVariables()
 {
   if (_stateVariableDelegate != null && _service != null)
   {
     if (_service.IsStateVariablesSubscribed)
     {
       _service.UnsubscribeStateVariables();
     }
     _service.StateVariableChanged -= _stateVariableDelegate;
     _service.EventSubscriptionFailed -= SubscribeFailed;
     _stateVariableDelegate = null;
   }
 }
Ejemplo n.º 5
0
 internal void FireStateVariableChanged(DvStateVariable variable)
 {
     try
     {
         StateVariableChangedDlgt stateVariableChanged = StateVariableChanged;
         if (stateVariableChanged != null)
         {
             stateVariableChanged(variable);
         }
     }
     catch (Exception e)
     {
         UPnPConfiguration.LOGGER.Warn("DvService: Error invoking StateVariableChanged delegate", e);
     }
 }
Ejemplo n.º 6
0
 internal void InvokeStateVariableChanged(CpStateVariable variable, object newValue)
 {
     try
     {
         StateVariableChangedDlgt stateVariableChanged = StateVariableChanged;
         if (stateVariableChanged != null)
         {
             stateVariableChanged(variable, newValue);
         }
     }
     catch (Exception e)
     {
         UPnPConfiguration.LOGGER.Warn("CpService: Error invoking StateVariableChanged delegate", e);
     }
 }
Ejemplo n.º 7
0
    /// <summary>
    /// Build the graph.
    /// </summary>
    public override void BuildGraph()
    {
      try
      {
        if (_graphState != GraphState.Idle)
        {
          Log.Log.Info("DRI CC: device already initialised");
          return;
        }

        bool useKeepAlive = !_isCetonDevice;
        Log.Log.Info("DRI CC: connect to device, keep-alive = {0}", useKeepAlive);
        _deviceConnection = _controlPoint.Connect(_descriptor.RootDescriptor, _descriptor.DeviceUUID, ResolveDataType, useKeepAlive);

        // services
        Log.Log.Debug("DRI CC: setup services");
        _tunerService = new TunerService(_deviceConnection.Device);
        _fdcService = new FdcService(_deviceConnection.Device);
        _auxService = new AuxService(_deviceConnection.Device);
        _encoderService = new EncoderService(_deviceConnection.Device);
        _casService = new CasService(_deviceConnection.Device);
        _muxService = new MuxService(_deviceConnection.Device);
        _securityService = new SecurityService(_deviceConnection.Device);
        _diagService = new DiagService(_deviceConnection.Device);
        _avTransportService = new AvTransportService(_deviceConnection.Device);
        _connectionManagerService = new ConnectionManagerService(_deviceConnection.Device);

        Log.Log.Debug("DRI CC: subscribe services");
        _stateVariableDelegate = new StateVariableChangedDlgt(OnStateVariableChanged);
        _tunerService.SubscribeStateVariables(_stateVariableDelegate);
        _auxService.SubscribeStateVariables(_stateVariableDelegate);
        _encoderService.SubscribeStateVariables(_stateVariableDelegate);
        _casService.SubscribeStateVariables(_stateVariableDelegate);
        _securityService.SubscribeStateVariables(_stateVariableDelegate);
        _avTransportService.SubscribeStateVariables(_stateVariableDelegate);
        _connectionManagerService.SubscribeStateVariables(_stateVariableDelegate);

        // Give time for the device to notify us about initial state variable values.
        // Attempting to continue with other actions now can overload the puny device
        // processors.
        Thread.Sleep(2000);

        int rcsId = -1;
        _connectionManagerService.PrepareForConnection(string.Empty, string.Empty, -1, UpnpConnectionDirection.Output, out _connectionId, out _avTransportId, out rcsId);
        Log.Log.Debug("DRI CC: PrepareForConnection, connection ID = {0}, AV transport ID = {1}", _connectionId, _avTransportId);

        // Check that the device is not already in use.
        if (IsTunerInUse())
        {
          throw new TvExceptionGraphBuildingFailed("DRI CC: tuner appears to be in use");
        }

        ReadDeviceInfo();

        Log.Log.Info("DRI CC: build graph");
        _graphBuilder = (IFilterGraph2)new FilterGraph();
        _capBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
        _capBuilder.SetFiltergraph(_graphBuilder);
        _rotEntry = new DsROTEntry(_graphBuilder);
        AddTsWriterFilterToGraph();
        AddStreamSourceFilter();

        // This shouldn't be required, but it enables us to reuse TvCardDvbBase
        // and use CI menus for delivering messages from the CableCARD to the
        // user.
        _conditionalAccess = new ConditionalAccess(null, null, null, this);

        _graphState = GraphState.Created;
      }
      catch (Exception)
      {
        Dispose();
        throw;
      }
    }