diff --git a/PlutoSDR/IIOHelper.cs b/PlutoSDR/IIOHelper.cs index 13b0243..7b9d09c 100644 --- a/PlutoSDR/IIOHelper.cs +++ b/PlutoSDR/IIOHelper.cs @@ -10,49 +10,16 @@ namespace SDRSharp.PlutoSDR { class IIOHelper { - public static bool SetAttribute(Device phy, string Channel, string Attribute, long Value) + public static bool SetAttribute(Device phy, string Channel, string Attribute, string Value, bool direction) { - /*MessageBox.Show("Channel: " + Channel + " - "); - MessageBox.Show("Attr: " + Attribute); - MessageBox.Show("Val: " + Value);*/ - foreach (Channel chn in phy.channels) { if (chn.attrs.Count == 0) continue; - //if (!chn.output) - // continue; - - if (chn.id.Equals(Channel)) - { - foreach (Attr attr in chn.attrs) - { - //MessageBox.Show("1: " + attr.name + " - 2:" + Attribute); - if (attr.name.CompareTo(Attribute) == 0) - { - attr.write(Value); - return true; - } - } - } - } - /*MessageBox.Show("not found Channel: " + Channel + " - "); - MessageBox.Show("not found Attr: " + Attribute); - MessageBox.Show("not found Val: " + Value);*/ - - return false; - } - public static bool SetAttribute(Device phy, string Channel, string Attribute, string Value) - { - foreach (Channel chn in phy.channels) - { - if (chn.attrs.Count == 0) + if (chn.output == direction) continue; - //if (!chn.output) - // continue; - if (chn.id.Equals(Channel)) { foreach (Attr attr in chn.attrs) @@ -68,13 +35,16 @@ public static bool SetAttribute(Device phy, string Channel, string Attribute, st return false; } - public static long GetAttribute(Device phy, string Channel, string Attribute) + public static long GetAttribute(Device phy, string Channel, string Attribute, bool direction) { foreach (Channel chn in phy.channels) { if (chn.attrs.Count == 0) continue; + if (chn.output == direction) + continue; + if (chn.id.Equals(Channel)) { foreach (Attr attr in chn.attrs) @@ -88,13 +58,16 @@ public static long GetAttribute(Device phy, string Channel, string Attribute) } return -1; } - public static string GetAttributeString(Device phy, string Channel, string Attribute) + public static string GetAttributeString(Device phy, string Channel, string Attribute, bool direction) { foreach (Channel chn in phy.channels) { if (chn.attrs.Count == 0) continue; + if (chn.output == direction) + continue; + if (chn.id.Equals(Channel)) { foreach (Attr attr in chn.attrs) diff --git a/PlutoSDR/PlutoSDRControllerDialog.Designer.cs b/PlutoSDR/PlutoSDRControllerDialog.Designer.cs index 2bd603d..0a6d4d3 100644 --- a/PlutoSDR/PlutoSDRControllerDialog.Designer.cs +++ b/PlutoSDR/PlutoSDRControllerDialog.Designer.cs @@ -58,15 +58,15 @@ private void InitializeComponent() this.bufferReadSizeLabel = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.linkLabel4 = new System.Windows.Forms.LinkLabel(); + this.label12 = new System.Windows.Forms.Label(); + this.linkLabel3 = new System.Windows.Forms.LinkLabel(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.label5 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.linkLabel2 = new System.Windows.Forms.LinkLabel(); - this.label10 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.linkLabel3 = new System.Windows.Forms.LinkLabel(); - this.label12 = new System.Windows.Forms.Label(); - this.linkLabel4 = new System.Windows.Forms.LinkLabel(); + this.label5 = new System.Windows.Forms.Label(); receiverTabPage = new System.Windows.Forms.TabPage(); receiverTabPage.SuspendLayout(); this.receiverPanel.SuspendLayout(); @@ -227,7 +227,7 @@ private void InitializeComponent() this.versionLinkLabel.Size = new System.Drawing.Size(82, 17); this.versionLinkLabel.TabIndex = 49; this.versionLinkLabel.TabStop = true; - this.versionLinkLabel.Text = "Version 0.4.4"; + this.versionLinkLabel.Text = "Version 0.5.0"; this.versionLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.versionLinkLabel_LinkClicked); // // connectButton @@ -382,46 +382,45 @@ private void InitializeComponent() this.tabPage1.Text = "About"; this.tabPage1.UseVisualStyleBackColor = true; // - // linkLabel1 + // linkLabel4 // - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(68, 33); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(205, 17); - this.linkLabel1.TabIndex = 0; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "Tobias Mädel (https://tbspace.de)"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + this.linkLabel4.AutoSize = true; + this.linkLabel4.Location = new System.Drawing.Point(11, 141); + this.linkLabel4.Name = "linkLabel4"; + this.linkLabel4.Size = new System.Drawing.Size(170, 17); + this.linkLabel4.TabIndex = 8; + this.linkLabel4.TabStop = true; + this.linkLabel4.Text = "E-Mail / t.maedel@alfeld.de"; + this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); // - // label5 + // label12 // - this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.Location = new System.Drawing.Point(3, 8); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(169, 25); - this.label5.TabIndex = 1; - this.label5.Text = "PlutoSDR for SDR#"; + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 104); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(130, 17); + this.label12.TabIndex = 7; + this.label12.Text = "Issues? Suggestions?"; // - // label9 + // linkLabel3 // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 33); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(69, 17); - this.label9.TabIndex = 2; - this.label9.Text = "written by "; + this.linkLabel3.AutoSize = true; + this.linkLabel3.Location = new System.Drawing.Point(11, 121); + this.linkLabel3.Name = "linkLabel3"; + this.linkLabel3.Size = new System.Drawing.Size(235, 17); + this.linkLabel3.TabIndex = 6; + this.linkLabel3.TabStop = true; + this.linkLabel3.Text = "GitHub / manawyrm/sdrsharp-plutosdr"; + this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked); // - // linkLabel2 + // label11 // - this.linkLabel2.AutoSize = true; - this.linkLabel2.Location = new System.Drawing.Point(11, 207); - this.linkLabel2.Name = "linkLabel2"; - this.linkLabel2.Size = new System.Drawing.Size(196, 17); - this.linkLabel2.TabIndex = 3; - this.linkLabel2.TabStop = true; - this.linkLabel2.Text = "GNU General Public License v3.0"; - this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 65); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(285, 17); + this.label11.TabIndex = 5; + this.label11.Text = "Uses libiio and libad9361-iio by Analog Devices"; // // label10 // @@ -432,45 +431,46 @@ private void InitializeComponent() this.label10.TabIndex = 4; this.label10.Text = "Licensed under:"; // - // label11 + // linkLabel2 // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(6, 65); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(285, 17); - this.label11.TabIndex = 5; - this.label11.Text = "Uses libiio and libad9361-iio by Analog Devices"; + this.linkLabel2.AutoSize = true; + this.linkLabel2.Location = new System.Drawing.Point(11, 207); + this.linkLabel2.Name = "linkLabel2"; + this.linkLabel2.Size = new System.Drawing.Size(196, 17); + this.linkLabel2.TabIndex = 3; + this.linkLabel2.TabStop = true; + this.linkLabel2.Text = "GNU General Public License v3.0"; + this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // - // linkLabel3 + // linkLabel1 // - this.linkLabel3.AutoSize = true; - this.linkLabel3.Location = new System.Drawing.Point(11, 121); - this.linkLabel3.Name = "linkLabel3"; - this.linkLabel3.Size = new System.Drawing.Size(235, 17); - this.linkLabel3.TabIndex = 6; - this.linkLabel3.TabStop = true; - this.linkLabel3.Text = "GitHub / manawyrm/sdrsharp-plutosdr"; - this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked); + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(68, 33); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(205, 17); + this.linkLabel1.TabIndex = 0; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "Tobias Mädel (https://tbspace.de)"; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // - // label12 + // label9 // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(6, 104); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(130, 17); - this.label12.TabIndex = 7; - this.label12.Text = "Issues? Suggestions?"; + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(6, 33); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(69, 17); + this.label9.TabIndex = 2; + this.label9.Text = "written by "; // - // linkLabel4 + // label5 // - this.linkLabel4.AutoSize = true; - this.linkLabel4.Location = new System.Drawing.Point(11, 141); - this.linkLabel4.Name = "linkLabel4"; - this.linkLabel4.Size = new System.Drawing.Size(170, 17); - this.linkLabel4.TabIndex = 8; - this.linkLabel4.TabStop = true; - this.linkLabel4.Text = "E-Mail / t.maedel@alfeld.de"; - this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(3, 8); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(169, 25); + this.label5.TabIndex = 1; + this.label5.Text = "PlutoSDR for SDR#"; // // PlutoSDRControllerDialog // diff --git a/PlutoSDR/PlutoSDRDevice.cs b/PlutoSDR/PlutoSDRDevice.cs index ccf3342..43ba4ba 100644 --- a/PlutoSDR/PlutoSDRDevice.cs +++ b/PlutoSDR/PlutoSDRDevice.cs @@ -67,7 +67,7 @@ public int ManualGain { _manualGain = value; if (_dev != null) - IIOHelper.SetAttribute(_dev, "voltage0", "hardwaregain", value); + IIOHelper.SetAttribute(_dev, "voltage0", "hardwaregain", value.ToString(), true); } } @@ -130,7 +130,7 @@ public int Bandwidth _gui.bandwidthLabel.Text = _bandwidth.ToString() + " Hz"; if (_dev != null) { - IIOHelper.SetAttribute(_dev, "voltage0", "rf_bandwidth", value); + IIOHelper.SetAttribute(_dev, "voltage0", "rf_bandwidth", value.ToString(), true); } } } @@ -139,7 +139,7 @@ public string RSSI { get { - return IIOHelper.GetAttributeString(_dev, "voltage0", "rssi"); + return IIOHelper.GetAttributeString(_dev, "voltage0", "rssi", true); } } @@ -155,8 +155,8 @@ public string GainControlMode { _gainControlMode = value; } - IIOHelper.SetAttribute(_dev, "voltage0", "gain_control_mode", value); - IIOHelper.SetAttribute(_dev, "voltage1", "gain_control_mode", value); + IIOHelper.SetAttribute(_dev, "voltage0", "gain_control_mode", value, true); + IIOHelper.SetAttribute(_dev, "voltage1", "gain_control_mode", value, true); } } @@ -174,7 +174,7 @@ public long Frequency { try { - IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", _centerFrequency); + IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", _centerFrequency.ToString(), false); } catch (Exception ex) { @@ -250,7 +250,7 @@ private unsafe void ReceiveSamples_sync() try { _buf.refill(); - + samplesI = _rx0_i.read(_buf); samplesQ = _rx0_q.read(_buf); diff --git a/PlutoSDR/Properties/AssemblyInfo.cs b/PlutoSDR/Properties/AssemblyInfo.cs index 23972a9..e8c0743 100644 --- a/PlutoSDR/Properties/AssemblyInfo.cs +++ b/PlutoSDR/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SDR#")] -[assembly: AssemblyCopyright("Copyright © Tobias Mädel 2017")] +[assembly: AssemblyCopyright("Copyright © Tobias Mädel 2017-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/PlutoSDR/SDRSharp.PlutoSDR.csproj b/PlutoSDR/SDRSharp.PlutoSDR.csproj index 9eb6d53..9fb7958 100644 --- a/PlutoSDR/SDRSharp.PlutoSDR.csproj +++ b/PlutoSDR/SDRSharp.PlutoSDR.csproj @@ -28,7 +28,7 @@ pdbonly true - bin\Release\ + ..\..\..\..\Programme\SDR\sdrsharp\ TRACE prompt 4 @@ -81,15 +81,15 @@ - ..\..\..\..\Desktop\libiio-win32\libiio-win32\libiio-sharp.dll + ..\..\..\..\Programme\SDR\sdrsharp\libiio-sharp.dll False - ..\..\..\..\SDR\sdrsharp-x86\SDRSharp.Common.dll + ..\..\..\..\Programme\SDR\sdrsharp\SDRSharp.Common.dll False - ..\..\..\..\SDR\sdrsharp-x86\SDRSharp.Radio.dll + ..\..\..\..\Programme\SDR\sdrsharp\SDRSharp.Radio.dll