Beispiel #1
0
    FrontendType GetElementType(FrontendType t)
    {
        var result = t;

        while (result is FrontendPointerType pt)
        {
            result = pt.elementType;
        }
        return(result);
    }
Beispiel #2
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-T Quellgruppe handelt.</returns>
        private bool SendChannel(TerrestrialGroup group)
        {
            // Not us
            if (group == null)
            {
                return(false);
            }

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

            // Helper
            var channel =
                new Channel_T
            {
                Frequency = group.Frequency,
                Inversion = SpectrumInversion.Off,
                Scan      = false,
            };

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: channel.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: channel.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: channel.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: channel.Bandwidth = BandwidthType.None; break;

            default: channel.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_T rVal1, rVal2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out rVal1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out rVal2));

            // Did it
            return(true);
        }
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-T Quellgruppe handelt.</returns>
        private Channel_T?Tune(TerrestrialGroup group)
        {
            // Not us
            if (group == null)
            {
                return(null);
            }

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

            // Helper
            var data =
                new Channel_T
            {
                Frequency = group.Frequency,
                Inversion = SpectrumInversion.Off,
                Scan      = false,
            };

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: data.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: data.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: data.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: data.Bandwidth = BandwidthType.None; break;

            default: data.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            return(data.SetChannel(this));
        }
Beispiel #4
0
            static SSAType getTypeRef(FrontendType t, int depth)
            {
                if (t.Equals(FrontendType.i8))
                {
                    return(Const.i8_t);
                }
                if (t.Equals(FrontendType.i16))
                {
                    return(Const.i16_t);
                }
                if (t.Equals(FrontendType.i32))
                {
                    return(Const.i32_t);
                }
                if (t.Equals(FrontendType.i64))
                {
                    return(Const.i64_t);
                }
                if (t.Equals(FrontendType.mm))
                {
                    return(Const.mm_t);
                }
                if (t.Equals(FrontendType.f32))
                {
                    return(Const.f32_t);
                }
                if (t.Equals(FrontendType.f64))
                {
                    return(Const.f64_t);
                }
                if (t.Equals(FrontendType.f32_4x))
                {
                    return(Const.f32_4x_t);
                }
                if (t.Equals(FrontendType.f32_8x))
                {
                    return(Const.f32_8x_t);
                }
                if (t.Equals(FrontendType.i32_4x))
                {
                    return(Const.i32_4x_t);
                }
                if (t.Equals(FrontendType.i32_8x))
                {
                    return(Const.i32_8x_t);
                }
                if (t.Equals(FrontendType.i8_16x))
                {
                    return(Const.i8_16x_t);
                }
                if (t.Equals(FrontendType.i8_32x))
                {
                    return(Const.i8_32x_t);
                }
                if (t.Equals(FrontendType.bool_))
                {
                    return(Const.bool_t);
                }
                if (t.Equals(FrontendType.void_))
                {
                    return(Const.void_t);
                }
                if (t.Equals(FrontendType.string_))
                {
                    return(getTypeRef(t as FrontendStructType, depth));
                }
                switch (t)
                {
                case FrontendArrayType ta:
                    return(getTypeRef(ta, depth));

                case FrontendStructType ts:
                    return(getTypeRef(ts, depth));

                case FrontendPointerType tp:
                    return(getTypeRef(tp, depth));

                case FrontendFunctionType tf:
                    return(getTypeRef(tf, depth));

                case FrontendEnumType te:
                    return(getTypeRef(te, depth));
                }
                throw new InvalidCodePath();
            }
