示例#1
0
        public static string GetTuningParamsAsString(TuningInfo tuning_info)
        {
            ChannelTuningInfo channel_tuning_info = tuning_info as ChannelTuningInfo;
            DvbTuningInfo     dvb_tuning_info     = tuning_info as DvbTuningInfo;
            StringTuningInfo  string_tuning_info  = tuning_info as StringTuningInfo;

            if (channel_tuning_info != null)
            {
                if (channel_tuning_info.SubNumber != -1)
                {
                    return(string.Format("{0}.{1} ModulationType: {2}", channel_tuning_info.PhysicalNumber, channel_tuning_info.SubNumber, channel_tuning_info.ModulationType));
                }
                else
                {
                    return(string.Format("{0} ModulationType: {1}", channel_tuning_info.PhysicalNumber, channel_tuning_info.ModulationType));
                }
            }
            else if (dvb_tuning_info != null)
            {
                return(string.Format("Freq: {0} Lcn: {1} Nid: {2} ONid: {3}, Sid: {4}, TSid: {5} SignalQuality: {6}", dvb_tuning_info.Frequency, dvb_tuning_info.Lcn, dvb_tuning_info.Nid, dvb_tuning_info.Onid, dvb_tuning_info.Sid, dvb_tuning_info.Tsid, dvb_tuning_info.SignalQuality));
            }
            else if (string_tuning_info != null)
            {
                return(string.Format("TuningString: {0}", string_tuning_info.TuningString));
            }
            return(tuning_info.ToString());
        }
示例#2
0
        private void RemoveTuningInfoClick(object sender, EventArgs e)
        {
            if (selected_tuning_info_ == null)
            {
                return;
            }
            DialogResult dr = MessageBox.Show("Delete selected tuning info from the selected channel?", "Are you sure?", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                try
                {
                    ChannelTuningInfo tuning_info = selected_tuning_info_;
                    selected_channel_.TuningInfos.RemoveAllMatching(tuning_info);
                    foreach (MergedChannel merged_channel in selected_channel_.ReferencingPrimaryChannels)
                    {
                        merged_channel.TuningInfos.RemoveAllMatching(tuning_info);
                    }
                    foreach (MergedChannel merged_channel in selected_channel_.ReferencingSecondaryChannels)
                    {
                        merged_channel.TuningInfos.RemoveAllMatching(tuning_info);
                    }
                }
                catch (Exception exc)
                {
                    ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
                    key_valued_exception.AddKeyValue("tuning info", selected_tuning_info_);
                    key_valued_exception.AddKeyValue("channel", selected_channel_);
                    new ErrorReportingForm("Exception occured when deleting a tuning info", key_valued_exception);
                }
            }
        }
示例#3
0
        private static List <TuningInfo> CreateTuningInfosForChannel(
            int channel_number, int subchannel,
            ModulationType modulation_type, IEnumerable <Device> devices)
        {
            List <TuningInfo> tuning_infos = new List <TuningInfo>();

            foreach (Device d in devices)
            {
                string old_tuningspace_name = d.DeviceType.TuningSpaceName;
                if (string.IsNullOrEmpty(old_tuningspace_name))
                {
                    // hacky.  Why is it null for all my devices currently?
                    string temp_tuningspace_name = GetTuningSpaceNameForModulation(modulation_type);
                    // What really seems to matter looking at
                    // ChannelTuningInfo(Device device, SerializationFormat format, byte[] serializedTuneRequest, TuneRequest tr) : base(device, format, serializedTuneRequest, tr)
                    // in .NET Reflector is whether the tuning space has subnumbers or not.  So if we can't figure out
                    // what TuningSpace makes sense, pick one based on if subchannel is 0.
                    if (string.IsNullOrEmpty(temp_tuningspace_name))
                    {
                        temp_tuningspace_name = ((subchannel != 0) ? "Digital Cable" : "Cable");
                    }
                    d.DeviceType.TuningSpaceName = temp_tuningspace_name;
                }
                ChannelTuningInfo channel_tuning_info = new ChannelTuningInfo(d, channel_number, subchannel, modulation_type);
                tuning_infos.Add(channel_tuning_info);
            }
            return(tuning_infos);
        }
示例#4
0
 public static void FindAndRemoveCableCARDEIAChannel(Lineup cablecard_lineup, ChannelNumber EIA)
 {
     foreach (Channel ch in cablecard_lineup.GetChannels())
     {
         if (ch.TuningInfos != null && !ch.TuningInfos.Empty)
         {
             ChannelTuningInfo tuning_info = (ChannelTuningInfo)ch.TuningInfos.First;
             if (tuning_info.PhysicalNumber == EIA.Number && tuning_info.SubNumber == EIA.SubNumber)
             {
                 DeleteChannel(ch);
             }
         }
     }
 }
示例#5
0
        static void FindUnencryptedQAMChannels()
        {
            Lineup qam_lineup = FindQAMLineup();

            foreach (Channel ch in qam_lineup.GetChannels())
            {
                ChannelTuningInfo tuning_info = ch.TuningInfos.First as ChannelTuningInfo;
                if (tuning_info.IsEncrypted)
                {
                    continue;
                }
                Console.WriteLine("ClearQAM channel: physical channel number: {0}.{1}, callsign: {2}",
                                  tuning_info.PhysicalNumber, tuning_info.SubNumber, ch.CallSign);
            }
        }
