Ejemplo n.º 1
0
 private void StopDecoding()
 {
     if (this._device != null)
       {
     this._device.Stop();
     this._device.Dispose();
     this._device = (AirSpyDevice) null;
       }
       foreach (IFrameSink frameSink in this._frameSinks)
     frameSink.Stop();
       this._frameSinks.Clear();
       this._avgFps = 0.0f;
       this._frameCount = 0;
       this._gotSamples = false;
       this._isDecoding = false;
       this._decoder = (AdsbBitDecoder) null;
       this.fpsTimer.Enabled = false;
       this.fpsLabel.Text = "0";
       this.trackedCountLabel.Text = "0";
       this.UpdateDecodingState();
 }
Ejemplo n.º 2
0
 private unsafe void StartDecoding()
 {
     try
       {
     this._device = new AirSpyDevice();
     this._device.LnaGain = (byte) this.lnaTrackBar.Value;
     this._device.RfAgc = this.rfAgcCheckBox.Checked;
     this._device.BiasTee = this.biasTeeCheckBox.Checked;
     this._device.SamplesAvailable += new SamplesAvailableDelegate(this.Airspy_SamplesAvailable);
     byte samplesPerPulse = (byte) this._device.SamplesPerPulse;
     this._decoder = new AdsbBitDecoder(this._device.SamplesPerPulse);
     this._decoder.Timeout = (int) this.timeoutNumericUpDown.Value;
     this._decoder.FrameReceived += (FrameReceivedDelegate) ((frame, length, timestamp) =>
     {
       Interlocked.Increment(ref this._frameCount);
       foreach (IFrameSink frameSink in this._frameSinks)
     frameSink.FrameReady(frame, length, timestamp, samplesPerPulse);
     });
     if (this.enableHubClientCheckBox.Checked)
     {
       AdsbHubClient adsbHubClient = new AdsbHubClient();
       adsbHubClient.Start(this.hubHostnameTextBox.Text, (int) this.hubClientPortNumericUpDown.Value);
       this._frameSinks.Add((IFrameSink) adsbHubClient);
     }
     if (this.enableLocalServerCheckBox.Checked)
     {
       SimpleTcpServer simpleTcpServer = new SimpleTcpServer();
       simpleTcpServer.Start("0.0.0.0", (int) this.localServerPortNumericUpDown.Value);
       this._frameSinks.Add((IFrameSink) simpleTcpServer);
     }
     this._device.Start();
     this._gotSamples = true;
     this._isDecoding = true;
     this.fpsTimer.Enabled = true;
     this.UpdateDecodingState();
       }
       catch (Exception ex)
       {
     this.StopDecoding();
     int num = (int) MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
       }
 }