private static extern DVBError _GetChannel(IntPtr classPointer, out Channel_S rChannel);
 private static extern DVBError _SetChannel(IntPtr classPointer, Channel_S rChannel, bool bPowerOnly);
Beispiel #3
0
 private static extern DVBError _SetChannel( IntPtr classPointer, Channel_S rChannel, bool bPowerOnly );
Beispiel #4
0
 private static extern DVBError _GetChannel( IntPtr classPointer, out Channel_S rChannel );
        /// <summary>
        /// Wählt eine Quellgruppe aus.
        /// </summary>
        /// <param name="group">Díe Daten der Quellgruppe.</param>
        /// <param name="location">Die Wahl des Ursprungs, über den die Quellgruppe empfangen werden kann.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-S Quellgruppe handelt.</returns>
        private Channel_S?Tune(SatelliteGroup group, SatelliteLocation location)
        {
            // Not us
            if (location == null)
            {
                return(null);
            }
            if (group == null)
            {
                return(null);
            }

            // Validate
            if (FrontendType != FrontendType.Satellite)
            {
                throw new DVBException("Expected " + FrontendType.ToString() + " Channel");
            }

            // Create channel
            var data =
                new Channel_S
            {
                Mode       = group.UsesS2Modulation ? DVBSMode.DVB_S2 : DVBSMode.DVB_S,
                Inversion  = SpectrumInversion.Auto,
                SymbolRate = group.SymbolRate,
                Frequency  = group.Frequency,
            };


            // Attach to the DiSEqC setting
            var selector = StandardDiSEqC.FromSourceGroup(group, location);

            // See if the message is different from the last one
            if (!selector.Equals(m_lastMessage))
            {
                // Remember
                m_lastMessage = selector.Clone();

                // As long as necessary
                for (int nCount = selector.Repeat; nCount-- > 0; Thread.Sleep(120))
                {
                    // Send it
                    DVBException.ThrowOnError(_SendDiSEqCMsg(m_Class.ClassPointer, selector.Request, (byte)selector.Request.Length, selector.Burst), "Could not send DiSEqC message");

                    // Set repeat flag
                    if (selector.Request.Length > 0)
                    {
                        selector.Request[0] |= 1;
                    }
                }
            }

            // Calculated items
            data.b22kHz = (group.Frequency >= location.SwitchFrequency) ? 1 : 0;
            data.LOF    = (0 == data.b22kHz) ? location.Frequency1 : location.Frequency2;

            // Power modes
            switch (group.Polarization)
            {
            case Polarizations.Horizontal: data.LNBPower = PowerMode.Horizontal; break;

            case Polarizations.Vertical: data.LNBPower = PowerMode.Vertical; break;

            case Polarizations.NotDefined: data.LNBPower = PowerMode.Off; break;

            default: throw new ArgumentException(group.Polarization.ToString(), "Polarization");
            }

            // Process
            return(data.SetChannel(this, false));
        }