示例#6
0
 private void PopulateTuningInfosListBox()
 {
     ChannelTuningInfosListBox.Items.Clear();
     if (selected_channel_ == null)
     {
         return;
     }
     foreach (TuningInfo tuning_info in selected_channel_.TuningInfos)
     {
         ChannelTuningInfo channel_tuning_info = tuning_info as ChannelTuningInfo;
         ChannelTuningInfosListBox.Items.Add(new ChannelTuningInfoListBoxWrapper(channel_tuning_info));
     }
     if (!selected_channel_.TuningInfos.Empty)
     {
         ChannelTuningInfosListBox.SelectedIndex = 0;
     }
     // this.richTextBox1.AppendText(selected_channel_.TuningInfos.First.Device.DeviceType.TuningSpace.ToString());
 }
示例#7
0
 public ChannelTuningInfoListBoxWrapper(ChannelTuningInfo ti)
 {
     channel_tuning_info_ = ti;
 }
        public static void AddUserChannelInLineup(Lineup lineup, string callsign, int channel_number, int subchannel, ModulationType modulation_type)
        {
            List <ChannelTuningInfo> tuning_infos = new List <ChannelTuningInfo>();

            foreach (Device device in lineup.ScanDevices)
            {
                string old_tuningspace_name = device.DeviceType.TuningSpaceName;
                if (string.IsNullOrEmpty(old_tuningspace_name))
                {
                    // hacky.  For now I'm just trying to get it to work with ClearQAM.  Ultimately I guess this would be a case
                    // statement picking a value based on modulation_type.  Why is it null for all my devices currently?
                    string temp_tuningspace_name = GetTuningSpaceNameForModulation(modulation_type);
                    // What really seems to matter looking at
                    // ChannelTuningInfo(Device device, SerializationFormat format, byte[] serializedTuneRequest, TuneRequest tr) : base(device, format, serializedTuneRequest, tr)
                    // in .NET Reflector is whether the tuning space has subnumbers or not.  So if we can't figure out
                    // what TuningSpace makes sense, pick one based on if subchannel is 0.
                    if (string.IsNullOrEmpty(temp_tuningspace_name))
                    {
                        temp_tuningspace_name = ((subchannel != 0) ? "ClearQAM" : "Cable");
                    }
                    device.DeviceType.TuningSpaceName = temp_tuningspace_name;
                }
                try
                {
                    ChannelTuningInfo channel_tuning_info = new ChannelTuningInfo(device, channel_number, subchannel, modulation_type);
                    tuning_infos.Add(channel_tuning_info);
                }
                finally
                {
                    device.DeviceType.TuningSpaceName = old_tuningspace_name;
                }
            }
            Channel ch = new Channel();

            ch.CallSign    = callsign;
            ch.ChannelType = ChannelType.UserAdded;
            ch.Number      = channel_number;
            ch.SubNumber   = subchannel;
            lineup.AddChannel(ch);
            foreach (ChannelTuningInfo channel_tuning_info in tuning_infos)
            {
                ch.TuningInfos.Add(channel_tuning_info);
            }
            ch.Update();
            MergedChannel merged_channel = new MergedChannel();

            merged_channel.Number      = channel_number;
            merged_channel.SubNumber   = subchannel;
            merged_channel.CallSign    = callsign;
            merged_channel.ChannelType = ChannelType.UserAdded;
            merged_channel.FullMerge(ch);
            MergedLineup merged_lineup = (lineup.PrimaryProvider != null) ? lineup.PrimaryProvider : lineup.SecondaryProvider;

            if (merged_lineup == null)
            {
                merged_lineup = new MergedLineups(lineup.ObjectStore).First;
            }
            List <Channel> new_channels_list = new List <Channel>();

            new_channels_list.Add(ch);
            bool old_keepAllPrimary   = merged_lineup.LineupMergeRule.KeepAllPrimary;
            bool old_keepAllSecondary = merged_lineup.LineupMergeRule.KeepAllSecondary;

            merged_lineup.LineupMergeRule.KeepAllPrimary   = true;
            merged_lineup.LineupMergeRule.KeepAllSecondary = true;
            try
            {
                lineup.NotifyChannelAdded(ch);
//                merged_lineup.OnChannelsAdded(lineup, new_channels_list);
            }
            finally
            {
                merged_lineup.LineupMergeRule.KeepAllPrimary   = old_keepAllPrimary;
                merged_lineup.LineupMergeRule.KeepAllSecondary = old_keepAllSecondary;
            }
        }
示例#9
0
 public ChannelTuningInfoListBoxWrapper(ChannelTuningInfo ti)
 {
     channel_tuning_info_ = ti;
 }
 private static bool QAMTuningInfoMatchesMapEntry(ChannelTuningInfo tuning_info, ChannelMapEntry entry)
 {
     return (entry.PhysicalChannel.Number == tuning_info.PhysicalNumber &&
         entry.PhysicalChannel.SubNumber == tuning_info.SubNumber &&
         entry.Modulation == tuning_info.ModulationType);
 }
 private static bool IsTuningInfoOnQAMTuner(ChannelTuningInfo tuning_info)
 {
     if (tuning_info.Device == null) return false;
     string guid = tuning_info.Device.StoredObjectGuid;
     foreach (Device device in qam_lineup.ScanDevices)
     {
         if (device.StoredObjectGuid == guid)
             return true;
     }
     return false;
 }