private static extern DVBError CDVBFrontend_GetChannel( IntPtr pData, out Channel_S rChannel );
private static extern DVBError CDVBFrontend_SetChannel( IntPtr pData, Channel_S rChannel, bool bPowerOnly );
/// <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; }
private static extern DVBError CDVBFrontend_GetChannel(IntPtr pData, 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 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); }
private static extern DVBError CDVBFrontend_SetChannel(IntPtr pData, Channel_S rChannel, bool bPowerOnly);