Example #1
0
 public override void SetTuning(MicrowaveTuning tuning)
 {
     Thread.Sleep(1000);
     tuning.ValidParameterData = this.Tuning.ValidParameterData;
     this.Tuning = tuning;
     DoTuningChangeEvent();
 }
Example #2
0
        /// <summary>
        /// Returns Operating Band of receiver.
        /// </summary>
        /// <returns>Current receiver band of operation.</returns>
        public virtual OperatingBand GetBand()
        {
            MicrowaveTuning t = this.GetTuning();

            if (t.Frequency > 1000000000)
            {
                if (t.Frequency < 2000000000)
                {
                    return(OperatingBand.L);
                }
                else if (t.Frequency < 4000000000)
                {
                    return(OperatingBand.S);
                }
                else if (t.Frequency < 8000000000)
                {
                    return(OperatingBand.C);
                }
                else if (t.Frequency < 12000000000)
                {
                    return(OperatingBand.X);
                }
            }

            return(OperatingBand.NotSet);
        }
Example #3
0
        public override void SetTuning(MicrowaveTuning tuning)
        {
            if (tuning.FrequencyMHz < 0 || tuning.FrequencyMHz > 9999)
            {
                throw new ArgumentOutOfRangeException("frequency", "Frequency must be between 0 and 9999.");
            }

            SetBandForFreq((int)tuning.FrequencyMHz);
            byte[] ToSend         = BuildCommand(SETFREQUENCY, tuning.FrequencyMHz.ToString());
            bool   successfulSend = false;

            byte[] result = BlockingSend(ToSend, out successfulSend, ValidInvalidTerms);
            if (successfulSend && result[0] == VALID)
            {
                bool temp = GetFrequency() == (int)tuning.FrequencyMHz;
                Connected = temp;
                if (temp)
                {
                    DoTuningChangeEvent();
                }
                else
                {
                    throw new Exception("SetFrequency sent successfully, but failed to set the frequency");
                }
            }
            Connected = false;
            throw new Exception("SetFrequency failed");
        }
Example #4
0
 /// <summary>
 /// Sets the frequency in MHz on the server
 /// </summary>
 public void SetTuning(MicrowaveTuning tuning)
 {
     if (ProxyReady)
     {
         Proxy.SetTuning(tuning);
     }
 }
Example #5
0
        public void UpdateTuning(MicrowaveTuning t)
        {
            this.ChangingSelf = true;


            if (t.IsSet(MicrowaveTuning.Parameters.Frequency))
            {
                this.Frequency          = t.Frequency;
                _lastTentativeFrequency = t.Frequency;
            }

            ico_EncryptionActive.Visible = false;
            if (t.IsSet(MicrowaveTuning.Parameters.Encryption))
            {
                if (t.Encryption != null)
                {
                    if ((t.Encryption.Type != EncryptionType.None) && (t.Encryption.Type != EncryptionType.Unknown))
                    {
                        ico_EncryptionActive.Visible = true;
                        tt.SetToolTip(ico_EncryptionActive, "Encryption Active (" + t.Encryption.Type.ToDisplayString() + " " + t.Encryption.KeyLength + " bit)");
                    }
                }
            }

            this.ChangingSelf = false;
        }
