├── SDRSharp.LimeSDR
├── App.config
├── LimeSDRIO.cs
├── LimeSDRControllerDialog.cs
├── SDRSharp.LimeSDR.csproj
├── LimeSDRControllerDialog.resx
├── NativeMethods.cs
├── LimeSDRDevice.cs
└── LimeSDRControllerDialog.Designer.cs
├── README.md
└── SDRSharp.LimeSDR.sln
/SDRSharp.LimeSDR/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # sdrsharp-limesdr
2 |
3 | LimeSDR for SDR# Plugin
4 |
5 | ## Installation
6 |
7 | 1. Copy all DLL files to SDR# installation directory
8 | 2. Add the following line in the frontendPlugins sections of FrontEnds.xml file:
9 |
10 | <add key="LimeSDR" value="SDRSharp.LimeSDR.LimeSDRIO,SDRSharp.LimeSDR" />
11 |
12 |
13 |
14 | ## Download
15 |
16 | [https://www.jiangwei.org/download/LimeSDR_SDRSharp_Plugin.zip](https://www.jiangwei.org/download/LimeSDR_SDRSharp_Plugin.zip)
17 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDRSharp.LimeSDR", "SDRSharp.LimeSDR\SDRSharp.LimeSDR.csproj", "{6B7747F2-331A-4865-B006-BA6419DB9E98}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6B7747F2-331A-4865-B006-BA6419DB9E98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6B7747F2-331A-4865-B006-BA6419DB9E98}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6B7747F2-331A-4865-B006-BA6419DB9E98}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6B7747F2-331A-4865-B006-BA6419DB9E98}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/LimeSDRIO.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using SDRSharp.Radio;
7 | using System.Windows.Forms;
8 |
9 | namespace SDRSharp.LimeSDR
10 | {
11 | public class LimeSDRIO : IFrontendController, IIQStreamController, IDisposable, IFloatingConfigDialogProvider, ITunableSource, ISampleRateChangeSource
12 | {
13 | private long _frequency;
14 | private LimeSDRDevice _LimeDev = null;
15 | private readonly LimeSDRControllerDialog _gui;
16 | private SDRSharp.Radio.SamplesAvailableDelegate _callback;
17 | public event EventHandler SampleRateChanged;
18 |
19 | public LimeSDRIO()
20 | {
21 | _gui = new LimeSDRControllerDialog(this);
22 | }
23 |
24 | ~LimeSDRIO()
25 | {
26 | Dispose();
27 | }
28 |
29 | public LimeSDRDevice Device
30 | {
31 | get { return _LimeDev; }
32 | }
33 |
34 | public void Dispose()
35 | {
36 | Close();
37 | if (_gui != null)
38 | {
39 | _gui.Close();
40 | _gui.Dispose();
41 | }
42 | GC.SuppressFinalize(this);
43 | }
44 |
45 | private unsafe void LimeDevice_SamplesAvailable(object sender, SamplesAvailableEventArgs e)
46 | {
47 | _callback(this, e.Buffer, e.Length);
48 |
49 | }
50 |
51 | public void Close()
52 | {
53 |
54 | if (_LimeDev == null)
55 | return;
56 |
57 | _LimeDev.SamplesAvailable -= LimeDevice_SamplesAvailable;
58 | _LimeDev.SampleRateChanged -= LimeSDRDevice_SampleRateChanged;
59 | _LimeDev.Dispose();
60 | _LimeDev = null;
61 |
62 | }
63 |
64 | private void LimeSDRDevice_SampleRateChanged(object sender, EventArgs e)
65 | {
66 | if (SampleRateChanged != null)
67 | SampleRateChanged(this, EventArgs.Empty);
68 | }
69 |
70 | public void Open()
71 | {
72 |
73 | _LimeDev = new LimeSDRDevice();
74 | _LimeDev.SamplesAvailable += LimeDevice_SamplesAvailable;
75 | _LimeDev.SampleRateChanged += LimeSDRDevice_SampleRateChanged;
76 | }
77 |
78 |
79 | public void Start(Radio.SamplesAvailableDelegate callback)
80 | {
81 |
82 | if (this._LimeDev == null)
83 | throw new ApplicationException("No device selected");
84 |
85 |
86 | _callback = callback;
87 |
88 | try
89 | {
90 | _LimeDev.Start();
91 | }
92 | catch
93 | {
94 | this.Open();
95 | _LimeDev.Start();
96 | }
97 |
98 | }
99 |
100 |
101 |
102 | public void Stop()
103 | {
104 |
105 | if (_LimeDev != null)
106 | {
107 | _LimeDev.Stop();
108 | }
109 |
110 | }
111 |
112 | public bool IsSoundCardBased
113 | {
114 | get
115 | {
116 | return false;
117 | }
118 | }
119 |
120 | public string SoundCardHint
121 | {
122 | get
123 | {
124 | return string.Empty;
125 | }
126 | }
127 |
128 | public void ShowSettingGUI(IWin32Window parent)
129 | {
130 | if (this._gui.IsDisposed)
131 | return;
132 | _gui.Show();
133 | _gui.Activate();
134 |
135 | }
136 |
137 | public void HideSettingGUI()
138 | {
139 | if (_gui.IsDisposed)
140 | return;
141 | _gui.Hide();
142 | }
143 |
144 | public long Frequency
145 | {
146 | get
147 | {
148 | if (this._LimeDev != null)
149 | {
150 | _frequency = this._LimeDev.Frequency;
151 | }
152 | return _frequency;
153 | }
154 | set
155 | {
156 | if (this._LimeDev != null)
157 | {
158 | this._LimeDev.Frequency = value;
159 | this._frequency = value;
160 | }
161 | _frequency = value;
162 |
163 | }
164 | }
165 |
166 | public double Samplerate
167 | {
168 |
169 | get
170 | {
171 | if (_LimeDev != null)
172 | return _LimeDev.SampleRate;
173 | else
174 | return 0.0;
175 | }
176 |
177 | }
178 |
179 | public bool CanTune
180 | {
181 | get
182 | { return true; }
183 | }
184 |
185 | public long MaximumTunableFrequency
186 | {
187 |
188 | get { return 3800000000L; }
189 | }
190 |
191 | public long MinimumTunableFrequency
192 | {
193 |
194 | get
195 | { return 1000; }
196 | }
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/LimeSDRControllerDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 |
12 | namespace SDRSharp.LimeSDR
13 | {
14 | public partial class LimeSDRControllerDialog : Form
15 | {
16 | private readonly LimeSDRIO _owner;
17 | private bool _initialized;
18 |
19 | public LimeSDRControllerDialog(LimeSDRIO owner)
20 | {
21 | InitializeComponent();
22 | _owner = owner;
23 | InitSampleRates();
24 |
25 | _initialized = true;
26 |
27 | }
28 |
29 | private bool Initialized
30 | {
31 | get
32 | {
33 | return _initialized && _owner.Device != null;
34 | }
35 | }
36 |
37 | private void InitSampleRates()
38 | {
39 |
40 | for (int i = 1; i < 61; i++)
41 | samplerateComboBox.Items.Add(String.Format("{0} MSPS", i));
42 | }
43 |
44 | private void samplerateComboBox_SelectedIndexChanged(object sender, EventArgs e)
45 | {
46 | if (!Initialized)
47 | {
48 | return;
49 | }
50 |
51 | try
52 | {
53 | _owner.Device.SampleRate = (UInt32)((samplerateComboBox.SelectedIndex+1)* 1e6);
54 | }
55 | catch
56 | {
57 | _owner.Device.SampleRate = 2e6;
58 | }
59 | }
60 |
61 | private void close_Click(object sender, EventArgs e)
62 | {
63 | Hide();
64 | }
65 |
66 | private void LimeSDRControllerDialog_FormClosing(object sender, FormClosingEventArgs e)
67 | {
68 | e.Cancel = true;
69 | Hide();
70 | }
71 |
72 | private void LimeSDRControllerDialog_Activated(object sender, EventArgs e)
73 | {
74 | if (!_initialized)
75 | {
76 | return;
77 | }
78 |
79 | if (_owner.Device.IsStreaming)
80 | {
81 | samplerateComboBox.Enabled = false;
82 |
83 | rx0.Enabled = false;
84 | rx1.Enabled = false;
85 | ant_h.Enabled = false;
86 | ant_l.Enabled = false;
87 | ant_w.Enabled = false;
88 | }
89 | else
90 | {
91 | samplerateComboBox.Enabled = true;
92 |
93 | rx0.Enabled = true;
94 | rx1.Enabled = true;
95 | ant_h.Enabled = true;
96 | ant_l.Enabled = true;
97 | ant_w.Enabled = true;
98 | }
99 |
100 | samplerateComboBox.SelectedIndex = (Int32)(_owner.Device.SampleRate / 1e6 - 1);
101 |
102 | if (_owner.Device.Channel == 0)
103 | {
104 | rx0.Checked = true;
105 | }
106 | else {
107 | rx1.Checked = true;
108 | }
109 |
110 | if (_owner.Device.Antenna == 1)
111 | {
112 | ant_h.Checked = true;
113 | }
114 | else if (_owner.Device.Antenna == 2)
115 | {
116 | ant_l.Checked = true;
117 | }
118 | else {
119 | ant_w.Checked = true;
120 | }
121 |
122 |
123 | gainBar.Value = (int)_owner.Device.Gain;
124 | gainDB.Text = gainBar.Value + " dB";
125 |
126 | }
127 |
128 | private void gainBar_Scroll(object sender, EventArgs e)
129 | {
130 | if (!_initialized)
131 | {
132 | return;
133 | }
134 |
135 | _owner.Device.Gain = gainBar.Value;
136 | gainDB.Text = gainBar.Value + " dB";
137 |
138 | }
139 |
140 | private void rx0_CheckedChanged(object sender, EventArgs e)
141 | {
142 | if (!_initialized)
143 | {
144 | return;
145 | }
146 |
147 | _owner.Device.Channel = 0;
148 |
149 | }
150 |
151 | private void rx1_CheckedChanged(object sender, EventArgs e)
152 | {
153 | if (!_initialized)
154 | {
155 | return;
156 | }
157 |
158 | _owner.Device.Channel = 1;
159 |
160 | }
161 |
162 | private void ant_h_CheckedChanged(object sender, EventArgs e)
163 | {
164 | if (!_initialized)
165 | {
166 | return;
167 | }
168 |
169 | _owner.Device.Antenna = 1;
170 | }
171 |
172 | private void ant_l_CheckedChanged(object sender, EventArgs e)
173 | {
174 | if (!_initialized)
175 | {
176 | return;
177 | }
178 |
179 | _owner.Device.Antenna = 2;
180 | }
181 |
182 | private void ant_w_CheckedChanged(object sender, EventArgs e)
183 | {
184 | if (!_initialized)
185 | {
186 | return;
187 | }
188 |
189 | _owner.Device.Antenna = 3;
190 | }
191 | }
192 |
193 |
194 |
195 |
196 |
197 | }
198 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/SDRSharp.LimeSDR.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6B7747F2-331A-4865-B006-BA6419DB9E98}
8 | Library
9 | Properties
10 | SDRSharp.LimeSDR
11 | SDRSharp.LimeSDR
12 | v4.6
13 | 512
14 | true
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 |
33 | AnyCPU
34 | true
35 | full
36 | true
37 | bin\Debug\
38 | DEBUG;TRACE
39 | prompt
40 | 4
41 | true
42 |
43 |
44 | AnyCPU
45 | pdbonly
46 | true
47 | bin\Release\
48 | TRACE
49 | prompt
50 | 4
51 | true
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | False
62 | Microsoft .NET Framework 4.5.2 %28x86 和 x64%29
63 | true
64 |
65 |
66 | False
67 | .NET Framework 3.5 SP1
68 | false
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | False
77 | ..\..\..\..\..\Desktop\s\SDRSharp.Common.dll
78 |
79 |
80 | False
81 | ..\..\..\..\..\Desktop\s\SDRSharp.Radio.dll
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | Form
92 |
93 |
94 | LimeSDRControllerDialog.cs
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | {C21E9CE5-B317-463B-A1B1-B5E36EED59D0}
103 | 1
104 | 0
105 | 0
106 | tlbimp
107 | False
108 | True
109 |
110 |
111 |
112 |
113 | LimeSDRControllerDialog.cs
114 |
115 |
116 |
117 |
124 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/LimeSDRControllerDialog.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.InteropServices;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace SDRSharp.LimeSDR
9 | {
10 |
11 | [StructLayout(LayoutKind.Sequential)]
12 | public unsafe struct lms_range_t
13 | {
14 | public double min;
15 | public double max;
16 | public double step;
17 | }
18 |
19 | [StructLayout(LayoutKind.Sequential)]
20 | public struct LMS7Parameter
21 | {
22 | public UInt16 address;
23 | public byte msb;
24 | public byte lsb;
25 | public UInt16 defaultValue;
26 | public string name;
27 | public string tooltip;
28 | };
29 |
30 | public enum dataFmt
31 | {
32 | LMS_FMT_F32 = 0, /**<32-bit floating point*/
33 | LMS_FMT_I16 = 1, /**<16-bit integers*/
34 | LMS_FMT_I12 = 2 /**<12-bit integers stored in 16-bit variables*/
35 | }
36 |
37 | [StructLayout(LayoutKind.Sequential)]
38 | public unsafe struct lms_stream_t
39 | {
40 | public uint handle;
41 | public bool isTx;
42 | public UInt32 channel;
43 | public UInt32 fifoSize;
44 | public float throughputVsLatency;
45 | internal dataFmt dataFmt;
46 |
47 | }
48 |
49 |
50 | public enum lms_loopback_t
51 | {
52 | LMS_LOOPBACK_NONE /**Real = _samplesPtr[i * 2];
69 | ptrIq->Imag = _samplesPtr[i * 2 + 1];
70 | ptrIq++;
71 | }
72 |
73 | ComplexSamplesAvailable(_iqPtr, _iqBuffer.Length);
74 |
75 |
76 | }
77 | }
78 |
79 | public bool IsStreaming
80 | {
81 | get
82 | {
83 | return _isStreaming;
84 | }
85 | }
86 |
87 | public LimeSDRDevice()
88 | {
89 |
90 | if (NativeMethods.LMS_GetDeviceList(null) < 1)
91 | throw new ApplicationException("Cannot found LimeSDR device. Is the device locked somewhere?");
92 |
93 | _gcHandle = GCHandle.Alloc(this);
94 |
95 | }
96 |
97 | ~LimeSDRDevice()
98 | {
99 | Dispose();
100 | }
101 |
102 | private unsafe void ComplexSamplesAvailable(Complex* buffer, int length)
103 | {
104 | if (SamplesAvailable != null)
105 | {
106 | _eventArgs.Buffer = buffer;
107 | _eventArgs.Length = length;
108 | SamplesAvailable(this, _eventArgs);
109 | }
110 | }
111 |
112 | public void Stop()
113 | {
114 | if (!_isStreaming)
115 | return;
116 |
117 | _isStreaming = false;
118 | if (_sampleThread != null)
119 | {
120 |
121 | if (_sampleThread.ThreadState == ThreadState.Running)
122 | _sampleThread.Join();
123 | _sampleThread = null;
124 | }
125 |
126 | NativeMethods.LMS_StopStream(_stream);
127 |
128 | }
129 |
130 | public void Dispose()
131 | {
132 | this.Stop();
133 | if (_gcHandle.IsAllocated)
134 | {
135 | _gcHandle.Free();
136 | }
137 | GC.SuppressFinalize(this);
138 |
139 | NativeMethods.LMS_Close(_device);
140 | _device = IntPtr.Zero;
141 | }
142 |
143 | public unsafe void Start()
144 | {
145 | if (NativeMethods.LMS_Open(out _device, null, null) != 0)
146 | {
147 | throw new ApplicationException("Cannot open LimeSDR device. Is the device locked somewhere?");
148 | }
149 |
150 | NativeMethods.LMS_Init(_device);
151 |
152 | if (NativeMethods.LMS_EnableChannel(_device, LMS_CH_RX, _channel, true) != 0)
153 | {
154 | throw new ApplicationException(NativeMethods.limesdr_strerror());
155 | }
156 |
157 |
158 | if (NativeMethods.LMS_SetAntenna(_device, LMS_CH_RX, _channel, _ant) != 0)
159 | {
160 | throw new ApplicationException(NativeMethods.limesdr_strerror());
161 | }
162 |
163 | this.SampleRate = _sampleRate;
164 | this.Frequency = (long)_centerFrequency;
165 |
166 |
167 | if (NativeMethods.LMS_SetGaindB(_device, LMS_CH_RX, _channel, _gain) != 0)
168 | {
169 | throw new ApplicationException(NativeMethods.limesdr_strerror());
170 | }
171 |
172 |
173 | lms_stream_t streamId = new lms_stream_t();
174 | streamId.handle = 0;
175 | streamId.channel = _channel; //channel number
176 | streamId.fifoSize = 128 * 1024; //fifo size in samples
177 | streamId.throughputVsLatency = 1.0f; //optimize for max throughput
178 | streamId.isTx = false; //RX channel
179 | streamId.dataFmt = dataFmt.LMS_FMT_F32;
180 | _stream = Marshal.AllocHGlobal(Marshal.SizeOf(streamId));
181 |
182 | Marshal.StructureToPtr(streamId, _stream, false);
183 | if (NativeMethods.LMS_SetupStream(_device, _stream) != 0)
184 | {
185 | throw new ApplicationException(NativeMethods.limesdr_strerror());
186 | }
187 |
188 | if (NativeMethods.LMS_StartStream(_stream) != 0)
189 | {
190 | throw new ApplicationException(NativeMethods.limesdr_strerror());
191 | }
192 |
193 | _sampleThread = new Thread(ReceiveSamples_sync);
194 | _sampleThread.Name = "limesdr_samples_rx";
195 | _sampleThread.Priority = ThreadPriority.Highest;
196 | _isStreaming = true;
197 | _sampleThread.Start();
198 |
199 | }
200 |
201 |
202 | public long Frequency
203 | {
204 |
205 | get
206 | {
207 | if (_device != IntPtr.Zero)
208 | {
209 | if (NativeMethods.LMS_GetLOFrequency(_device, LMS_CH_RX, _channel, ref _centerFrequency) != 0)
210 | {
211 | throw new ApplicationException(NativeMethods.limesdr_strerror());
212 | }
213 | }
214 | return (long)_centerFrequency;
215 | }
216 | set
217 | {
218 | _centerFrequency = value;
219 |
220 | if (_device != IntPtr.Zero)
221 | {
222 |
223 | if (NativeMethods.LMS_SetLOFrequency(_device, LMS_CH_RX, _channel, _centerFrequency) != 0)
224 | {
225 |
226 | throw new ApplicationException(NativeMethods.limesdr_strerror());
227 | }
228 |
229 |
230 | if (_centerFrequency <= 30e6)
231 | {
232 | if (_isStreaming)
233 | {
234 | NativeMethods.LMS_StopStream(_stream);
235 | NativeMethods.LMS_StartStream(_stream);
236 | }
237 | }
238 |
239 |
240 | }
241 |
242 | }
243 |
244 | }
245 |
246 | public event EventHandler SampleRateChanged;
247 |
248 | public void OnSampleRateChanged()
249 | {
250 | if (SampleRateChanged != null)
251 | SampleRateChanged(this, EventArgs.Empty);
252 | }
253 |
254 | public uint Channel
255 | {
256 | get
257 | {
258 |
259 | return _channel;
260 | }
261 | set
262 | {
263 |
264 | _channel = value;
265 |
266 | }
267 |
268 | }
269 |
270 | public uint Antenna
271 | {
272 | get
273 | {
274 |
275 | return _ant;
276 | }
277 | set
278 | {
279 |
280 | _ant = value;
281 |
282 | }
283 |
284 | }
285 |
286 | public double SampleRate
287 | {
288 |
289 | get
290 | {
291 |
292 | return _sampleRate;
293 | }
294 |
295 |
296 | set
297 | {
298 | _sampleRate = value;
299 |
300 |
301 |
302 | if (_device != IntPtr.Zero)
303 | {
304 |
305 | if (NativeMethods.LMS_SetSampleRate(_device, _sampleRate, 0) != 0)
306 | {
307 | throw new ApplicationException(NativeMethods.limesdr_strerror());
308 | }
309 |
310 | if (_isStreaming)
311 | {
312 | NativeMethods.LMS_StopStream(_stream);
313 | NativeMethods.LMS_StartStream(_stream);
314 | }
315 |
316 | }
317 |
318 | OnSampleRateChanged();
319 |
320 | }
321 |
322 | }
323 |
324 | public double Gain
325 | {
326 |
327 | get
328 | {
329 |
330 | return _gain;
331 | }
332 |
333 | set
334 | {
335 | _gain = (uint)value;
336 | if (_device != IntPtr.Zero)
337 | {
338 | if (NativeMethods.LMS_SetGaindB(_device, LMS_CH_RX, _channel, _gain) != 0)
339 | {
340 | throw new ApplicationException(NativeMethods.limesdr_strerror());
341 | }
342 |
343 | }
344 | }
345 | }
346 |
347 | }
348 |
349 |
350 |
351 | public sealed class SamplesAvailableEventArgs : EventArgs
352 | {
353 | public int Length { get; set; }
354 | public unsafe Complex* Buffer { get; set; }
355 | }
356 |
357 | public delegate void SamplesAvailableDelegate(object sender, SamplesAvailableEventArgs e);
358 |
359 | }
360 |
--------------------------------------------------------------------------------
/SDRSharp.LimeSDR/LimeSDRControllerDialog.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SDRSharp.LimeSDR
2 | {
3 | public partial class LimeSDRControllerDialog
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.close = new System.Windows.Forms.Button();
32 | this.samplerateComboBox = new System.Windows.Forms.ComboBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.gainBar = new System.Windows.Forms.TrackBar();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.gainDB = new System.Windows.Forms.Label();
37 | this.rx0 = new System.Windows.Forms.RadioButton();
38 | this.rx1 = new System.Windows.Forms.RadioButton();
39 | this.ant_h = new System.Windows.Forms.RadioButton();
40 | this.ant_l = new System.Windows.Forms.RadioButton();
41 | this.ant_w = new System.Windows.Forms.RadioButton();
42 | this.groupBox1 = new System.Windows.Forms.GroupBox();
43 | this.groupBox2 = new System.Windows.Forms.GroupBox();
44 | ((System.ComponentModel.ISupportInitialize)(this.gainBar)).BeginInit();
45 | this.groupBox1.SuspendLayout();
46 | this.groupBox2.SuspendLayout();
47 | this.SuspendLayout();
48 | //
49 | // close
50 | //
51 | this.close.DialogResult = System.Windows.Forms.DialogResult.Cancel;
52 | this.close.Location = new System.Drawing.Point(143, 265);
53 | this.close.Name = "close";
54 | this.close.Size = new System.Drawing.Size(75, 23);
55 | this.close.TabIndex = 0;
56 | this.close.Text = "Close";
57 | this.close.UseVisualStyleBackColor = true;
58 | this.close.Click += new System.EventHandler(this.close_Click);
59 | //
60 | // samplerateComboBox
61 | //
62 | this.samplerateComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
63 | this.samplerateComboBox.FormattingEnabled = true;
64 | this.samplerateComboBox.Location = new System.Drawing.Point(19, 39);
65 | this.samplerateComboBox.Name = "samplerateComboBox";
66 | this.samplerateComboBox.Size = new System.Drawing.Size(199, 20);
67 | this.samplerateComboBox.TabIndex = 1;
68 | this.samplerateComboBox.SelectedIndexChanged += new System.EventHandler(this.samplerateComboBox_SelectedIndexChanged);
69 | //
70 | // label1
71 | //
72 | this.label1.AutoSize = true;
73 | this.label1.Location = new System.Drawing.Point(19, 9);
74 | this.label1.Name = "label1";
75 | this.label1.Size = new System.Drawing.Size(71, 12);
76 | this.label1.TabIndex = 2;
77 | this.label1.Text = "Sample Rate";
78 | //
79 | // gainBar
80 | //
81 | this.gainBar.Location = new System.Drawing.Point(19, 102);
82 | this.gainBar.Maximum = 70;
83 | this.gainBar.Name = "gainBar";
84 | this.gainBar.Size = new System.Drawing.Size(199, 45);
85 | this.gainBar.TabIndex = 3;
86 | this.gainBar.Scroll += new System.EventHandler(this.gainBar_Scroll);
87 | //
88 | // label2
89 | //
90 | this.label2.AutoSize = true;
91 | this.label2.Location = new System.Drawing.Point(19, 76);
92 | this.label2.Name = "label2";
93 | this.label2.Size = new System.Drawing.Size(29, 12);
94 | this.label2.TabIndex = 4;
95 | this.label2.Text = "Gain";
96 | //
97 | // gainDB
98 | //
99 | this.gainDB.AutoSize = true;
100 | this.gainDB.Location = new System.Drawing.Point(189, 76);
101 | this.gainDB.Name = "gainDB";
102 | this.gainDB.Size = new System.Drawing.Size(17, 12);
103 | this.gainDB.TabIndex = 5;
104 | this.gainDB.Text = "db";
105 | //
106 | // rx0
107 | //
108 | this.rx0.AutoSize = true;
109 | this.rx0.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
110 | this.rx0.Location = new System.Drawing.Point(6, 20);
111 | this.rx0.Name = "rx0";
112 | this.rx0.Size = new System.Drawing.Size(41, 16);
113 | this.rx0.TabIndex = 7;
114 | this.rx0.TabStop = true;
115 | this.rx0.Text = "RX0";
116 | this.rx0.UseVisualStyleBackColor = true;
117 | this.rx0.CheckedChanged += new System.EventHandler(this.rx0_CheckedChanged);
118 | //
119 | // rx1
120 | //
121 | this.rx1.AutoSize = true;
122 | this.rx1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
123 | this.rx1.Location = new System.Drawing.Point(6, 42);
124 | this.rx1.Name = "rx1";
125 | this.rx1.Size = new System.Drawing.Size(41, 16);
126 | this.rx1.TabIndex = 8;
127 | this.rx1.TabStop = true;
128 | this.rx1.Text = "RX1";
129 | this.rx1.UseVisualStyleBackColor = true;
130 | this.rx1.CheckedChanged += new System.EventHandler(this.rx1_CheckedChanged);
131 | //
132 | // ant_h
133 | //
134 | this.ant_h.AutoSize = true;
135 | this.ant_h.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
136 | this.ant_h.Location = new System.Drawing.Point(6, 20);
137 | this.ant_h.Name = "ant_h";
138 | this.ant_h.Size = new System.Drawing.Size(53, 16);
139 | this.ant_h.TabIndex = 10;
140 | this.ant_h.TabStop = true;
141 | this.ant_h.Text = "LNA_H";
142 | this.ant_h.UseVisualStyleBackColor = true;
143 | this.ant_h.CheckedChanged += new System.EventHandler(this.ant_h_CheckedChanged);
144 | //
145 | // ant_l
146 | //
147 | this.ant_l.AutoSize = true;
148 | this.ant_l.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
149 | this.ant_l.Location = new System.Drawing.Point(6, 42);
150 | this.ant_l.Name = "ant_l";
151 | this.ant_l.Size = new System.Drawing.Size(53, 16);
152 | this.ant_l.TabIndex = 11;
153 | this.ant_l.TabStop = true;
154 | this.ant_l.Text = "LNA_L";
155 | this.ant_l.UseVisualStyleBackColor = true;
156 | this.ant_l.CheckedChanged += new System.EventHandler(this.ant_l_CheckedChanged);
157 | //
158 | // ant_w
159 | //
160 | this.ant_w.AutoSize = true;
161 | this.ant_w.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
162 | this.ant_w.Location = new System.Drawing.Point(6, 64);
163 | this.ant_w.Name = "ant_w";
164 | this.ant_w.Size = new System.Drawing.Size(53, 16);
165 | this.ant_w.TabIndex = 12;
166 | this.ant_w.TabStop = true;
167 | this.ant_w.Text = "LNA_W";
168 | this.ant_w.UseVisualStyleBackColor = true;
169 | this.ant_w.CheckedChanged += new System.EventHandler(this.ant_w_CheckedChanged);
170 | //
171 | // groupBox1
172 | //
173 | this.groupBox1.Controls.Add(this.rx0);
174 | this.groupBox1.Controls.Add(this.rx1);
175 | this.groupBox1.Location = new System.Drawing.Point(21, 150);
176 | this.groupBox1.Name = "groupBox1";
177 | this.groupBox1.Size = new System.Drawing.Size(87, 86);
178 | this.groupBox1.TabIndex = 13;
179 | this.groupBox1.TabStop = false;
180 | this.groupBox1.Text = "Channel";
181 | //
182 | // groupBox2
183 | //
184 | this.groupBox2.Controls.Add(this.ant_h);
185 | this.groupBox2.Controls.Add(this.ant_l);
186 | this.groupBox2.Controls.Add(this.ant_w);
187 | this.groupBox2.Location = new System.Drawing.Point(114, 150);
188 | this.groupBox2.Name = "groupBox2";
189 | this.groupBox2.Size = new System.Drawing.Size(110, 86);
190 | this.groupBox2.TabIndex = 14;
191 | this.groupBox2.TabStop = false;
192 | this.groupBox2.Text = "Antenna";
193 | //
194 | // LimeSDRControllerDialog
195 | //
196 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
197 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
198 | this.CancelButton = this.close;
199 | this.ClientSize = new System.Drawing.Size(241, 300);
200 | this.Controls.Add(this.groupBox2);
201 | this.Controls.Add(this.groupBox1);
202 | this.Controls.Add(this.gainDB);
203 | this.Controls.Add(this.label2);
204 | this.Controls.Add(this.gainBar);
205 | this.Controls.Add(this.label1);
206 | this.Controls.Add(this.samplerateComboBox);
207 | this.Controls.Add(this.close);
208 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
209 | this.MaximizeBox = false;
210 | this.MinimizeBox = false;
211 | this.Name = "LimeSDRControllerDialog";
212 | this.ShowIcon = false;
213 | this.ShowInTaskbar = false;
214 | this.Text = "LimeSDR Controller test version";
215 | this.TopMost = true;
216 | this.Activated += new System.EventHandler(this.LimeSDRControllerDialog_Activated);
217 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LimeSDRControllerDialog_FormClosing);
218 | ((System.ComponentModel.ISupportInitialize)(this.gainBar)).EndInit();
219 | this.groupBox1.ResumeLayout(false);
220 | this.groupBox1.PerformLayout();
221 | this.groupBox2.ResumeLayout(false);
222 | this.groupBox2.PerformLayout();
223 | this.ResumeLayout(false);
224 | this.PerformLayout();
225 |
226 | }
227 |
228 | #endregion
229 |
230 | private System.Windows.Forms.Button close;
231 | private System.Windows.Forms.ComboBox samplerateComboBox;
232 | private System.Windows.Forms.Label label1;
233 | private System.Windows.Forms.TrackBar gainBar;
234 | private System.Windows.Forms.Label label2;
235 | private System.Windows.Forms.Label gainDB;
236 | private System.Windows.Forms.RadioButton rx0;
237 | private System.Windows.Forms.RadioButton rx1;
238 | private System.Windows.Forms.RadioButton ant_h;
239 | private System.Windows.Forms.RadioButton ant_l;
240 | private System.Windows.Forms.RadioButton ant_w;
241 | private System.Windows.Forms.GroupBox groupBox1;
242 | private System.Windows.Forms.GroupBox groupBox2;
243 | }
244 | }
--------------------------------------------------------------------------------