Esempio n. 1
0
        /// <summary>
        /// Führt die DiSEqC Steuerung aus.
        /// </summary>
        /// <param name="token">Die aktuellen Informationen zum Wechsel der Quellgruppe.</param>
        /// <returns>Meldet, wie die weitere Abarbeitung zu erfolgen hat.</returns>
        private PipelineResult ApplyDiSEqC( DataGraph.TuneToken token )
        {
            // Not active
            var diseqc = (token == null) ? null : token.DiSEqCMessage;
            if (diseqc == null)
            {
                // Reset request - or first call at all
                m_LastDiSEqC = null;

                // Next
                return PipelineResult.Continue;
            }

            // Attach to tuner
            var tuner = token.Pipeline.Graph.TunerFilter;
            if (tuner == null)
                return PipelineResult.Continue;

            // Verify that grpah is created
            if (token.Pipeline.Graph.TransportStreamAnalyser == null)
                return PipelineResult.Continue;

            // Request the message to send
            if (diseqc.Equals( m_LastDiSEqC ))
                return PipelineResult.Continue;

            // Attach to the one input pin of the tuner
            using (var input = tuner.GetSinglePin( PinDirection.Input ))
            using (var propertySet = KsPropertySet.Create<DiSEqCMessage>( input.Interface ))
                if (propertySet != null)
                {
                    // Create the identifier of the property to use
                    var nodeReference = KsPNode.Create( TunerExtensionPropertiesS2, TunerExtensionProperties.DiSEqC, 0 );

                    // Check for support of the property
                    if (!propertySet.DoesSupport( nodeReference, PropertySetSupportedTypes.Set ))
                        return PipelineResult.Continue;

                    // Create structures
                    var message = new DiSEqCMessage();

                    // Create a copy
                    var command = (byte[]) diseqc.Request.Clone();

                    // As long as necessary
                    try
                    {
                        // Prepare the message
                        message.Request = new byte[151];

                        // Fill the message
                        command.CopyTo( message.Request, 0 );

                        // Configure
                        message.RequestLength = (byte) command.Length;
                        message.LastMessage = true;
                        message.Power = 0;

                        // Send the message
                        propertySet.Set( nodeReference, message );
                    }
                    catch
                    {
                        // Reset
                        m_LastDiSEqC = null;

                        // Forward
                        throw;
                    }

                    // Remember
                    m_LastDiSEqC = diseqc.Clone();
                }

            // Next
            return PipelineResult.Continue;
        }
Esempio n. 2
0
        /// <summary>
        /// Führt die DiSEqC Steuerung aus.
        /// </summary>
        /// <param name="token">Die aktuellen Informationen zum Wechsel der Quellgruppe.</param>
        /// <returns>Meldet, wie die weitere Abarbeitung zu erfolgen hat.</returns>
        private PipelineResult ApplyDiSEqC(DataGraph.TuneToken token)
        {
            // Not active
            var diseqc = (token == null) ? null : token.DiSEqCMessage;

            if (diseqc == null)
            {
                // Reset request - or first call at all
                m_LastDiSEqC = null;

                // Next
                return(PipelineResult.Continue);
            }

            // Attach to tuner
            var tuner = token.Pipeline.Graph.TunerFilter;

            if (tuner == null)
            {
                return(PipelineResult.Continue);
            }

            // Verify that grpah is created
            if (token.Pipeline.Graph.TransportStreamAnalyser == null)
            {
                return(PipelineResult.Continue);
            }

            // Request the message to send
            if (diseqc.Equals(m_LastDiSEqC))
            {
                return(PipelineResult.Continue);
            }

            // Attach to the one input pin of the tuner
            using (var input = tuner.GetSinglePin(PinDirection.Input))
                using (var propertySet = KsPropertySet.Create <DiSEqCMessage>(input.Interface))
                    if (propertySet != null)
                    {
                        // Create the identifier of the property to use
                        var nodeReference = KsPNode.Create(TunerExtensionPropertiesS2, TunerExtensionProperties.DiSEqC, 0);

                        // Check for support of the property
                        if (!propertySet.DoesSupport(nodeReference, PropertySetSupportedTypes.Set))
                        {
                            return(PipelineResult.Continue);
                        }

                        // Create structures
                        var message = new DiSEqCMessage();

                        // Create a copy
                        var command = (byte[])diseqc.Request.Clone();

                        // As long as necessary
                        try
                        {
                            // Prepare the message
                            message.Request = new byte[151];

                            // Fill the message
                            command.CopyTo(message.Request, 0);

                            // Configure
                            message.RequestLength = (byte)command.Length;
                            message.LastMessage   = true;
                            message.Power         = 0;

                            // Send the message
                            propertySet.Set(nodeReference, message);
                        }
                        catch
                        {
                            // Reset
                            m_LastDiSEqC = null;

                            // Forward
                            throw;
                        }

                        // Remember
                        m_LastDiSEqC = diseqc.Clone();
                    }

            // Next
            return(PipelineResult.Continue);
        }