Beispiel #5
0
 public static SSAType GetTypeRef(FrontendType t)
 {
     return(getTypeRef(t, 0));
 }
 /// <summary>
 /// FrontendMenu class constructor.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="subtitle"></param>
 /// <param name="menuType"></param>
 public FrontendMenu(string name, string subtitle, FrontendType menuType)
 {
     this.name     = name;
     this.subtitle = subtitle;
     this.menuType = menuType;
 }
 /// <summary>
 /// FrontendMenu class constructor.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="menuType"></param>
 public FrontendMenu(string name, FrontendType menuType) : this(name, "", menuType)
 {
 }
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-C Quellgruppe handelt.</returns>
        private Channel_C?Tune(CableGroup group)
        {
            // Not us
            if (group == null)
            {
                return(null);
            }

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

            // Helper
            var data =
                new Channel_C
            {
                Frequency  = group.Frequency,
                SymbolRate = group.SymbolRate,
            };

            // Spectrum inversion
            switch (group.SpectrumInversion)
            {
            case SpectrumInversions.On: data.Inversion = SpectrumInversion.On; break;

            case SpectrumInversions.Off: data.Inversion = SpectrumInversion.Off; break;

            case SpectrumInversions.Auto: data.Inversion = SpectrumInversion.Auto; break;

            default: data.Inversion = SpectrumInversion.Auto; break;
            }

            // Modulation
            switch (group.Modulation)
            {
            case CableModulations.QAM16: data.Qam = Qam.Qam16; break;

            case CableModulations.QAM32: data.Qam = Qam.Qam32; break;

            case CableModulations.QAM64: data.Qam = Qam.Qam64; break;

            case CableModulations.QAM128: data.Qam = Qam.Qam128; break;

            case CableModulations.QAM256: data.Qam = Qam.Qam256; break;

            default: data.Qam = Qam.Qam64; break;
            }

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: data.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: data.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: data.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: data.Bandwidth = BandwidthType.None; break;

            default: data.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            return(data.SetChannel(this));
        }
        /// <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));
        }
Beispiel #10
0
        /// <summary>
        /// Wählt eine Quellgruppe an.
        /// </summary>
        /// <param name="group">Die Daten zur Quellgruppe.</param>
        /// <returns>Gesetzt, wenn es sich um eine DVB-C Quellgruppe handelt.</returns>
        private bool SendChannel(CableGroup group)
        {
            // Not us
            if (group == null)
            {
                return(false);
            }

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

            // Helper
            var channel =
                new Channel_C
            {
                Frequency  = group.Frequency,
                SymbolRate = group.SymbolRate,
            };

            // Spectrum inversion
            switch (group.SpectrumInversion)
            {
            case SpectrumInversions.On: channel.Inversion = SpectrumInversion.On; break;

            case SpectrumInversions.Off: channel.Inversion = SpectrumInversion.Off; break;

            case SpectrumInversions.Auto: channel.Inversion = SpectrumInversion.Auto; break;

            default: channel.Inversion = SpectrumInversion.Auto; break;
            }

            // Modulation
            switch (group.Modulation)
            {
            case CableModulations.QAM16: channel.Qam = Qam.Qam16; break;

            case CableModulations.QAM32: channel.Qam = Qam.Qam32; break;

            case CableModulations.QAM64: channel.Qam = Qam.Qam64; break;

            case CableModulations.QAM128: channel.Qam = Qam.Qam128; break;

            case CableModulations.QAM256: channel.Qam = Qam.Qam256; break;

            default: channel.Qam = Qam.Qam64; break;
            }

            // Check supported modes
            switch (group.Bandwidth)
            {
            case Bandwidths.Six: channel.Bandwidth = BandwidthType.Six; break;

            case Bandwidths.Seven: channel.Bandwidth = BandwidthType.Seven; break;

            case Bandwidths.Eight: channel.Bandwidth = BandwidthType.Eight; break;

            case Bandwidths.NotDefined: channel.Bandwidth = BandwidthType.None; break;

            default: channel.Bandwidth = BandwidthType.Auto; break;
            }

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_C val1, val2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val2));

            // Did it
            return(true);
        }
Beispiel #11
0
        /// <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 bool SendChannel(SatelliteGroup group, SatelliteLocation location)
        {
            // Not us
            if (location == null)
            {
                return(false);
            }
            if (group == null)
            {
                return(false);
            }

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

            // Create channel
            var channel =
                new Channel_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(CDVBFrontend_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
            channel.b22kHz = (group.Frequency >= location.SwitchFrequency) ? 1 : 0;
            channel.LOF    = (0 == channel.b22kHz) ? location.Frequency1 : location.Frequency2;

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

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

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

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

            // Process
            CheckChannel(CDVBFrontend_SetChannel(m_Class.ClassPointer, channel, false));

            // Check up for synchronisation
            Channel_S val1, val2;

            // Get channel twice
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val1));
            CheckChannel(CDVBFrontend_GetChannel(m_Class.ClassPointer, out val2));

            // Did it
            return(true);
        }