Skip to content

Commit

Permalink
Some changes:
Browse files Browse the repository at this point in the history
- remove the recently added LNB LOF workaround. TBS have acknowledged the issue and are going to release new drivers that fix the problem.
- refactor SetLnbPower() and SetTuningParameters() to be more generic as already done for Twinhan
  • Loading branch information
mm1352000 committed Jan 6, 2012
1 parent 02248d3 commit 0538ffe
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 29 deletions.
Expand Up @@ -924,7 +924,7 @@ public DVBSChannel SetDVBS2Modulation(ScanParameters parameters, DVBSChannel cha
}
if (_turbosight != null)
{
return _turbosight.SetTuningParameters(channel);
return (DVBSChannel)_turbosight.SetTuningParameters(channel as DVBBaseChannel);
}
if (_technoTrend != null)
{
Expand Down
Expand Up @@ -373,7 +373,7 @@ public Turbosight(IBaseFilter tunerFilter)
_tunerFilter = tunerFilter;
_generalBuffer = Marshal.AllocCoTaskMem(TbsAccessParamsSize);
OpenCi();
SetLnbPowerState(true);
SetPowerState(true);
}

/// <summary>
Expand All @@ -389,13 +389,13 @@ public bool IsTurbosight
}

/// <summary>
/// Turn the LNB power supply on or off.
/// Turn the LNB or aerial power supply on or off.
/// </summary>
/// <param name="powerOn"><c>True</c> to turn power supply on, otherwise <c>false</c>.</param>
/// <returns><c>true</c> if the power supply state is set successfully, otherwise <c>false</c></returns>
public bool SetLnbPowerState(bool powerOn)
public bool SetPowerState(bool powerOn)
{
Log.Log.Debug("Turbosight: set LNB power state, on = {0}", powerOn);
Log.Log.Debug("Turbosight: set power state, on = {0}", powerOn);

TbsAccessParams accessParams = new TbsAccessParams();
accessParams.AccessMode = TbsAccessMode.LnbPower;
Expand Down Expand Up @@ -494,14 +494,20 @@ public bool SetToneState(ToneBurst toneBurstState, Tone22k tone22kState)
}

/// <summary>
/// Set DVB-S2 tuning parameters that could not previously be set through BDA interfaces.
/// Set tuning parameters that can or could not previously be set through BDA interfaces.
/// </summary>
/// <param name="channel">The channel to tune.</param>
/// <returns>The channel with DVB-S2 parameters set.</returns>
public DVBSChannel SetTuningParameters(DVBSChannel channel)
/// <returns>The channel with parameters adjusted as necessary.</returns>
public DVBBaseChannel SetTuningParameters(DVBBaseChannel channel)
{
Log.Log.Debug("Turbosight: set tuning parameters");
switch (channel.InnerFecRate)
DVBSChannel ch = channel as DVBSChannel;
if (ch == null)
{
return channel;
}

switch (ch.InnerFecRate)
{
case BinaryConvolutionCodeRate.Rate1_2:
case BinaryConvolutionCodeRate.Rate2_3:
Expand All @@ -510,42 +516,38 @@ public DVBSChannel SetTuningParameters(DVBSChannel channel)
case BinaryConvolutionCodeRate.Rate4_5:
case BinaryConvolutionCodeRate.Rate5_6:
case BinaryConvolutionCodeRate.Rate7_8:
channel.InnerFecRate = channel.InnerFecRate;
ch.InnerFecRate = ch.InnerFecRate;
break;
case BinaryConvolutionCodeRate.Rate8_9:
channel.InnerFecRate = BinaryConvolutionCodeRate.Rate5_11;
ch.InnerFecRate = BinaryConvolutionCodeRate.Rate5_11;
break;
case BinaryConvolutionCodeRate.Rate9_10:
channel.InnerFecRate = BinaryConvolutionCodeRate.Rate7_8;
ch.InnerFecRate = BinaryConvolutionCodeRate.Rate7_8;
break;
default:
channel.InnerFecRate = BinaryConvolutionCodeRate.RateNotSet;
ch.InnerFecRate = BinaryConvolutionCodeRate.RateNotSet;
break;
}
Log.Log.Debug(" inner FEC rate = {0}", channel.InnerFecRate);
Log.Log.Debug(" inner FEC rate = {0}", ch.InnerFecRate);

if (channel.InnerFecRate != BinaryConvolutionCodeRate.RateNotSet)
if (ch.InnerFecRate != BinaryConvolutionCodeRate.RateNotSet)
{
if (channel.ModulationType == ModulationType.ModNotSet)
if (ch.ModulationType == ModulationType.ModNotSet)
{
channel.ModulationType = ModulationType.ModQpsk;
ch.ModulationType = ModulationType.ModQpsk;
}
else if (channel.ModulationType == ModulationType.ModQpsk)
else if (ch.ModulationType == ModulationType.ModQpsk)
{
channel.ModulationType = ModulationType.ModOqpsk;
ch.ModulationType = ModulationType.ModOqpsk;
}
else if (channel.ModulationType == ModulationType.Mod8Psk)
{
channel.ModulationType = ModulationType.ModBpsk;
}
else
else if (ch.ModulationType == ModulationType.Mod8Psk)
{
channel.ModulationType = ModulationType.ModNotDefined;
ch.ModulationType = ModulationType.ModBpsk;
}
}
Log.Log.Debug(" modulation = {0}", channel.ModulationType);
Log.Log.Debug(" modulation = {0}", ch.ModulationType);

return channel;
return ch as DVBBaseChannel;
}

#region conditional access
Expand Down Expand Up @@ -1419,7 +1421,7 @@ public void Dispose()
{
if (_isTurbosight)
{
SetLnbPowerState(false);
SetPowerState(false);
if (_mmiHandlerThread != null)
{
_stopMmiHandlerThread = true;
Expand Down
Expand Up @@ -339,6 +339,14 @@ private bool BeforeTune(ref int subChannelId, IChannel channel)
int lnbSwitch;
BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch);
Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch);
if (lnbSwitch == 0)
lnbSwitch = 18000;
IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace;
tuningSpace.put_LNBSwitch(lnbSwitch * 1000);
tuningSpace.put_LowOscillator(lowOsc * 1000);
tuningSpace.put_HighOscillator(hiOsc * 1000);
/*BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch);
Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch);
if (lnbSwitch == 0)
{
lnbSwitch = 18000000;
Expand All @@ -353,7 +361,7 @@ private bool BeforeTune(ref int subChannelId, IChannel channel)
IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace;
tuningSpace.put_LNBSwitch(lnbSwitch);
tuningSpace.put_LowOscillator(lof);
tuningSpace.put_HighOscillator(lof);
tuningSpace.put_HighOscillator(lof);*/
ITuneRequest request;
_tuningSpace.CreateTuneRequest(out request);
_tuneRequest = (IDVBTuneRequest)request;
Expand Down

0 comments on commit 0538ffe

Please sign in to comment.