Ejemplo n.º 1
0
        private void SetLED(MicrowaveLinkQuality lq, MicrowaveLinkQuality.Parameters parameter, LED led)
        {
            bool on = false;

            switch (parameter)
            {
            case MicrowaveLinkQuality.Parameters.TunerLocked:
                on = lq.TunerLocked;
                break;

            case MicrowaveLinkQuality.Parameters.DemodulatorLocked:
                on = lq.DemodulatorLocked;
                break;

            case MicrowaveLinkQuality.Parameters.TransportStreamLocked:
                on = lq.TransportStreamLocked;
                break;

            case MicrowaveLinkQuality.Parameters.FECLocked:
                on = lq.FECLocked;
                break;

            case MicrowaveLinkQuality.Parameters.DecoderLocked:
                on = lq.DecoderLocked;
                break;

            default:
                return;
            }

            led.LEDColor = on ? LEDGood : LEDFail;
            tt.SetToolTip(led, string.Format(ttFormat[parameter], (on ? string.Empty : " NOT")));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Raise a link quality change event
 /// </summary>
 /// <param name="linkQuality">link quality data to broadcast</param>
 protected void RaiseLinkQualityChanged(MicrowaveLinkQuality linkQuality)
 {
     if (this.ReceiverLinkQualityChange != null)
     {
         this.ReceiverLinkQualityChange(this, new ReceiverEventArgs()
         {
             Connected = this.Connected, LinkQuality = linkQuality
         });
     }
 }
Ejemplo n.º 3
0
 private void FireLinkQualityChanged(MicrowaveLinkQuality linkQuality)
 {
     try
     {
         AppLogger.Message("  MicrowaveControlService2.FireLinkQualityChanged");
         clientCallback.LinkQualityChanged(linkQuality);
     }
     catch (Exception ex)
     {
         AppLogger.Dump(ex);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Retreives a full measure of link quality from the receiver
        /// </summary>
        /// <returns>a full measure of link quality from the receiver</returns>
        public override MicrowaveLinkQuality GetLinkQuality()
        {
            lock (_stateLock)
            {
                MicrowaveLinkQuality q = new MicrowaveLinkQuality();

                double snr1 = Read <double>(CommandCategory.Tuner, "sr1");
                double snr2 = Read <double>(CommandCategory.Tuner, "sr2");
                double rs1  = Read <double>(CommandCategory.Tuner, "rs1");
                double rs2  = Read <double>(CommandCategory.Tuner, "rs2");
                //make sure the sign is "-"
                if (rs1 > 0)
                {
                    rs1 *= -1;
                }
                if (rs2 > 0)
                {
                    rs2 *= -1;
                }

                PrintDebug("RSSI1: " + rs1 + "dB SNR1: " + snr1 + "dB RSSI2: " + rs2 + "dB SNR2: " + snr2 + "dB");

                q.SignalToNoiseRatio   = Math.Max(snr1, snr2);
                q.ValidParameterData  |= (int)MicrowaveLinkQuality.Parameters.SignalToNoiseRatio;
                q.ReceivedCarrierLevel = Math.Max(rs1, rs2);
                q.ValidParameterData  |= (int)MicrowaveLinkQuality.Parameters.ReceivedCarrierLevel;

                q.TunerLocked         = 0 == Read <int>(CommandCategory.Tuner, "syl");
                q.ValidParameterData |= (int)MicrowaveLinkQuality.Parameters.TunerLocked;

                q.BitErrorRatioPre    = Read <double>(CommandCategory.Demodulator, "pre");
                q.ValidParameterData |= (int)MicrowaveLinkQuality.Parameters.BitErrorRatioPre;
                q.BitErrorRatioPost   = Read <double>(CommandCategory.Demodulator, "pos");
                q.ValidParameterData |= (int)MicrowaveLinkQuality.Parameters.BitErrorRatioPost;

                q.DemodulatorLocked     = 0 == Read <int>(CommandCategory.Demodulator, "dmd");
                q.ValidParameterData   |= (int)MicrowaveLinkQuality.Parameters.DemodulatorLocked;
                q.TransportStreamLocked = 0 == Read <int>(CommandCategory.Demodulator, "tsl");
                q.ValidParameterData   |= (int)MicrowaveLinkQuality.Parameters.TransportStreamLocked;
                q.FECLocked             = 0 == Read <int>(CommandCategory.Demodulator, "fel");
                q.ValidParameterData   |= (int)MicrowaveLinkQuality.Parameters.FECLocked;
                q.DecoderLocked         = 0 == Read <int>(CommandCategory.VideoDecoder, "dec");
                q.ValidParameterData   |= (int)MicrowaveLinkQuality.Parameters.DecoderLocked;

                return(q);
            }
        }
Ejemplo n.º 5
0
        public void UpdateLinkQuality(MicrowaveLinkQuality lq)
        {
            this.ChangingSelf = true;

            if (lq.IsSet(MicrowaveLinkQuality.Parameters.SignalToNoiseRatio))
            {
                this.SignalToNoiseRatio = lq.SignalToNoiseRatio;
            }
            if (lq.IsSet(MicrowaveLinkQuality.Parameters.ReceivedCarrierLevel))
            {
                this.ReceivedCarrierLevel = lq.ReceivedCarrierLevel;
            }

            foreach (KeyValuePair <MicrowaveLinkQuality.Parameters, Control> kvp in ttBinding)
            {
                if (lq.IsSet(kvp.Key))
                {
                    SetLED(lq, kvp.Key, (LED)kvp.Value);
                }
            }

            this.ChangingSelf = false;
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            try
            {
                Type   implementation;
                string TCPAddress, ComPort;
                int    TCPPort, baud;
                bool   UsesTCP;
                SetupSession(args, out implementation, out TCPAddress, out TCPPort, out UsesTCP, out ComPort, out baud);

                using (MicrowaveReceiver rx = (MicrowaveReceiver)Activator.CreateInstance(implementation, TCPAddress, TCPPort, UsesTCP, ComPort, baud))
                {
                    if (rx.Connected)
                    {
                        Console.WriteLine("Ready.            (type help? to see full command listing)");
                        Console.Write(" > ");
                        string   command = Console.ReadLine();
                        string[] set     = command.Split(new char[] { ' ' }, 2);

                        int stressRepeat = 1;

                        int       stressSuccess = 0;
                        int       stressFailure = 0;
                        Stopwatch stopwatch     = new Stopwatch();
                        UInt64    totalTime     = 0;

                        while (!set[0].Equals("quit"))
                        {
                            stressSuccess = 0;
                            stressFailure = 0;
                            totalTime     = 0;
                            for (int i = 0; i < stressRepeat; i++)
                            {
                                if ((set[0] == "stress") && (i > 0))
                                {
                                    break;
                                }

                                switch (set[0])
                                {
                                case "help":
                                case "help?":
                                case "?":
                                    ShowHelp();
                                    break;

                                case "band?": Console.Out.WriteLine("Band: " + rx.GetBand());
                                    break;

                                case "freq?":
                                    try
                                    {
                                        stopwatch.Stop();
                                        stopwatch.Reset();
                                        stopwatch.Start();
                                        MicrowaveTuning t = rx.GetTuning();
                                        stopwatch.Stop();


                                        Console.WriteLine("Current Tuning Information");
                                        Console.WriteLine("    Frequency: " + t.Frequency + " Hz");
                                        Console.WriteLine("    Bandwidth: " + t.ChannelBandwidth + " Hz");
                                        Console.WriteLine("    Transport: " + t.TransportMode);
                                        Console.WriteLine("   Modulation: " + t.Modulation);
                                        Console.WriteLine("          FEC: " + t.ForwardErrorCorrection);
                                        Console.WriteLine("   Guard Int.: " + t.GuardInterval);
                                        Console.WriteLine("   Encryption: " + ((t.Encryption == null) ? "<null>" : (t.Encryption.Type + " " + t.Encryption.KeyLength + " bit")));
                                        stressSuccess++;
                                        totalTime += (UInt64)stopwatch.ElapsedMilliseconds;
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.ToString());
                                        stressFailure++;
                                    }
                                    break;

                                case "str?":
                                case "strength?":
                                    try
                                    {
                                        stopwatch.Stop();
                                        stopwatch.Reset();
                                        stopwatch.Start();
                                        MicrowaveLinkQuality q = rx.GetLinkQuality();
                                        stopwatch.Stop();

                                        Console.WriteLine("Link Quality");
                                        Console.WriteLine("         RCL: " + q.ReceivedCarrierLevel + " dB");
                                        Console.WriteLine("         SNR: " + q.SignalToNoiseRatio + " dB");
                                        Console.WriteLine("      Pre EC: " + q.BitErrorRatioPre);
                                        Console.WriteLine("     Post EC: " + q.BitErrorRatioPost);
                                        Console.WriteLine("  Tuner Lock: " + q.TunerLocked);
                                        Console.WriteLine("  Demod Lock: " + q.DemodulatorLocked);
                                        Console.WriteLine("     TS Lock: " + q.TransportStreamLocked);
                                        Console.WriteLine("    FEC Lock: " + q.FECLocked);
                                        Console.WriteLine("Decoder Lock: " + q.DecoderLocked);
                                        stressSuccess++;
                                        totalTime += (UInt64)stopwatch.ElapsedMilliseconds;
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.ToString());
                                        stressFailure++;
                                    }
                                    break;

                                //case "band":
                                //    MicrowaveReceiver.OperatingBand band = MicrowaveReceiver.OperatingBand.NotSet;
                                //    switch (set[1])
                                //    {
                                //        case "S": band = MicrowaveReceiver.OperatingBand.S;
                                //            break;
                                //        case "L": band = MicrowaveReceiver.OperatingBand.L;
                                //            break;
                                //        case "C": band = MicrowaveReceiver.OperatingBand.C;
                                //            break;
                                //        case "X": band = MicrowaveReceiver.OperatingBand.X;
                                //            break;
                                //        default: band = MicrowaveReceiver.OperatingBand.NotSet;
                                //            break;
                                //    }
                                //    bool result = rx.SetBand(band);
                                //    Console.Out.WriteLine(result ? "Successful!" : "Failed!");
                                //    break;
                                case "freq":
                                    try
                                    {
                                        int freq = -1;
                                        if (int.TryParse(set[1], out freq))
                                        {
                                            MicrowaveCapabilities caps = rx.GetCapabilities();
                                            if (caps.AutoTuningRequirements != (int)MicrowaveTuning.Parameters.Frequency)
                                            {
                                                Console.WriteLine("  WARNING: not all AutoTune requirements met");
                                            }

                                            rx.SetTuning(new MicrowaveTuning(caps.AutoTuning)
                                            {
                                                FrequencyMHz = (UInt64)freq
                                            });
                                            Console.WriteLine("OK");
                                            stressSuccess++;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine("Failure");
                                        Console.WriteLine(ex.ToString());
                                        stressFailure++;
                                    }
                                    break;

                                case "test":
                                    Console.WriteLine("Test Connection: " + rx.TestConnection());
                                    break;

                                case "peak":
                                    Console.WriteLine("Not implemented");
                                    break;

                                case "stress":
                                    try
                                    {
                                        stressRepeat = int.Parse(set[1]);
                                        if (stressRepeat <= 1)
                                        {
                                            stressRepeat = 1;
                                            Console.WriteLine("Stress test mode OFF");
                                        }
                                        else
                                        {
                                            Console.WriteLine("Commands will be executed " + stressRepeat + " times");
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex);
                                    }
                                    break;

                                case "stress?":
                                    if (stressRepeat <= 1)
                                    {
                                        Console.WriteLine("Stress test mode OFF");
                                    }
                                    else
                                    {
                                        Console.WriteLine("Stress repeat = " + stressRepeat);
                                    }
                                    break;

                                case "info?":
                                    Console.WriteLine(rx.GetDeviceInfo());
                                    break;

                                case "raw":
                                    Console.WriteLine(rx.RawCommand(set[1]));
                                    break;

                                default:
                                    Console.WriteLine("-not a command-");
                                    break;
                                }
                            }

                            if (stressRepeat > 1)
                            {
                                Console.WriteLine();
                                Console.WriteLine("   -- Stress Test Results --");
                                Console.WriteLine(" " + stressSuccess + " / " + stressRepeat + " Succeeded");
                                Console.WriteLine(" " + stressFailure + " / " + stressRepeat + " Failed");
                                Console.WriteLine(" " + (UInt64)((double)totalTime / (double)stressSuccess) + " ms per successful operation (avg)");
                            }


                            Console.Write(" > ");
                            command = Console.ReadLine();
                            set     = command.Split(new char[] { ' ' });
                        }
                    }
                    else
                    {
                        Console.Out.WriteLine("Not Connected");
                        Console.ReadLine();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("");
                Console.WriteLine("FAILTOWN");
                Console.WriteLine(ex.ToString());
                Console.WriteLine("press enter to quit");
                Console.ReadLine();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Puts results into PeakDictionary for class
        /// Scans by 1s, e.g. 1700, 1701, etc
        /// </summary>
        /// <param name="fineIntervals"></param>
        internal void FinalScan(List <UInt64> fineIntervals)
        {
            if (bgw.CancellationPending)
            {
                return;
            }
            Dictionary <MicrowaveTuning, MicrowaveLinkQuality> tempPeakDict = new Dictionary <MicrowaveTuning, MicrowaveLinkQuality>();

            //For each interval
            for (int i = 0; i < fineIntervals.Count && !bgw.CancellationPending; i += 2)
            {
                UInt64 intervalStart = fineIntervals[i];
                UInt64 intervalEnd   = fineIntervals[i + 1];

                Debug.WriteLine("Starting Interval: " + intervalStart + " to: " + intervalEnd);
                UInt64 currentPeak = 0;
                MicrowaveLinkQuality currentPeakStrength = new MicrowaveLinkQuality(0);
                //For each frequency
                for (UInt64 currentFreq = intervalStart;
                     currentFreq < intervalEnd && !bgw.CancellationPending; currentFreq++)
                {
                    _prototype.Frequency = currentFreq;
                    try
                    {
                        rx.SetTuning(_prototype);
                    }
                    catch
                    {
                        continue;
                    }
                    MicrowaveLinkQuality strength = rx.GetLinkQuality();
                    Debug.WriteLine("Freq Changed: " + currentFreq + "\r\nStrength: " + strength);

                    if (strength.ReceivedCarrierLevel > _minStrength)
                    {
                        if (strength.ReceivedCarrierLevel > currentPeakStrength.ReceivedCarrierLevel)
                        {
                            currentPeak         = currentFreq;
                            currentPeakStrength = strength;
                        }
                        else//save peak and watch for next one
                        {
                            if ((currentPeak > 0) && (currentPeakStrength.ReceivedCarrierLevel > 0))
                            {
                                tempPeakDict.Add(new MicrowaveTuning(_prototype), new MicrowaveLinkQuality(currentPeakStrength));
                            }
                            Debug.WriteLine("Final Peak: " + currentPeak + " strength: " + currentPeakStrength);
                            currentPeakStrength = strength;
                            currentPeak         = 0;
                        }
                    }
                    else
                    {
                        //Save peak
                        if ((currentPeak > 0) && (currentPeakStrength.ReceivedCarrierLevel > 0))
                        {
                            MicrowaveTuning peakTuning = new MicrowaveTuning(_prototype);
                            peakTuning.Frequency = currentPeak;
                            tempPeakDict.Add(peakTuning, new MicrowaveLinkQuality(currentPeakStrength));
                            Debug.WriteLine("Final Peak: " + currentPeak + " strength: " + currentPeakStrength);
                        }
                        currentPeakStrength.ReceivedCarrierLevel = 0;
                    }
                }//End Frequencies in Interval
                if ((currentPeak > 0) && (currentPeakStrength.ReceivedCarrierLevel > 0))
                {
                    MicrowaveTuning peakTuning = new MicrowaveTuning(_prototype);
                    peakTuning.Frequency = currentPeak;
                    tempPeakDict.Add(peakTuning, new MicrowaveLinkQuality(currentPeakStrength));
                    Debug.WriteLine("Final Peak: " + currentPeak + " strength: " + currentPeakStrength);
                }
            }//End Intervals
            if (!bgw.CancellationPending)
            {
                PeakDictionary = tempPeakDict;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Puts intermediate results into PeakDictionary
        /// </summary>
        /// <param name="roughIntervals"></param>
        /// <returns></returns>
        internal List <UInt64> FineScan(List <UInt64> roughIntervals)
        {
            List <UInt64> results = new List <UInt64>();

            if (bgw.CancellationPending)
            {
                return(results);
            }
            Dictionary <MicrowaveTuning, MicrowaveLinkQuality> tempPeakDictionary = new Dictionary <MicrowaveTuning, MicrowaveLinkQuality>();

            //For each range in the roughIntervals
            for (int i = 0; i < roughIntervals.Count - 1 && !bgw.CancellationPending; i += 2)
            {
                UInt64 intStart    = roughIntervals[i];
                UInt64 intEnd      = roughIntervals[i + 1];
                UInt64 currentPeak = 0;
                MicrowaveLinkQuality currentPeakStrength = new MicrowaveLinkQuality(0);
                UInt64 prePeakFreq = intStart;

                Debug.WriteLine("Starting Interval: " + intStart + " to: " + intEnd);
                //For each frequency in the interval
                for (UInt64 CurrFreq = intStart;
                     CurrFreq < intEnd && !bgw.CancellationPending; CurrFreq += FineInterval)
                {
                    _prototype.Frequency = CurrFreq;
                    try
                    {
                        rx.SetTuning(_prototype);
                    }
                    catch
                    {
                        continue;
                    }
                    MicrowaveLinkQuality strength = rx.GetLinkQuality();
                    Debug.WriteLine("Freq Changed: " + CurrFreq + "\r\nStrength: " + strength.ReceivedCarrierLevel);

                    if (strength.ReceivedCarrierLevel > _minStrength)
                    {
                        if (strength.ReceivedCarrierLevel > currentPeakStrength.ReceivedCarrierLevel)//Save as highest peak so far
                        {
                            if (currentPeak > prePeakFreq)
                            {//If tracking a peak alrady, update start position
                                prePeakFreq = currentPeak;
                            }
                            //Save as highest peak
                            currentPeak         = CurrFreq;
                            currentPeakStrength = strength;
                        }
                        else//above minimum, but lower than current peak
                        {
                            //Save peak and interval if we were tracking a peak
                            if (currentPeak > prePeakFreq)
                            {
                                tempPeakDictionary.Add(new MicrowaveTuning(_prototype), strength);
                                Debug.WriteLine("Temporary Peak Added: " + currentPeak);
                                results.Add(prePeakFreq);
                                results.Add(CurrFreq);
                                Debug.WriteLine("Interval Added: " + prePeakFreq + " to: " + CurrFreq);
                            }

                            //Reset prePeak to catch higher peaks within same set
                            currentPeakStrength = strength;
                            prePeakFreq         = CurrFreq;
                        }
                    }
                    else//too low. Finish interval if one exists, but don't start any new ones.
                    {
                        //If tracking peak, end and save it
                        if (currentPeak > prePeakFreq)
                        {
                            if (currentPeakStrength.ReceivedCarrierLevel > 0)
                            {
                                tempPeakDictionary.Add(new MicrowaveTuning(_prototype), strength);
                            }
                            results.Add(prePeakFreq);
                            results.Add(CurrFreq);
                            Debug.WriteLine("Interval Added: " + prePeakFreq + " to: " + CurrFreq);
                        }
                        currentPeakStrength.ReceivedCarrierLevel = 0;
                        prePeakFreq = CurrFreq;
                    }
                }//End Frequencies within Interval

                if (currentPeak > prePeakFreq)
                {
                    if (currentPeakStrength.ReceivedCarrierLevel > 0)
                    {
                        //HACK this is inelegent
                        tempPeakDictionary.Add(new MicrowaveTuning(_prototype), new MicrowaveLinkQuality(currentPeakStrength));
                    }
                    results.Add(prePeakFreq);
                    results.Add(intEnd);
                    Debug.WriteLine("Interval Added: " + prePeakFreq + " to: " + intEnd);
                }
            }//End Intervals
            //Don't update the PeakDictionary if canellation is pending because we could have completed no
            //intervals and the old dictionary may still be better
            if (!bgw.CancellationPending)
            {
                PeakDictionary = tempPeakDictionary;
            }
            return(results);
        }//End Fine Scan
Ejemplo n.º 9
0
        /// <summary>
        /// Scans from last start to last end using <see cref="RoughInterval"/>,
        /// putting rough results into PeakDictionary.
        /// </summary>
        /// <returns>List of start,end intervals of possible peaks.</returns>
        public List <UInt64> RoughScan()
        {
            List <UInt64> results = new List <UInt64>();

            PeakDictionary = new Dictionary <MicrowaveTuning, MicrowaveLinkQuality>();
            if (bgw.CancellationPending)
            {
                return(results);
            }

            _prototype.Frequency = _startFreq;
            rx.SetTuning(_prototype);

            UInt64 prePeakStart = _startFreq;//Set on strength below
            UInt64 currentPeak  = 0;
            MicrowaveLinkQuality currentPeakStrength = new MicrowaveLinkQuality(0);

            for (UInt64 currentFreq = _startFreq;
                 (currentFreq < _endFreq + RoughInterval) && !bgw.CancellationPending;
                 currentFreq += RoughInterval)
            {
                if (currentFreq > _endFreq)
                {
                    currentFreq = _endFreq;
                }
                _prototype.Frequency = currentFreq;
                try
                {
                    rx.SetTuning(_prototype);
                }
                catch
                {
                    continue;
                }

                MicrowaveLinkQuality strength = rx.GetLinkQuality();
                Debug.WriteLine("Freq Changed: " + currentFreq + "\r\nStrength: " + strength);

                if (strength.ReceivedCarrierLevel > _minStrength)
                {
                    if (strength.ReceivedCarrierLevel > currentPeakStrength.ReceivedCarrierLevel) //Save as highest peak so far
                    {
                        if (currentPeak > prePeakStart)                                           //update to more accurate start of peak
                        {
                            prePeakStart = currentPeak;
                        }

                        currentPeak         = currentFreq;
                        currentPeakStrength = strength;
                    }
                    else if (strength.ReceivedCarrierLevel == currentPeakStrength.ReceivedCarrierLevel)
                    {
                        //Let the interval roll on
                    }
                    else//Above minimum, but lower than last peak //strength < currentPeakStrength
                    {
                        PeakDictionary.Add(new MicrowaveTuning(_prototype), strength);
                        results.Add(prePeakStart);
                        results.Add(currentFreq);
                        Debug.WriteLine("Interval Added: " + prePeakStart + " to: " + currentFreq);

                        //Reset prePeak to catch higher peaks within same set
                        currentPeakStrength = strength;
                        prePeakStart        = currentFreq;
                    }
                }
                else//Don't track peaks here, but make sure to start or end them if they are here
                {
                    //If tracking peak, save it
                    if (currentPeak > prePeakStart)
                    {
                        if (currentPeakStrength.ReceivedCarrierLevel > 0)
                        {
                            PeakDictionary.Add(new MicrowaveTuning(_prototype), new MicrowaveLinkQuality(currentPeakStrength));
                        }
                        results.Add(prePeakStart);
                        results.Add(currentFreq);
                        Debug.WriteLine("Interval Added: " + prePeakStart + " to: " + currentFreq);
                    }
                    //Reset prePeak to catch any peaks
                    currentPeakStrength.ReceivedCarrierLevel = 0;
                    prePeakStart = currentFreq;
                }
            }
            //Complete interval if still tracking peak
            if (currentPeak > prePeakStart)
            {
                if (currentPeakStrength.ReceivedCarrierLevel > 0)
                {
                    PeakDictionary.Add(new MicrowaveTuning(_prototype), new MicrowaveLinkQuality(currentPeakStrength));
                }
                results.Add(prePeakStart);
                results.Add(_endFreq);
                Debug.WriteLine("Interval Added: " + prePeakStart + " to: " + _endFreq);
            }

            return(results);
        }
Ejemplo n.º 10
0
 public void LinkQualityChanged(MicrowaveLinkQuality linkQuality)
 {
     Debug.WriteLine("  MicrowaveControl2Callback.LinkQualityChanged");
     parent.LinkQuality = linkQuality;
 }
Ejemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tcpAddress"></param>
        /// <param name="port"></param>
        /// <param name="useTCP"></param>
        /// <param name="comport"></param>
        /// <param name="baud">9600</param>
        public TestReciever(string tcpAddress, int port, bool useTCP, string comport, int baud)
            : base(tcpAddress, port, useTCP, comport, baud)
        {
            ReceiveTimeout = 10000;

            MicrowaveCapabilities c = new MicrowaveCapabilities();

            c.FrequencyResolution = 250000;
            c.MinimumFrequency    = 4400000000;
            c.MaximumFrequency    = 5000000000;

            c.ReceivedCarrierLevelMinimum = -100;
            c.ReceivedCarrierLevelMaximum = 0;
            c.SignalToNoiseRatioMaximum   = 40;

            c.SupportedTransports = new List <RFVideoStandard>();
            c.SupportedTransports.Add(RFVideoStandard.DVB_T);

            c.SupportedModulations = new List <RFModulationType>();
            c.SupportedModulations.Add(RFModulationType.QPSK);
            c.SupportedModulations.Add(RFModulationType.QAM16);
            c.SupportedModulations.Add(RFModulationType.QAM32);
            c.SupportedModulations.Add(RFModulationType.QAM64);
            c.SupportedModulations.Add(RFModulationType.Auto);

            c.SupportedGuardIntervals = new List <Interval>();
            c.SupportedGuardIntervals.Add(Interval._1_32);
            c.SupportedGuardIntervals.Add(Interval._1_16);
            c.SupportedGuardIntervals.Add(Interval._1_8);
            c.SupportedGuardIntervals.Add(Interval._1_4);
            c.SupportedGuardIntervals.Add(Interval._1_3);
            c.SupportedGuardIntervals.Add(Interval.Auto);

            c.SupportedBandwidth = new List <ulong>();
            c.SupportedBandwidth.Add(6000000);  // 6MHz
            c.SupportedBandwidth.Add(7000000);  // 7MHz
            c.SupportedBandwidth.Add(8000000);  // 8MHz
            c.SupportedBandwidth.Add(0);        // auto

            c.SupportedForwardErrorCorrection = new List <Interval>();
            c.SupportedForwardErrorCorrection.Add(Interval.Auto);
            c.SupportedForwardErrorCorrection.Add(Interval.Auto);   //documentation says index1 is "RS only" not clear what that means
            c.SupportedForwardErrorCorrection.Add(Interval._1_2);
            c.SupportedForwardErrorCorrection.Add(Interval._2_3);
            c.SupportedForwardErrorCorrection.Add(Interval._3_4);
            c.SupportedForwardErrorCorrection.Add(Interval._5_6);
            c.SupportedForwardErrorCorrection.Add(Interval._7_8);

            c.SupportedEncryption = new EncryptionCapabilities();
            c.SupportedEncryption.SupportedTypesAndKeyLengths = new Dictionary <EncryptionType, List <int> >();
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.None, null);
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.AES_Legacy, new int[] { 128, 256 }.ToList());
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.AES_Bcrypt, new int[] { 128, 256 }.ToList());
            //the BISS key lengths are derived from http://tech.ebu.ch/docs/tech/tech3292.pdf spec
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.BISS_1, new int[] { 48 }.ToList());
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.BISS_E, new int[] { 64 }.ToList());
            c.SupportedEncryption.SupportedTypesAndKeyLengths.Add(EncryptionType.DES, new int[] { 56 }.ToList());

            c.AutoTuning = new MicrowaveTuning();
            c.AutoTuning.ChannelBandwidth       = 0;
            c.AutoTuning.Encryption             = null;
            c.AutoTuning.ForwardErrorCorrection = Interval.Auto;
            c.AutoTuning.Frequency              = 0;
            c.AutoTuning.GuardInterval          = Interval.Auto;
            c.AutoTuning.Interleaver            = false;
            c.AutoTuning.Modulation             = RFModulationType.Auto;
            c.AutoTuning.PacketDiversityControl = false;
            c.AutoTuning.SpectralInversion      = false;
            c.AutoTuning.TransportMode          = RFVideoStandard.DVB_T;

            c.SupportedTuningParameters = (int)(MicrowaveTuning.Parameters.Frequency |
                                                MicrowaveTuning.Parameters.ChannelBandwidth |
                                                MicrowaveTuning.Parameters.ForwardErrorCorrection |
                                                MicrowaveTuning.Parameters.GuardInterval |
                                                MicrowaveTuning.Parameters.Modulation |
                                                MicrowaveTuning.Parameters.TransportMode |
                                                MicrowaveTuning.Parameters.Encryption |
                                                MicrowaveTuning.Parameters.SpectralInversion);
            c.AutoTuningRequirements = (int)MicrowaveTuning.Parameters.Frequency;

            c.SupportedLinkQualityParameters = (int)(MicrowaveLinkQuality.Parameters.BitErrorRatioPost |
                                                     MicrowaveLinkQuality.Parameters.BitErrorRatioPre |
                                                     MicrowaveLinkQuality.Parameters.DecoderLocked |
                                                     MicrowaveLinkQuality.Parameters.DemodulatorLocked |
                                                     MicrowaveLinkQuality.Parameters.FECLocked |
                                                     MicrowaveLinkQuality.Parameters.ReceivedCarrierLevel |
                                                     MicrowaveLinkQuality.Parameters.SignalToNoiseRatio |
                                                     MicrowaveLinkQuality.Parameters.TransportStreamLocked |
                                                     MicrowaveLinkQuality.Parameters.TunerLocked);

            _capabilities = c;

            MicrowaveTuning t = new MicrowaveTuning();

            t.ChannelBandwidth       = c.SupportedBandwidth[0];
            t.Encryption             = new EncryptionInfo();
            t.Encryption.Type        = EncryptionType.None;
            t.ForwardErrorCorrection = c.SupportedForwardErrorCorrection[0];
            t.Frequency              = c.MinimumFrequency;
            t.GuardInterval          = c.SupportedGuardIntervals[0];
            t.Interleaver            = false;
            t.Modulation             = c.SupportedModulations[0];
            t.PacketDiversityControl = false;
            t.SpectralInversion      = false;
            t.TransportMode          = c.SupportedTransports[0];
            t.ValidParameterData     = (int)MicrowaveTuning.Parameters.ALL;

            _tuning = t;

            MicrowaveLinkQuality lq = new MicrowaveLinkQuality();

            lq.BitErrorRatioPost     = 0;
            lq.BitErrorRatioPre      = 0.01;
            lq.DecoderLocked         = true;
            lq.DemodulatorLocked     = true;
            lq.FECLocked             = true;
            lq.ReceivedCarrierLevel  = -47;
            lq.SignalToNoiseRatio    = 25;
            lq.TransportStreamLocked = true;
            lq.TunerLocked           = true;
            lq.ValidParameterData    = (int)MicrowaveLinkQuality.Parameters.ALL;

            _linkQuality = lq;
        }