Ejemplo n.º 1
0
 public unsafe void Stop()
 {
     this._tuneTimer.Stop();
       this._client.StopStreaming();
       this._client.Disconnect();
       this._client = (AfedriSdrNetClient) null;
       if (this._udpSocket != null)
       {
     this._udpSocket.Close();
     this._udpSocket = (Socket) null;
       }
       this._udpThreadRunning = false;
       if (this._udpThread != null)
       {
     this._udpThread.Join();
     this._udpThread = (Thread) null;
       }
       this._workerThreadRunning = false;
       if (this._workerThread != null)
       {
     this._bufferEvt.Set();
     this._workerThread.Join();
     this._workerThread = (Thread) null;
       }
       if (this._sampleBuffer == null)
     return;
       this._sampleBuffer.Dispose();
       this._sampleBufferPtr = (Complex*) null;
       this._workingSamplePtr = (Complex*) null;
 }
Ejemplo n.º 2
0
 public unsafe void Start(SamplesAvailableDelegate callback)
 {
     this._callback = callback;
       this._hostName = this._gui.Host;
       this._port = this._gui.Port;
       this._is16Bit = this._gui.Use16Bit;
       this._lostPacketsCount = 0L;
       this._circularBufferHead = 0;
       this._circularBufferTail = 0;
       this._sampleCount = 0;
       this._sampleBuffer = UnsafeBuffer.Create(512, sizeof (Complex));
       this._sampleBufferPtr = (Complex*) (void*) this._sampleBuffer;
       this._workingSamplePtr = this._sampleBufferPtr;
       this._client = new AfedriSdrNetClient();
       this._client.Connect(this._hostName, this._port);
       this._client.Samplerate = this._sampleRate;
       this._client.Frequency = this._frequency;
       this._client.Use16Bit = this._is16Bit;
       this._udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
       this._udpSocket.ReceiveBufferSize = (int) ushort.MaxValue;
       this._udpSocket.Bind((EndPoint) new IPEndPoint(IPAddress.Any, this._port));
       this._udpThread = new Thread(new ThreadStart(this.UdpReceiverThread));
       this._udpThread.Priority = ThreadPriority.Highest;
       this._udpThreadRunning = true;
       this._udpThread.Start();
       this._workerThread = new Thread(new ThreadStart(this.WorkerThread));
       this._workerThreadRunning = true;
       this._workerThread.Start();
       this._client.StartStreaming();
       this._tuneTimer.Start();
       Utils.SaveSetting("AfedriSDRNetHost", this._hostName);
       Utils.SaveSetting("AfedriSDRNetPort", (object) this._port);
       Utils.SaveSetting("AfedriSDRNetRateIndex", (object) this._gui.SamepleRateIndex);
       Utils.SaveSetting("AfedriSDRNetFormatIndex", (object) this._gui.SampleFormatIndex);
 }