public void ApplyOSAMeasureAll( )
        {
            try {
                DateTime startMeas = DateTime.UtcNow;
                SetAlignMode(true);

                Spectrum_OSA.PerformSingleSweep( );

                if (EnableAllChMeasurement) // All channel's ON
                {
                    // just measure secleted channel
                    SpectrumMeasure sm = (SpectrumMeasure)htChannelMeasure["Ch" + CurrentChannel.ToString()];
                    if (sm != null)
                    {
                        Spectrum_OSA.StartWavelength  = sm.StartWavelength;
                        Spectrum_OSA.StopWavelength   = sm.StopWavelength;
                        Spectrum_OSA.CenterWavelength = sm.CenterWavelength;
                        Spectrum_OSA.SpanWavelength   = 5.2f;
                        Spectrum_OSA.PerformSingleSweep();
                        Thread.Sleep(2000);
                        GetMeasureResult("Ch" + CurrentChannel.ToString());
                        Thread.Sleep(1000);
                    }
                    // don't measure 4 of them.
                    //for (int i = 0; i < 4; i++)
                    //{
                    //    SpectrumMeasure sm = (SpectrumMeasure)htChannelMeasure["Ch" + i.ToString()];
                    //    if (sm != null)
                    //    {
                    //        Spectrum_OSA.StartWavelength = sm.StartWavelength;
                    //        Spectrum_OSA.StopWavelength = sm.StopWavelength;
                    //        Spectrum_OSA.CenterWavelength = sm.CenterWavelength;
                    //        Spectrum_OSA.SpanWavelength = 5.2f;
                    //        Spectrum_OSA.PerformSingleSweep();
                    //        Thread.Sleep(2000);
                    //        GetMeasureResult("Ch" + i.ToString());
                    //        Thread.Sleep(1000);
                    //    }

                    //}
                }
                else // just one channel ON.
                {
                    GetMeasureResult(true);

                    SetAlignMode(false);
                    Spectrum_OSA.PerformSingleSweep();

                    GetMeasureResult(false);
                }
                FireOSAResultDataChanged( );
            }
            catch (Exception ex) {
                throw new Exception("MeasureAll ex=" + ex.ToString( ));
            }
            finally {
            }
        }
        /// <summary>
        /// string representation of the RSS feed.
        /// </summary>
        /// <returns>An rss formatted string</returns>
        public override string ToString()
        {
            StringBuilder DocumentString = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<rss xmlns:itunes=\"http://www.itunes.com/dtds/podcast-1.0.dtd\" xmlns:media=\"http://search.yahoo.com/mrss/\" version=\"2.0\">\r\n");

            foreach (Channel CurrentChannel in Channels)
            {
                DocumentString.Append(CurrentChannel.ToString());
            }
            DocumentString.Append("</rss>");
            return(DocumentString.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// Tune to channel
        /// </summary>
        /// <param name="subChannelId"></param>
        /// <param name="channel"></param>
        /// <returns></returns>
        private ITvSubChannel DoTune(int subChannelId, IChannel channel, bool ignorePMT)
        {
            Log.Log.WriteFile("dvbip:  Tune:{0}", channel);
            ITvSubChannel ch = null;

            try
            {
                DVBIPChannel dvbipChannel = channel as DVBIPChannel;
                if (dvbipChannel == null)
                {
                    Log.Log.WriteFile("Channel is not a IP TV channel!!! {0}", channel.GetType().ToString());
                    return(null);
                }

                Log.Log.Info("dvbip: tune: Assigning oldChannel");
                DVBIPChannel oldChannel = CurrentChannel as DVBIPChannel;
                if (CurrentChannel != null)
                {
                    //@FIX this fails for back-2-back recordings
                    //if (oldChannel.Equals(channel)) return _mapSubChannels[0];
                    Log.Log.Info("dvbip: tune: Current Channel != null {0}", CurrentChannel.ToString());
                }
                else
                {
                    Log.Log.Info("dvbip: tune: Current channel is null");
                }
                if (_graphState == GraphState.Idle)
                {
                    Log.Log.Info("dvbip: tune: Building graph");
                    BuildGraph();
                    if (_mapSubChannels.ContainsKey(subChannelId) == false)
                    {
                        subChannelId = GetNewSubChannel(channel);
                    }
                }
                else
                {
                    Log.Log.Info("dvbip: tune: Graph is running");
                }

                //_pmtPid = -1;

                Log.Log.Info("dvb:Submiting tunerequest Channel:{0} subChannel:{1} ", channel.Name, subChannelId);
                if (_mapSubChannels.ContainsKey(subChannelId) == false)
                {
                    Log.Log.Info("dvb:Getting new subchannel");
                    subChannelId = GetNewSubChannel(channel);
                }
                else
                {
                }
                Log.Log.Info("dvb:Submit tunerequest size:{0} new:{1}", _mapSubChannels.Count, subChannelId);
                _mapSubChannels[subChannelId].CurrentChannel = channel;

                _mapSubChannels[subChannelId].OnBeforeTune();

                if (_interfaceEpgGrabber != null)
                {
                    _interfaceEpgGrabber.Reset();
                }

                Log.Log.WriteFile("dvb:Submit tunerequest calling put_TuneRequest");
                _lastSignalUpdate = DateTime.MinValue;

                _mapSubChannels[subChannelId].OnAfterTune();
                ch = _mapSubChannels[subChannelId];
                Log.Log.Info("dvbip: tune: Running graph for channel {0}", ch.ToString());
                Log.Log.Info("dvbip: tune: SubChannel {0}", ch.SubChannelId);

                try
                {
                    RunGraph(ch.SubChannelId, dvbipChannel.Url);
                }
                catch (TvExceptionNoPMT)
                {
                    if (!ignorePMT)
                    {
                        throw;
                    }
                }

                Log.Log.Info("dvbip: tune: Graph running. Returning {0}", ch.ToString());
                return(ch);
            }
            catch (Exception ex)
            {
                if (ch != null)
                {
                    FreeSubChannel(ch.SubChannelId);
                }
                Log.Log.Write(ex);
                throw;
            }
            //unreachable return null;
        }