Example #6
0
        public override MicrowaveTuning GetTuning()
        {
            lock (_stateLock)
            {
                MicrowaveTuning t = new MicrowaveTuning();
                t.ValidParameterData = (int)(MicrowaveTuning.Parameters.Frequency |
                                             MicrowaveTuning.Parameters.TransportMode |
                                             MicrowaveTuning.Parameters.Modulation |
                                             MicrowaveTuning.Parameters.GuardInterval |
                                             MicrowaveTuning.Parameters.ForwardErrorCorrection |
                                             MicrowaveTuning.Parameters.SpectralInversion |
                                             MicrowaveTuning.Parameters.Encryption);

                t.Frequency = FreqDev2Prot(Read <double>(CommandCategory.Tuner, "tsf"));

                t.TransportMode = GetDemodMode(Read <int>(CommandCategory.Demodulator, "opr"));

                int temp = Read <int>(CommandCategory.Demodulator, "mod");
                t.Modulation = _capabilities.SupportedModulations[temp];

                temp            = Read <int>(CommandCategory.Demodulator, "gua");
                t.GuardInterval = _capabilities.SupportedGuardIntervals[temp];

                if (t.TransportMode == RFVideoStandard.DVB_T)
                {
                    temp = Read <int>(CommandCategory.Demodulator, "wid");
                    t.ChannelBandwidth    = _capabilities.SupportedBandwidth[temp];
                    t.ValidParameterData |= (int)MicrowaveTuning.Parameters.ChannelBandwidth;
                }
                else
                {
                    t.ChannelBandwidth = 0;
                }

                temp = Read <int>(CommandCategory.Demodulator, "fec");
                t.ForwardErrorCorrection = _capabilities.SupportedForwardErrorCorrection[temp];

                temp = Read <int>(CommandCategory.Demodulator, "pol");
                t.SpectralInversion = temp == 1; //TODO do we need 3 states?

                temp         = Read <int>(CommandCategory.VideoDecoder, "scr");
                t.Encryption = GetEncryptionType(temp);
                //the HDR1000 does not let us retreive the key (per BISS spec), so grab it from the last-known key
                // if the encryption types are the same.
                if (_lastSetTuning != null)
                {
                    if (_lastSetTuning.Encryption != null)
                    {
                        if ((t.Encryption.Type == _lastSetTuning.Encryption.Type) && (_lastSetTuning.Encryption.DecryptionKey != null))
                        {
                            t.Encryption.DecryptionKey = _lastSetTuning.Encryption.DecryptionKey;
                        }
                    }
                }

                return(t);
            }
        }
Example #7
0
        /// <summary>
        /// Does a sweep of the frequencies (inclusive) in a given range
        /// </summary>
        /// <param name="start">start frequency in Hz</param>
        /// <param name="end">end frequency in Hz</param>
        /// <param name="threshold">percentage of minimum signal strength</param>
        public void StartSweep(MicrowaveTuning settings, UInt64 start, UInt64 end, int threshold)
        {
            AppLogger.Message("MCS2.StartSweep");
            scanStart = start;
            scanEnd   = end;

            scanner.PeakScanAsync(settings, start, end, threshold);

            scanInProgress = true;
        }
Example #8
0
 private void FireTuningChanged(MicrowaveTuning tuning)
 {
     try
     {
         AppLogger.Message("  MicrowaveControlService2.FireTuningChanged");
         clientCallback.TuningChanged(tuning);
     }
     catch (Exception ex)
     {
         AppLogger.Dump(ex);
     }
 }
Example #9
0
 /// <summary>
 /// Tunes the microwave receiver to the specified frequency
 /// </summary>
 /// <param name="freq">the frequency, in MHz</param>
 public void SetTuning(MicrowaveTuning tuning)
 {
     try
     {
         AppLogger.Message("MCS2.SetTuning");
         microwaveReceiver.SetTuning(tuning);
     }
     catch (Exception ex)
     {
         AppLogger.Dump(ex);
         this.FireTuningChanged(null);
     }
 }
