public void Stop() { _tuneTimer.Stop(); _client.StopStreaming(); _client.Disconnect(); _client = null; if (_udpSocket != null) { _udpSocket.Close(); _udpSocket = null; } _udpThreadRunning = false; if (_udpThread != null) { _udpThread.Join(); _udpThread = null; } _workerThreadRunning = false; if (_workerThread != null) { _bufferEvt.Set(); _workerThread.Join(); _workerThread = null; } if (_sampleBuffer != null) { _sampleBuffer.Dispose(); _sampleBufferPtr = null; _workingSamplePtr = null; } }
public void Start(SDRSharp.Radio.SamplesAvailableDelegate callback) { _callback = callback; _hostName = _gui.Host; _port = _gui.Port; _is16Bit = _gui.Use16Bit; _lostPacketsCount = 0; _circularBufferHead = 0; _circularBufferTail = 0; _sampleCount = 0; _sampleBuffer = UnsafeBuffer.Create(256 * 2, sizeof(Complex)); _sampleBufferPtr = (Complex *)_sampleBuffer; _workingSamplePtr = _sampleBufferPtr; _client = new SdrIpClient(); _client.Connect(_hostName, _port); _client.Samplerate = _sampleRate; _client.Frequency = _frequency; _client.Use16Bit = _is16Bit; _udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); _udpSocket.ReceiveBufferSize = 65535; var remoteIpEndPoint = new IPEndPoint(IPAddress.Any, _port); _udpSocket.Bind(remoteIpEndPoint); _udpThread = new Thread(UdpReceiverThread); _udpThread.Priority = ThreadPriority.Highest; _udpThreadRunning = true; _udpThread.Start(); _workerThread = new Thread(WorkerThread); _workerThreadRunning = true; _workerThread.Start(); _client.StartStreaming(); _tuneTimer.Start(); Utils.SaveSetting("SDRIPHost", _hostName); Utils.SaveSetting("SDRIPPort", _port); Utils.SaveSetting("SDRIPRateIndex", _gui.SamepleRateIndex); Utils.SaveSetting("SDRIPFormatIndex", _gui.SampleFormatIndex); }
public unsafe void Stop() { this._tuneTimer.Stop(); this._client.StopStreaming(); this._client.Disconnect(); this._client = (SdrIpClient) 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; }
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 SdrIpClient(); 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("SDRIPHost", this._hostName); Utils.SaveSetting("SDRIPPort", (object) this._port); Utils.SaveSetting("SDRIPRateIndex", (object) this._gui.SamepleRateIndex); Utils.SaveSetting("SDRIPFormatIndex", (object) this._gui.SampleFormatIndex); }
public void Start(SDRSharp.Radio.SamplesAvailableDelegate callback) { _callback = callback; _hostName = _gui.Host; _port = _gui.Port; _is16Bit = _gui.Use16Bit; _lostPacketsCount = 0; _circularBufferHead = 0; _circularBufferTail = 0; _sampleCount = 0; _sampleBuffer = UnsafeBuffer.Create(256 * 2, sizeof(Complex)); _sampleBufferPtr = (Complex*)_sampleBuffer; _workingSamplePtr = _sampleBufferPtr; _client = new SdrIpClient(); _client.Connect(_hostName, _port); _client.Samplerate = _sampleRate; _client.Frequency = _frequency; _client.Use16Bit = _is16Bit; _udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); _udpSocket.ReceiveBufferSize = 65535; var remoteIpEndPoint = new IPEndPoint(IPAddress.Any, _port); _udpSocket.Bind(remoteIpEndPoint); _udpThread = new Thread(UdpReceiverThread); _udpThread.Priority = ThreadPriority.Highest; _udpThreadRunning = true; _udpThread.Start(); _workerThread = new Thread(WorkerThread); _workerThreadRunning = true; _workerThread.Start(); _client.StartStreaming(); _tuneTimer.Start(); Utils.SaveSetting("SDRIPHost", _hostName); Utils.SaveSetting("SDRIPPort", _port); Utils.SaveSetting("SDRIPRateIndex", _gui.SamepleRateIndex); Utils.SaveSetting("SDRIPFormatIndex", _gui.SampleFormatIndex); }