private void TestFEC()
        {
            int       hr = 0;
            FECMethod fecMethod2, fecMethod1 = FECMethod.Viterbi;
            BinaryConvolutionCodeRate fecRate2, fecRate1 = BinaryConvolutionCodeRate.Rate2_3;

            hr = digitalDemux.put_InnerFECMethod(ref fecMethod1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_InnerFECMethod(out fecMethod2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_InnerFECRate(ref fecRate1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_InnerFECRate(out fecRate2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_OuterFECMethod(ref fecMethod1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_OuterFECMethod(out fecMethod2);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.put_OuterFECRate(ref fecRate1);
            //DsError.ThrowExceptionForHR(hr);

            hr = digitalDemux.get_OuterFECRate(out fecRate2);
            //DsError.ThrowExceptionForHR(hr);
        }
Esempio n. 2
0
        internal override bool SetDVBS2Parameters(TuningSpec tuningSpec, IBaseFilter tunerFilter, ITuneRequest tuneRequest)
        {
            if (!dvbs2Capable)
            {
                return(true);
            }

            IBDA_DigitalDemodulator demodulator = FindDemodulator("DigitalEverywhere", tunerFilter);

            if (demodulator == null)
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Demodulator not located");
                return(false);
            }

            ModulationType modulationType = ModulationType.ModNotSet;

            switch (tuningSpec.Modulation)
            {
            case Modulation.QPSK:
                modulationType = ModulationType.ModNbcQpsk;
                break;

            case Modulation.PSK8:
                modulationType = ModulationType.ModNbc8Psk;
                break;

            default:
                break;
            }

            if (modulationType != ModulationType.ModNotSet)
            {
                reply = demodulator.put_ModulationType(ref modulationType);
                if (reply != 0)
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Set Modulation Type failed error code 0x" + reply.ToString("X"));
                    return(false);
                }
                else
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Modulation type changed to " + modulationType);
                }
            }
            else
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Modulation type not changed");
            }

            BinaryConvolutionCodeRate oldCodeRate;

            reply = demodulator.get_InnerFECRate(out oldCodeRate);
            if (reply != 0)
            {
                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Get FEC Rate failed error code 0x" + reply.ToString("X"));
                return(false);
            }

            SatelliteFrequency satelliteFrequency = tuningSpec.Frequency as SatelliteFrequency;

            BinaryConvolutionCodeRate newCodeRate = oldCodeRate;

            if (satelliteFrequency.Pilot == DomainObjects.Pilot.Off)
            {
                newCodeRate += 64;
            }
            else
            {
                if (satelliteFrequency.Pilot == DomainObjects.Pilot.On)
                {
                    newCodeRate += 128;
                }
            }

            switch (satelliteFrequency.RollOff)
            {
            case DomainObjects.RollOff.RollOff20:
                newCodeRate += 16;
                break;

            case DomainObjects.RollOff.RollOff25:
                newCodeRate += 32;
                break;

            case DomainObjects.RollOff.RollOff35:
                newCodeRate += 48;
                break;

            default:
                break;
            }

            if (oldCodeRate != newCodeRate)
            {
                reply = demodulator.put_InnerFECRate(newCodeRate);
                if (reply != 0)
                {
                    Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: Set FEC Rate failed error code 0x" + reply.ToString("X"));
                    return(false);
                }

                Logger.Instance.Write("DigitalEverywhere DVB-S2 handler: FEC Rate changed from " + oldCodeRate + " to " + newCodeRate);
            }

            return(true);
        }