Example #10
0
        public override void SetTuning(MicrowaveTuning tuning)
        {
            _lastSetTuning = tuning;
            lock (_stateLock)
            {
                try
                {
                    Write(CommandCategory.Tuner, "tsf", FreqProt2Dev(tuning.Frequency));

                    Write(CommandCategory.Demodulator, "opr", GetDemodMode(tuning.TransportMode));

                    //HACK the Vislink device fails when we write anything to d-mod. Waiting For Firmware Fix
                    //Write(CommandCategory.Demodulator, "mod", IndexOf(_capabilities.SupportedModulations, tuning.Modulation));

                    //Write(CommandCategory.Demodulator, "gua", IndexOf(_capabilities.SupportedGuardIntervals, tuning.GuardInterval));

                    if (tuning.TransportMode == RFVideoStandard.DVB_T)
                    {
                        //Write(CommandCategory.Demodulator, "wid", IndexOf(_capabilities.SupportedBandwidth, tuning.ChannelBandwidth));
                    }

                    //Write(CommandCategory.Demodulator, "fec", IndexOf(_capabilities.SupportedForwardErrorCorrection, tuning.ForwardErrorCorrection));

                    Write(CommandCategory.Demodulator, "pol", (tuning.SpectralInversion ? 1 : 0)); //TODO support other than Auto?


                    int    type;
                    string key;
                    GetEncryptionType(tuning.Encryption, out type, out key);

                    Write(CommandCategory.VideoDecoder, "scr", type);
                    if (key != null)
                    {
                        Write(CommandCategory.VideoDecoder, "key", key);
                    }
                }
                finally
                {
                    Thread.Sleep(4000);   //give the MRX some chill time to transition to the new tuning
                    DoTuningChangeEvent();
                }
            }
        }
Example #11
0
        /// <summary>
        /// Does a scan asynchronously from start to end frequency. Number of passes
        /// for scan depends on <see cref="Passes"/>. If a frequency has a signal
        /// strength above <paramref name="MinStrength"/>, the highest frequency in the
        /// contiguous set of frequencies above MinStrength will be added to the dictionary.
        /// </summary>
        /// <param name="prototype">a prototype tuning that should be used when sweeping frequency</param>
        /// <param name="StartFreq">Frequency to start scanning at, inclusive, in Hz.</param>
        /// <param name="EndFreq">Frequency to stop scanning at, inclusive, in Hz.</param>
        /// <param name="MinStrength">Minimum signal strength required to register a peak.</param>
        public void PeakScanAsync(MicrowaveTuning prototype, UInt64 StartFreq, UInt64 EndFreq, int MinStrength)
        {
            if (bgw.IsBusy || inSearch)
            {
                bgw.CancelAsync();
            }
            //wait for cancellation
            while (bgw.IsBusy)
            {
                Thread.Sleep(100);
            }

            inSearch     = true;
            _prototype   = prototype;
            _startFreq   = StartFreq;
            _endFreq     = EndFreq;
            _minStrength = MinStrength;
            _peakDict    = new Dictionary <MicrowaveTuning, MicrowaveLinkQuality>();
            bgw.RunWorkerAsync();
        }
Example #12
0
        private void tuner_FrequencyChanged(object sender, EventArgs e)
        {
            try
            {
                if (client != null)
                {
                    MicrowaveTuning newTune = new MicrowaveTuning(client.Capabilities.AutoTuning);
                    newTune.Frequency = tuner.Frequency;

                    if (keyInput.SelectedEncryption != null)
                    {
                        newTune.Encryption = keyInput.SelectedEncryption;
                    }
                    client.SetTuning(newTune);
                }
            }
            catch (Exception ex)
            {
                FCMessageBox.Show("Error setting frequency!", @"There was an error while setting the receiver's frequency on the server.", this);
                ErrorLogger.DumpToDebug(ex);
            }
        }
Example #13
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;
        }
Example #14
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();
            }
        }
Example #15
0
 /// <summary>
 /// Tunes the receiver to the specified frequency, then verifies
 /// that the receiver thinks it is set to that frequency.
 /// </summary>
 /// <param name="freq">Receiver frequency in MHz</param>
 public abstract void SetTuning(MicrowaveTuning tuning);
Example #16
0
 public void TuningChanged(MicrowaveTuning tuning)
 {
     Debug.WriteLine("  MicrowaveControl2Callback.FrequencyChanged");
     parent.CurrentTuning = tuning;
 }
Example #17
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;
            }
        }
Example #18
0
 /// <summary>
 /// Creates a new instance, set to a specific frequency
 /// </summary>
 /// <param name="tuning">Microwave frequency, in MHz</param>
 public MicrowaveTuningPreset(MicrowaveTuning tuning)
 {
     this.Tuning = tuning;
     this.Name   = this.ToString();
 }