private void PowerDetection() { if (!_controlInterface.IsPlaying) { return; } _controlInterface.GetSpectrumSnapshot(_fft_buffer); _smaTunedFrequecy.Add(GetPowerTunedFreq()); _smaTunedBandwidth.Add(GetPowerTunedBandwith()); _smaTunedPeakPowerBandwidth.Add(GetPeakPowerTunedBandwith()); if (_mode == ScannerCompareMode.PeakPowerFrequency) { _scannerCompareRxLevel = _smaTunedFrequecy.IsValid ? _smaTunedFrequecy.Average : _SIMPLE_AVERAGE_MIN; } else if (_mode == ScannerCompareMode.AvgPowerBandwidth) { _scannerCompareRxLevel = _smaTunedBandwidth.IsValid ? _smaTunedBandwidth.Average : _SIMPLE_AVERAGE_MIN; } else if (_mode == ScannerCompareMode.PeakPowerBandwidth) { _scannerCompareRxLevel = _smaTunedBandwidth.IsValid ? _smaTunedPeakPowerBandwidth.Average : _SIMPLE_AVERAGE_MIN; } }
void MeasureTimer_Tick(object sender, EventArgs e) { if (!_controlInterface.IsPlaying) { if (_smaTunedFrequecy.IsValid) { _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); } return; } _controlInterface.GetSpectrumSnapshot(_fft_buffer, POWERLEVEL_MIN, 0); _smaTunedFrequecy.Add(GetPowerTunedFreq()); _smaTunedBandwidth.Add(GetPowerTunedBandwith()); _smaTunedPeakPowerBandwidth.Add(GetPeakPowerTunedBandwith()); }
void GetPowerThreadFunc(object parameter) { while (true) { if (!_controlInterface.IsPlaying) { if (_smaTunedFrequecy.IsValid) { _smaTunedFrequecy = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); _smaTunedBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); _smaTunedPeakPowerBandwidth = new Simova(_SIMPLE_AVERAGE_SAMPLE_CNT, _SIMPLE_AVERAGE_MIN); } return; } _controlInterface.GetSpectrumSnapshot(_fft_buffer, POWERLEVEL_MIN, 0); _smaTunedFrequecy.Add(MyLib.GetPowerTunedFreq()); _smaTunedBandwidth.Add(MyLib.GetPowerTunedBandwith()); _smaTunedPeakPowerBandwidth.Add(MyLib.GetPeakPowerTunedBandwith()); Thread.Sleep(_MEASURE_TIMER_INTERVALL); } }