[PATCH] DiSeq settings per Card, not per channel (1 Viewer)

jblomb

Retired Team Member
  • Premium Supporter
  • May 17, 2007
    96
    17
    Sundsvall
    Home Country
    Sweden Sweden
    If you have more than one sat-card and different DiSeq-settings for each card the approach of today is not enough to store the DiSeq-settings in table TuningDetail. I have made a patch that looks for the setting in table Settings instead.

    Basically..
    A new column is needed in TuningDetail - satContext - that contains the context of the scanned satellite. It is updated during scan.
    At the time of tuning to a channel, it tries to match the satContext with the settings for the card and gets the DiSeq-setting as well. It then updates column diseqc in TuningDetail so the normal tuning procedure will work.

    From log:
    Code:
    card: user: tvpc:10:-1 tune DVBS:tv: TV1000 Classic   ......   DisEqc:None  .....  satContext:143
    card: DiSeq: Trying to find DiSeq for card 10
    card: DiSeq: dvbs10SatteliteContext1 = 142
    card: DiSeq: dvbs10SatteliteContext2 = 143
    card: DiSeq: Found satContext 143
    card: DiSeq: Setting dvbs10DisEqc2 is 2
    card: DiSeq: Updating DiSeqc to 2
    dvbs:  Tune:DVBS:tv: TV1000 Classic ...... DisEqc:SimpleB ...... satContext:143
    ....
    FireDTV SendDiseqcCommand() diseqc:SimpleB, .........
    FireDTV:SendDiseq: 0xFF 0xFF 0xFF 0x1 0x4 0xE0 0x10 0x38 0xF7 0x0

    What is NOT included in this patch is the code to add the column satContext (int, not null, default value -1). This is intentional since it would require updating the db version, and that is something for the developers to do :)

    I used the following code to update it tho at runtime (Service1.cs):
    Code:
          string connectionString, provider;
          GetDatabaseConnectionString(out connectionString, out provider);
          Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(connectionString);
    
          SqlResult boff = null;
          try
          {
            boff = Broker.Execute("select * from TuningDetail where satContext='9999'");
          }
          catch
          {
            try
            {
              Log.Debug("Updating database MySql");
              boff = Broker.Execute("ALTER TABLE 'tuningdetail' ADD COLUMN 'satContext' int(-1) NOT NULL");
              Log.Debug("...Succeeded");
            }
            catch (Exception ex) 
            { 
              Log.Debug("...Failed {0}", ex); 
              try
              {
                Log.Debug("Updating database SQL Server");
                boff = Broker.Execute("ALTER TABLE TuningDetail ADD satContext int NOT NULL CONSTRAINT DF_TuningDetail_satContext  DEFAULT ((-1))");
                Log.Debug("...Succeeded");
              }
              catch (Exception ec) { Log.Debug("...Failed {0}", ec); }
            }
          }

    A discussion about this and a build that works is available at thread https://forum.team-mediaportal.com/1-0-final-svn-builds-302/diseq-switching-problem-patch-included-52758/#post362521
     

    jblomb

    Retired Team Member
  • Premium Supporter
  • May 17, 2007
    96
    17
    Sundsvall
    Home Country
    Sweden Sweden
    No interest in this?
    Another approach would be to save the diseq settings in table ChannelMap, but then you might need to scan all cards to get the right setting - not just map the channels to a card.

    I know my solution above is not very "neat" since it requires updating the database every time you tune to a channel, but at least it works :)
     

    Users who are viewing this thread

    Top Bottom