Exemple #1
0
        private unsafe static void RtlSdrSamplesAvailable(byte *buf, uint len, IntPtr ctx)
        {
            GCHandle gCHandle = GCHandle.FromIntPtr(ctx);

            if (gCHandle.IsAllocated)
            {
                RtlDevice rtlDevice = (RtlDevice)gCHandle.Target;
                int       num       = (int)len / 2;
                if (rtlDevice._iqBuffer == null || rtlDevice._iqBuffer.Length != num)
                {
                    rtlDevice._iqBuffer = UnsafeBuffer.Create(num, sizeof(Complex));
                    rtlDevice._iqPtr    = (Complex *)(void *)rtlDevice._iqBuffer;
                }
                Complex *ptr = rtlDevice._iqPtr;
                for (int i = 0; i < num; i++)
                {
                    Complex *intPtr  = ptr;
                    byte *   intPtr2 = buf;
                    buf          = intPtr2 + 1;
                    intPtr->Imag = (float)(*intPtr2 - 128) * 0.0078125f;
                    Complex *intPtr3 = ptr;
                    byte *   intPtr4 = buf;
                    buf           = intPtr4 + 1;
                    intPtr3->Real = (float)(*intPtr4 - 128) * 0.0078125f;
                    ptr++;
                }
                rtlDevice.ComplexSamplesAvailable(rtlDevice._iqPtr, rtlDevice._iqBuffer.Length);
            }
        }
Exemple #2
0
 public void SelectDevice(uint index)
 {
     Close();
     _rtlDevice = new RtlDevice(index);
     _rtlDevice.SamplesAvailable += rtlDevice_SamplesAvailable;
     _rtlDevice.Frequency = _frequency;
     _gui.ConfigureGUI();
     _gui.ConfigureDevice();
 }
Exemple #3
0
 public void SelectDevice(uint index)
 {
     this.Close();
     this._rtlDevice = new RtlDevice(index);
     this._rtlDevice.SamplesAvailable += this.rtlDevice_SamplesAvailable;
     this._rtlDevice.Frequency         = this._frequency;
     this._gui.ConfigureGUI();
     this._gui.ConfigureDevice();
 }
Exemple #4
0
 public void SelectDevice(uint index)
 {
     Close();
     _rtlDevice = new RtlDevice(index);
     _rtlDevice.SamplesAvailable += rtlDevice_SamplesAvailable;
     _rtlDevice.Frequency         = _frequency;
     _gui.ConfigureGUI();
     _gui.ConfigureDevice();
 }
Exemple #5
0
 public void Close()
 {
     if (_rtlDevice != null)
     {
         _rtlDevice.Stop();
         _rtlDevice.SamplesAvailable -= rtlDevice_SamplesAvailable;
         _rtlDevice.Dispose();
         _rtlDevice = null;
     }
 }
Exemple #6
0
 public void Close()
 {
     if (this._rtlDevice != null)
     {
         this._rtlDevice.Stop();
         this._rtlDevice.SamplesAvailable -= this.rtlDevice_SamplesAvailable;
         this._rtlDevice.Dispose();
         this._rtlDevice = null;
     }
 }
Exemple #7
0
 public void Close()
 {
     if (_rtlDevice != null)
     {
         _rtlDevice.Stop();
         _rtlDevice.SamplesAvailable -= rtlDevice_SamplesAvailable;
         _rtlDevice.Dispose();
         _rtlDevice = null;
     }
 }
Exemple #8
0
 private void CloseDevice()
 {
     if (this._rtlDevice == null)
     return;
       this._rtlDevice.Stop();
       this._rtlDevice.SamplesAvailable -= new SamplesAvailableDelegate(this.rtlDevice_SamplesAvailable);
       this._rtlDevice.SampleRateChanged -= new EventHandler(this.rtlDevice_SampleRateChanged);
       this._rtlDevice.Dispose();
       this._rtlDevice = (RtlDevice) null;
 }
Exemple #9
0
 public void SelectDevice(uint index)
 {
     this.CloseDevice();
       this._rtlDevice = new RtlDevice(index);
       this._rtlDevice.Frequency = this._frequency;
       this._gui.Device = this._rtlDevice;
       this._rtlDevice.SamplesAvailable += new SamplesAvailableDelegate(this.rtlDevice_SamplesAvailable);
       this._rtlDevice.SampleRateChanged += new EventHandler(this.rtlDevice_SampleRateChanged);
 }